oneTBB icon indicating copy to clipboard operation
oneTBB copied to clipboard

Fix invalid WORKING_DIRECTORY for tests

Open phprus opened this issue 3 years ago • 1 comments

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

phprus avatar Aug 08 '22 18:08 phprus

ping?

phprus avatar Sep 14 '22 10:09 phprus

Rebased onto current master.

phprus avatar Oct 01 '22 13:10 phprus

Rebased

phprus avatar Nov 05 '22 14:11 phprus

Hi @phprus, how to reproduce this problem?

pavelkumbrasev avatar Nov 16 '22 13:11 pavelkumbrasev

@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

phprus avatar Nov 16 '22 17:11 phprus

Ping?

phprus avatar Nov 25 '22 10:11 phprus

@pavelkumbrasev, @isaevil what do you think about this PR?

phprus avatar Dec 13 '22 15:12 phprus

@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 avatar Dec 14 '22 09:12 isaevil

@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...

phprus avatar Dec 14 '22 09:12 phprus

@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...

We can also use RUNTIME_OUTPUT_DIRECTORY_<CONFIG>.

isaevil avatar Dec 14 '22 09:12 isaevil

@isaevil PR updated.

Test: https://github.com/phprus/oneTBB/tree/msvc_vs_wd-fix

phprus avatar Dec 14 '22 15:12 phprus

@pavelkumbrasev, @isaevil ping?

Rebased and changed copyright year in files.

phprus avatar Jan 10 '23 11:01 phprus