ThrowTheSwitch / Ceedling

Ruby-based unit testing and build system for C projects
http://throwtheswitch.org
Other
581 stars 244 forks source link

Qemu as test fixture #637

Open nbattezzati opened 2 years ago

nbattezzati commented 2 years ago

Hi all, I have a problem trying to use Qemu as the fixture to run unit tests on an emulated Microblaze. I think everything is quite up and running, and if I execute Qemu with the compiled runner I can get the expected unity output on the console, through the emulated UART, that contains the output of the tests, the number of executed, failed and ignored tests.

TEST Example!
test_example.c:2:test_example:PASS
TEST Example #2!
test_example.c:110:test_example2:PASS

-----------------------
2 Tests 0 Failures 0 Ignored 
OK

This is the command line I use to run the executable created by Ceedling with Qemu:

qemu-system-microblazeel -M microblaze-fdt-plnx -m 256 -serial mon:stdio -display none -hw-dtb system.dtb -device loader,file=./test/build/test/out/test_example.elf

However, if I run the test through Ceedling using Qemu as the fixture, as follows,

:test_fixture:
   :executable: qemu-system-microblazeel
   :name: 'QEMU microblaze test runner'
   :arguments:
      - -M microblaze-fdt-plnx
      - -m 256
      - -serial mon:stdio
      - -display none
      - -hw-dtb system.dtb
      - -device loader,file=${1}

it fails saying that the number of test executed by unity (2) differs from the one reported by the fixture (0).

ERROR: Internal sanity check for test fixture 'test_example.elf' finds that Unity's final test count (2) does not match Ceedling's summation of all test cases (0).

Can this be somehow related to the exit code of the fixture? Since Qemu always exits with a 0 value...

Is there any document that explains the interfaces a fixture shall implement to properly work with Ceedling/Unity?

Thank you very much for your support!

lcavalli commented 2 years ago

Maybe it is too late, but this is the same issue I had with a SPARC simulator. The issue is #693.