Fix invalid WORKING_DIRECTORY for tests
Description
Fix invalid WORKING_DIRECTORY for tests and multi-config CMake Generator (like Microsoft Visual Studio).
In a multi-configuration environment, the ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} variable may not correspond to the actual directory where the executables will be.
See:
https://github.com/oneapi-src/oneTBB/blob/323260671b40db33c9fc0d66d1f1eed6ecc82ce2/CMakeLists.txt#L156-L172
Fixes # - issue number(s) if exists
- [x] - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)
Type of change
Choose one or multiple, leave empty if none of the other choices apply
Add a respective label(s) to PR if you have permissions
- [x] bug fix - change that fixes an issue
- [ ] new feature - change that adds functionality
- [x] tests - change in tests
- [ ] infrastructure - change in infrastructure and CI
- [ ] documentation - documentation update
Tests
- [ ] added - required for new features and some bug fixes
- [x] not needed
Documentation
- [ ] updated in # - add PR number
- [ ] needs to be updated
- [x] not needed
Breaks backward compatibility
- [ ] Yes
- [x] No
- [ ] Unknown
Notify the following users
List users with @ to send notifications
Other information
ping?
Rebased onto current master.
Rebased
Hi @phprus, how to reproduce this problem?
@pavelkumbrasev
I apologize for the delay and incorrect commands in the deleted comment.
See CI results for commit https://github.com/phprus/oneTBB/commit/dddd55069e85d9ffceae59f35368b9c1ebd00430 For example: https://github.com/phprus/oneTBB/actions/runs/3481119210/jobs/5821796042
Test #137: test_malloc_overload_disable .............***Failed 0.02 sec
'test_malloc_overload_disable.exe' is not recognized as an internal or external command,
operable program or batch file.
[doctest] doctest version is "2.4.7"
[doctest] run with "--help" for options
Test error: unable to run the command: test_malloc_overload_disable.exe
Or local:
cmake -G "Visual Studio 16 2019" -A x64 -T v142 ../..
cmake --build . --config Release
ctest -C Release --output-on-failure
Error:
137/138 Test #137: test_malloc_overload_disable .............***Failed 0.04 sec
"test_malloc_overload_disable.exe" ?? ????? ???????? ??? ?????
????????, ??????? ?????? ??? ?????? ????.
[doctest] doctest version is "2.4.7"
[doctest] run with "--help" for options
Test error: unable to run the command: test_malloc_overload_disable.exe
Ping?
@pavelkumbrasev, @isaevil what do you think about this PR?
@phprus I don't quite like the idea that we are actually bypassing the value of RUNTIME_OUTPUT_DIRECTORY because right now we have a single control point at root CMakeLists.txt. RUNTIME_OUTPUT_DIRECTORY can use generator-expressions. Maybe we can just use generator-expression like you did at root CMake file where RUNTIME_OUTPUT_DIRECTORY is set? What do you think?
@isaevil
RUNTIME_OUTPUT_DIRECTORY supports generator expressions since CMake 3.4.
We can create the TBB_TEST_WORKING_DIRECTORY variable in the root CMakeLists.txt.
I will update the PR a bit later...
@isaevil
RUNTIME_OUTPUT_DIRECTORYsupports generator expressions since CMake 3.4. We can create theTBB_TEST_WORKING_DIRECTORYvariable in the rootCMakeLists.txt.I will update the PR a bit later...
We can also use RUNTIME_OUTPUT_DIRECTORY_<CONFIG>.
@isaevil PR updated.
Test: https://github.com/phprus/oneTBB/tree/msvc_vs_wd-fix
@pavelkumbrasev, @isaevil ping?
Rebased and changed copyright year in files.