Rantanen / intercom

Object based cross-language FFI for Rust
MIT License
63 stars 7 forks source link

Moved current tests to a compiler specific directory #22

Closed Fluxie closed 6 years ago

Fluxie commented 6 years ago

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.

Fluxie commented 6 years ago

I'm not sure I can fix the issue without access to Windows build environment.

Rantanen commented 6 years ago

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.

Rantanen commented 6 years ago

I went ahead and implemented my suggestion to fix the current issue.

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:

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.

Rantanen commented 6 years ago

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.