-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows tests #2
Conversation
Switched the code to using std::filesystem instead of boost::filesystem, and taught the project how to build GoogleTest for itself if needed.
Introduced tests for all of the public headers in those two libraries, and made sure that those and the existing unit tests would compile without warnings using MSVC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks in order, some minor questions though. But I am not against any of this. I'll take a look at the issue you pointed out tomorrow (i.e. today).
(std::is_scalar_v<Args> && ...) && | ||
(std::is_convertible_v<Args, T> && ...) && sizeof...(Args) == N, | ||
std::conjunction_v<std::is_scalar<Args>...> && | ||
std::conjunction_v<std::is_convertible<Args, T>...> && | ||
sizeof...(Args) == N, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the problem here? Does MSVC not like fold expressions? 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar situation here. In C++17 mode this fails with:
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(45,59): error C2059: syntax error: '...' [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(63,2): message : see reference to class template instantiation 'covfie::algebra::vector<N,T,I>' being compiled [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(48,19): error C2059: syntax error: '=' [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(50,9): error C2059: syntax error: ':' [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(50,1): error C2334: unexpected token(s) preceding ':'; skipping apparent function body [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(63): error C2143: syntax error: missing '>' before ';' [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(63): error C2059: syntax error: '>' [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(63): error C2238: unexpected token(s) preceding ';' [C:\Users\k rasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
C:\Users\krasz\ATLAS\covfie\covfie\lib\core\covfie/core/algebra/vector.hpp(63): fatal error C1201: unable to continue after syntax error in class template definition [C:\Users\krasz\ATLAS\covfie\build\tests\core\test_core.vcxproj]
But in C++20 mode it accepts the original code as well.
Since we were talking about this exact formalism in acts-project/algebra-plugins#95 earlier yesterday, I tried that, and that worked with both C++ standards...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a shame, and quite odd since fold expressions are a C++17 feature. Again, I don't mind too much but it is a bit annoying that MSVC seems to refuse completely valid C++, and also I think the fold syntax is a lot clearer than the conjunction syntax... 😦
option(COVFIE_SETUP_GOOGLETEST "Set up the GoogleTest targets explicitly" | ||
TRUE) | ||
option(COVFIE_USE_SYSTEM_GOOGLETEST | ||
"Pick up an existing installation of GoogleTest from the build environment" | ||
TRUE) | ||
if(COVFIE_SETUP_GOOGLETEST) | ||
if(COVFIE_USE_SYSTEM_GOOGLETEST) | ||
find_package(GTest CONFIG REQUIRED) | ||
else() | ||
add_subdirectory(googletest) | ||
endif() | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any good reason for any project importing this to ever need to build the tests? I'm okay with the COVFIE_USE_SYSTEM_GOOGLETEST
flag but I'm not sure if the COVFIE_SETUP_GOOGLETEST
flag would ever be useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed not too likely that we'll want to build the covfie unit tests when building covfie as part of a downstream project. But on the off chance that we ever want to do that, it's good to have the theoretical ability.
The logic with the two cache variables is the same that we use in all the other R&D projects. So I'm keen to use it in the same way here as well.
char fname[L_tmpnam]; | ||
char * dummy = std::tmpnam(fname); | ||
(void)dummy; | ||
return std::filesystem::temp_directory_path() / | ||
std::filesystem::path(fname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is one of the main reasons I used Boost, temporary file handling in std::filesystem
is awful... But I guess it's a price we can pay for removing the dependency... I'm not against it per se. But if you want to remove Boost completely it will also need to be removed from the benchmarks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I do hate this. 😦 The Boost version looks a bit more elegant, though that's not any safer either. So I understand why they left this out of the standard implementation. (Not to give people the false sense that using that function would result in safe code.)
As long as Boost is only used for this one purpose in the benchmarks and examples as well, then sure, I can look into that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boost is used for way more than just for temporary file creation in the benchmarks and the examples. I won't rewrite all of those to Boost-less C++ myself...
For Detray, which is my current objective, that is not really needed anyway.
Also it might be useful to add a Windows CI job. |
I changed my mind... Let's just keep the scope of this PR as is. I'm afraid of making it into an unreviewable mess by the end. It does mean adding some commented lines into |
We'll discuss this in person, but just to give you a heads' up: What makes the CUDA test fail is something that I believe would fail with MSVC by itself as well, we just don't test for it at the moment. It's the fact that Instead of adding explicit conversions between these in a bunch of places, I think we'll just need to make the code use one of those 2 types consistently everywhere. |
Since I quickly realized while working with Detray that this project's code will still need some work for Windows compatibility, I went ahead and set up the basic ability to perform a Windows based build. But this just opened can of worms... 😦
I tried to set up the same sort of header tests for this project that we have in the other R&D projects as well. Which would make sure that the headers include everything that they need, and that the CMake targets are configured correctly. But this quickly resulted in:
Which is a fundamental enough issue that I'd not want to sort it out in this PR. (Is that file used anywhere? I guess not.)
But at least I went through the unit tests, and made sure that those would all compile without warnings with MSVC. And to think that I was really just trying to replace
uint
withunsigned int
when I started with this all...P.S. The CUDA test on Windows just refuses to build. 😦 But I gave up on it for today...