Closed Fluxie closed 6 years ago
I'm not sure I can fix the issue without access to Windows build environment.
Fixing the failure should be as simple as updating the paths in scripts/ci.bat
and scripts/test.ps1
to point to the new location.
However before we go through with this change, I'd like some resolution to #23.
If we consider the C++ tests as "baseline", then instead of moving them to completely different directory, I'd prefer something such as:
tests/
|
|- cpp-raw/
| |- msvc/
| | |- platform.cpp
| | |- cpp-raw.sln
| | '- cpp-raw.vcproj
| |
| |- gcc/
| | |- platform.cpp
| | '- Makefile (?)
| |
| |- llvm/
| | |- platform.cpp
| | '- Makefile (?)
| |
| |- tests.cpp...
| '- ...
|
|- cpp-api/
| '- ...
|
'- cs/
'- ...
Otherwise we'd need to duplicate most of our base tests between different platforms. We will want to test the base functionality, such as ref counting, query interface, interface return, interface implementation, etc. on multiple platforms.
I went ahead and implemented my suggestion to fix the current issue.
/test/cpp-raw
contains platform agnostic sources for unit tests. These sources should not reference any platform libraries, etc. that make it impossible to use the code on other platforms./test/cpp-raw/os.h
- The os.h header is an exception to the above rule. Any conditional includes (such as the TestLib_h.h
generated by midl on Windows) are included here - but these includes are hidden behind compiler defines./test/cpp-raw/msvc/
includes both the Visual Studio solution and project for compiling the tests as well as any MSVC specific sources that are needed for the test. At minimum this includes the definitions of the InitializeRuntime
, UniniailizeRuntime
and CreateInstance
methods declared, but not defined, in os.h
.The project file is built in such a way that it references the sources using *.cpp
wildcard. New test sources can be added in test/cpp-raw
without the need to modify the Visual Studio project file.
If we can later expand these unit tests for other platforms, these same considerations should apply:
test/cpp-raw/
directory.test/cpp-raw/tests/
directory or similar.If we later migrate the C++ tests on top of CMake or similar build system, we can either get rid of the msvc
directory and use CMake for Windows builds or leave the msvc
as a test and an example for those who wish to use Visual Studio without CMake. I have no preference either way.
If you still encounter issues with the current setup re-open this or suggest something else. I just wanted to ensure that we won't end up in a situation where the current C++ unit tests would be restricted to Windows if we can help it.
Also I didn't touch the C# tests here. Mono seems to be using xbuild, which is msbuild compatible as far as I can tell. This could mean that there is a chance that the current .csproj
is compatible with that.
In any case, I'd rather revisit the C# tests once that becomes a problem. Ideally if we end up supporting Mono on Linux, I'd rather share those tests between the platforms as well.
We need a place to write tests for gcc and clang. The test directory called "cpp" was rather limiting.
NOTE: I could not test the compilation but I did try to modify the project files accordingly.