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

Mull cannot run CTest's tests #794

Open
ligurio opened this issue Dec 19, 2020 · 1 comment
Open

Mull cannot run CTest's tests #794

ligurio opened this issue Dec 19, 2020 · 1 comment

Comments

@ligurio
Copy link
Contributor

ligurio commented Dec 19, 2020

CMake allows to generate binaries with unit tests from a C functions and these tests supports special protocol to run testcases [1].
To run a single testcase one need to execute a binary and choose a number of testcase:

(venv) sergeyb@pony:~/sources/FreeRDP/build$ ./Testing/TestPipe 
Available tests:
  0. TestPipeCreatePipe
  1. TestPipeCreateNamedPipe
  2. TestPipeCreateNamedPipeOverlapped
To run a test, enter the test number: 1
Server ReadFile: 32 bytes
Client ReadFile: 32 bytes
(venv) sergeyb@pony:~/sources/FreeRDP/build$ 

or run specify arbitrary name of testcase to run:

(venv) sergeyb@pony:~/sources/FreeRDP/build$ ./Testing/TestPipe -R TestPipeCreateNamedPipe
Server ReadFile: 32 bytes
Client ReadFile: 32 bytes
(venv) sergeyb@pony:~/sources/FreeRDP/build$ 

Also there was a MR to run all testcases at once [2], but it was not merged to a master though.

FreeRDP project actively uses tests written to run with CTest. Test failed with timeout when running using Mull because Mull don't know that test expects an input with a number of testcase.

$ git clone https://github.com/FreeRDP/FreeRDP/
$ cmake -DCMAKE_C_FLAGS="-fembed-bitcode -g -O0" -DCMAKE_CXX_FLAGS="-fembed-bitcode -g -O0" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON  -DCMAKE_C_COMPILER="/usr/bin/clang" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DBUILD_TESTING=ON ..
$ make -j
$ mull-cxx -test-framework=CustomTest --ld-search-path=/lib/x86_64-linux-gnu --compdb-path=compile_commands.json  --reporters=Elements ./Testing/TestAsn1  
[info] Extracting bitcode from executable (threads: 1)
       [################################] 1/1. Finished in 2ms
[info] Loading bitcode files (threads: 8)
       [################################] 13/13. Finished in 11ms
[info] Compiling instrumented code (threads: 8)
       [################################] 13/13. Finished in 10ms
[info] Loading dynamic libraries (threads: 1)
       [################################] 1/1. Finished in 1ms
[info] Searching tests (threads: 1)
       [################################] 1/1. Finished in 0ms
[info] Preparing original test run (threads: 1)
       [################################] 1/1. Finished in 2ms
[info] Running original tests (threads: 1)
[warning] Original test failed
test: main
status: Timedout
stdout: 'Available tests:
  0. TestAsn1Module
  1. TestAsn1Encoder
  2. TestAsn1Decoder
  3. TestAsn1Encode
  4. TestAsn1Decode
  5. TestAsn1String
  6. TestAsn1Integer
  7. TestAsn1Compare
  8. TestAsn1BerEnc
  9. TestAsn1BerDec
 10. TestAsn1DerEnc
 11. TestAsn1DerDec
To run a test, enter the test number: '
stderr: ''

       [################################] 1/1. Finished in 3014ms
[info] No mutants found. Mutation score: infinitely high
[info] Total execution time: 3077ms
  1. https://gitlab.kitware.com/cmake/community/-/wikis/doc/ctest/Testing-With-CTest#running-individual-tests
  2. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/3661#note_617780
@ligurio
Copy link
Contributor Author

ligurio commented Apr 29, 2021

Also there was a MR to run all testcases at once [2], but it was not merged to a master though.

In upcoming cmake release it will be possible to run all testcases in a single test run Kitware/CMake@3f6ff4b

(I think it will be helpful if Mull's authors will decide to support tests generated by CMake.)

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

No branches or pull requests

1 participant