Skip to content
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

SWDEV-359379 - WIP catch2 exe per src file inplace of one exe per module [TEST ONLY. DO NOT MERGE] #3018

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

agunashe
Copy link
Contributor

SWDEV-359379 - WIP catch2 exe per src file inplace of one exe per module [TEST ONLY]

This patch enables the multiple exes instead of single exe per module.
As an example, unit/event is chosen to demonstrate the multiple exes.

Previously during build time that is "make build_tests" -

  1. hip_add_exe_to_target would call catch_discover_tests with the name of exe.
  2. catch_discover_tests would generate Event_include-xxxxxx.cmake file.

Previously during execution time that is "ctest" -

  1. Each top level CTestTestfile would call child CTestTestfile.
  2. The bottom most CTestTestfile will include Event_include-xxxxxx.cmake
  3. Event_include-xxxxxx.cmake would call CatchAddTests.cmake to generate Event_tests-xxxxxxx.cmake
  4. Event_tests-xxxxxxx.cmake contains the add_test macro which in turn calls exe with the test name

Proposed solution-

During build time "make build_tests" -

  1. hip_add_exe_to_target would call catch_discover_tests with source name and exe name per file
  2. catch_discover_tests would generate Event_include-xxxxxx.cmake file and Event_exec_list.txt
  3. Event_exec_list.txt contains the list of exes

During execution time "ctest"-

  1. Each top level CTestTestfile would call child CTestTestfile.
  2. The bottom most CTestTestfile will include Event_include-xxxxxx.cmake
  3. Event_include-xxxxxx.cmake would read Event_exec_list.txt and include catch_include.cmake which calls CatchAddTests.cmake to generate Event_tests-xxxxxxx.cmake
  4. Event_tests-xxxxxxx.cmake contains the add_test macro which in turn calls exe with the test name

TODO-

  1. paths in Event_include-xxxxxx.cmake needs to be relative to the running set.
  2. exe name to be take only the name , need to strip off the extension of the source
  3. enable all the commented tests

Change-Id: Ib2e533adfc29e39066e80a3bad5ce2cf00125fd7

Change-Id: Ib2e533adfc29e39066e80a3bad5ce2cf00125fd7
@mangupta mangupta marked this pull request as draft October 19, 2022 06:52
@gargrahul
Copy link
Contributor

@pvelesko Please take a look at this WIP PR.

@pvelesko
Copy link
Contributor

@gargrahul @agunashe

[100%] Built target build_tests
pvelesko@arcticus15:~/space/CHIP-SPV/build> ctest
Test project /home/pvelesko/space/CHIP-SPV/build
CMake Error at Unit_hipEvent_Negative_include-b12d07c.cmake:1 (file):
  file failed to open for reading (No such file or directory):

    /'Unit_hipEvent_Negative_exec_list.txt'
Call Stack (most recent call first):
  /home/pvelesko/space/CHIP-SPV/build/catch/catch_tests/unit/event/CTestTestfile.cmake:7 (include)
  /home/pvelesko/space/CHIP-SPV/build/catch/catch_tests/unit/CTestTestfile.cmake:7 (subdirs)
  /home/pvelesko/space/CHIP-SPV/build/catch/CTestTestfile.cmake:7 (subdirs)
  CTestTestfile.cmake:13 (subdirs)


Working dir : /home/pvelesko/space/CHIP-SPV/build/catch/catch_tests/unit/event
CMake Error at /home/pvelesko/space/CHIP-SPV/build/catch/catch_tests/script/catch_include.cmake:40 (include):
  include could not find requested file:

    Unit_hipEvent_Negative_tests-b12d07c.cmake
Call Stack (most recent call first):
  Unit_hipEvent_Negative_include-b12d07c.cmake:7 (include)
  /home/pvelesko/space/CHIP-SPV/build/catch/catch_tests/unit/event/CTestTestfile.cmake:7 (include)
  /home/pvelesko/space/CHIP-SPV/build/catch/catch_tests/unit/CTestTestfile.cmake:7 (subdirs)
  /home/pvelesko/space/CHIP-SPV/build/catch/CTestTestfile.cmake:7 (subdirs)
  CTestTestfile.cmake:13 (subdirs)


Errors while running CTest
Output from these tests are in: /home/pvelesko/space/CHIP-SPV/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

pvelesko@arcticus15:~/space/CHIP-SPV/build> find ./ -name "Unit_hipEvent_Negative_exec_list.txt"
./catch/catch_tests/unit/event/Unit_hipEvent_Negative_exec_list.txt

@pvelesko
Copy link
Contributor

@agunashe any insight into how to make this work?

@agunashe
Copy link
Contributor Author

@pvelesko - sorry I am still working on it. I should have some update next week.

@pvelesko
Copy link
Contributor

@agunashe @gargrahul any updates? This is blocking us from upgrading our HIP base version for CHIP-SPV.

@agunashe
Copy link
Contributor Author

@agunashe @gargrahul any updates? This is blocking us from upgrading our HIP base version for CHIP-SPV.

I reworked on the standalone tests in hip-tests repo.
ROCm/hip-tests#86

The PR is still experimental and fails in windows, but it works fine on Linux. For development purposes most of the folders are commented, only ABM folder is used. To build all folders please uncomment all the folders in the catch/CMakeLists.txt file, Then use -DSTANDALONE_TESTS=1 during building to generate exe per file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants