HIP icon indicating copy to clipboard operation
HIP copied to clipboard

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

Open agunashe opened this issue 3 years ago • 6 comments

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

agunashe avatar Oct 19 '22 00:10 agunashe

@pvelesko Please take a look at this WIP PR.

gargrahul avatar Oct 20 '22 04:10 gargrahul

@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 avatar Nov 15 '22 13:11 pvelesko

@agunashe any insight into how to make this work?

pvelesko avatar Nov 23 '22 11:11 pvelesko

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

agunashe avatar Nov 30 '22 00:11 agunashe

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

pvelesko avatar Dec 19 '22 09:12 pvelesko

@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. https://github.com/ROCm-Developer-Tools/hip-tests/pull/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

agunashe avatar Dec 19 '22 11:12 agunashe