mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
gem5: expose unit tests
This commit is contained in:
35
README.adoc
35
README.adoc
@@ -10140,7 +10140,39 @@ Tested on: link:http://github.com/cirosantilli/linux-kernel-module-cheat/commit/
|
||||
|
||||
https://stackoverflow.com/questions/52279971/how-to-run-the-gem5-unit-tests
|
||||
|
||||
Not currently exposed here.
|
||||
These are just very small GTest tests that test a single class in isolation, they don't run any executables.
|
||||
|
||||
Build the unit tests and run them:
|
||||
|
||||
....
|
||||
./build-gem5 --unit-tests
|
||||
....
|
||||
|
||||
Building individual unit tests is not exposed, but it is easy to do: while running the full tests, GTest prints each test command being run, e.g.:
|
||||
|
||||
....
|
||||
/path/to/build/ARM/base/circlebuf.test.opt --gtest_output=xml:/path/to/build/ARM/unittests.opt/base/circlebuf.test.xml
|
||||
[==========] Running 4 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 4 tests from CircleBufTest
|
||||
[ RUN ] CircleBufTest.BasicReadWriteNoOverflow
|
||||
[ OK ] CircleBufTest.BasicReadWriteNoOverflow (0 ms)
|
||||
[ RUN ] CircleBufTest.SingleWriteOverflow
|
||||
[ OK ] CircleBufTest.SingleWriteOverflow (0 ms)
|
||||
[ RUN ] CircleBufTest.MultiWriteOverflow
|
||||
[ OK ] CircleBufTest.MultiWriteOverflow (0 ms)
|
||||
[ RUN ] CircleBufTest.PointerWrapAround
|
||||
[ OK ] CircleBufTest.PointerWrapAround (0 ms)
|
||||
[----------] 4 tests from CircleBufTest (0 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 4 tests from 1 test case ran. (0 ms total)
|
||||
[ PASSED ] 4 tests.
|
||||
....
|
||||
|
||||
so you can just copy paste the command.
|
||||
|
||||
Note that the command and it's corresponding results don't need to show consecutively on stdout because tests are run in parallel. You just have to match them based on the class name `CircleBufTest` to the file `circlebuf.test.cpp`.
|
||||
|
||||
== Buildroot
|
||||
|
||||
@@ -12080,6 +12112,7 @@ The link:test[] script runs several different types of tests, which can also be
|
||||
* <<user-mode-tests>>
|
||||
* <<baremetal-tests>>
|
||||
* <<test-gdb>>
|
||||
* <<gem5-unit-tests>>
|
||||
|
||||
link:test[] does not all possible tests, because there are too many possible variations and that would take forever. The rationale is the same as for `./build all` and is explained in `./build --help`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user