Skip to contentSkip to conversation

rteval: Move unittest.py to tests/unittest-legacy.py

PATCH In review Tomas Glozar 2 participants 4 messages Nov 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rteval: Move unittest.py to tests/unittest-legacy.py

We now have a tests/ folder. Move unittest.py there, rename it to unittest-legacy.py to prevent conflict with Python's unittest module, and remove the now empty directory unit-tests/.

---
This is a follow-up to [1], in place of patch 2 and 3. Patch 1 got applied, patches 2 and 3 required changes following the merging of [2].

[1] https://lore.kernel.org/linux-rt-users/[email protected]/T/
[2] https://lore.kernel.org/linux-rt-users/[email protected]/T/

 unit-tests/unittest.py => tests/unittest-legacy.py | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename unit-tests/unittest.py => tests/unittest-legacy.py (100%)
tests/unittest-legacy.py renamed from unit-tests/unittest.py +0 -0
similarity index 100%
rename from unit-tests/unittest.py
rename to tests/unittest-legacy.py
Signature · 1 line
2.51.1
#1 lore raw

PATCH 2/2 rteval: Add README-tests

Add a README-tests file describing what tests are implemented for rteval and how to run them.

---
 README-tests | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 README-tests
README-tests new file +102 -0
new file mode 100644
index 0000000..802d4eb
@@ -0,0 +1,102 @@
+There currently exist four kinds of tests for rteval:
+
+- Unit tests
+
+Unit tests reside in the tests/ directory. They are Python modules which import
+the Python unittest library.
+
+The Makefile target "unittest" (or, alternatively, just "test") invokes unit
+tests:
+
+$ make test
+Running unit tests...
+./run_tests.sh
+=========================================
+Running rteval Unit Tests
+=========================================
+
+Running: test_measurement_module_selection
+---
+test_argparse_rejects_invalid_module (__main__.TestMeasurementModuleSelection)
+Test that argparse rejects invalid module names ... usage: test_measurement_module_selection.py [--measurement-module {cyclictest,timerlat}]
+test_measurement_module_selection.py: error: argument --measurement-module: invalid choice: 'invalid' (choose from 'cyclictest', 'timerlat')
+ok
+...
+
+----------------------------------------------------------------------
+Ran 6 tests in 0.003s
+
+OK
+✓ PASSED: test_measurement_module_selection
+
+=========================================
+Test Summary
+=========================================
+Total tests run: 1
+Passed: 1
+Failed: 0
+
+✓ All tests passed!
+
+- End-to-end tests
+
+End-to-end tests reside in the tests/e2e subdirectory, in files with
+the .t extension. They are written in bash and produce output compatible with
+the TEP standard.
+
+To run end-to-end tests, the rteval kcompile source tarball has to be present;
+see LOADS variable in Makefile for the tarballs used by the current version of
+rteval.
+
+The Makefile target "check" invokes the end-to-end tests under Test::Harness
+via the "prove" command:
+
+$ sudo make e2e-tests
+PYTHON="python3" RTEVAL="/usr/src/rteval/rteval-cmd" RTEVAL_PKG="/usr/src/rteval" prove -o -f -v tests/e2e/
+...
+All tests successful.
+Files=3, Tests=33, 288 wallclock secs ( 0.02 usr  0.00 sys + 127.59 cusr 155.27 csys = 282.88 CPU)
+Result: PASS
+
+Test::Harness here serves the purpose of measuring time, counting the total
+number of tests, and verifying if each test suite reported the correct number
+of test results.
+
+Note: rteval requires root privileges to run. All tests, with the exception of
+a part of the unit tests, thus require root.
+
+- Pre-defined rteval commands for manual testing
+
+These are accessible under the Makefile targets: "runit", "load", and
+"sysreport".
+
+"runit" tests both measurements and loads, "load" tests only loads, and
+"sysreport" runs both measurements and loads while also generating a SOS report
+at the end of the rteval run.
+
+- Legacy unit tests
+
+Legacy unit tests are embedded directly in rteval source code. The test engine
+to run them is located in tests/unittest-legacy.py, and may be run with
+the following sequence of commands (starting in the root directory):
+
+$ cd rteval/
+$ sudo python3 ../tests/unittest-legacy.py
+...
+ --------------------
+  ** TEST SUMMARY **
+ --------------------
+
+  - Modules:
+      Declared for test:      4
+      Successfully imported:  4
+      Failed import:          0
+
+  - Tests:
+      Tests scheduled:        4
+      Sucessfully tests:      4
+      Failed tests:           0
+      Missing unit_test()     0
+
+Note that some of the tests require root and will fail if run under normal
+user.
Signature · 1 line
2.51.1
#2 lore raw

Re: [PATCH 2/2] rteval: Add README-tests

Quoted 121 lines · Tomas Glozar

Add a README-tests file describing what tests are implemented for rteval and how to run them.

---
 README-tests | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 README-tests
README-tests new file +102 -0
new file mode 100644
index 0000000..802d4eb
@@ -0,0 +1,102 @@
+There currently exist four kinds of tests for rteval:
+
+- Unit tests
+
+Unit tests reside in the tests/ directory. They are Python modules which import
+the Python unittest library.
+
+The Makefile target "unittest" (or, alternatively, just "test") invokes unit
+tests:
+
+$ make test
+Running unit tests...
+./run_tests.sh
+=========================================
+Running rteval Unit Tests
+=========================================
+
+Running: test_measurement_module_selection
+---
+test_argparse_rejects_invalid_module (__main__.TestMeasurementModuleSelection)
+Test that argparse rejects invalid module names ... usage: test_measurement_module_selection.py [--measurement-module {cyclictest,timerlat}]
+test_measurement_module_selection.py: error: argument --measurement-module: invalid choice: 'invalid' (choose from 'cyclictest', 'timerlat')
+ok
+...
+
+----------------------------------------------------------------------
+Ran 6 tests in 0.003s
+
+OK
+✓ PASSED: test_measurement_module_selection
+
+=========================================
+Test Summary
+=========================================
+Total tests run: 1
+Passed: 1
+Failed: 0
+
+✓ All tests passed!
+
+- End-to-end tests
+
+End-to-end tests reside in the tests/e2e subdirectory, in files with
+the .t extension. They are written in bash and produce output compatible with
+the TEP standard.
+
+To run end-to-end tests, the rteval kcompile source tarball has to be present;
+see LOADS variable in Makefile for the tarballs used by the current version of
+rteval.
+
+The Makefile target "check" invokes the end-to-end tests under Test::Harness
+via the "prove" command:
+
+$ sudo make e2e-tests
+PYTHON="python3" RTEVAL="/usr/src/rteval/rteval-cmd" RTEVAL_PKG="/usr/src/rteval" prove -o -f -v tests/e2e/
+...
+All tests successful.
+Files=3, Tests=33, 288 wallclock secs ( 0.02 usr  0.00 sys + 127.59 cusr 155.27 csys = 282.88 CPU)
+Result: PASS
+
+Test::Harness here serves the purpose of measuring time, counting the total
+number of tests, and verifying if each test suite reported the correct number
+of test results.
+
+Note: rteval requires root privileges to run. All tests, with the exception of
+a part of the unit tests, thus require root.
+
+- Pre-defined rteval commands for manual testing
+
+These are accessible under the Makefile targets: "runit", "load", and
+"sysreport".
+
+"runit" tests both measurements and loads, "load" tests only loads, and
+"sysreport" runs both measurements and loads while also generating a SOS report
+at the end of the rteval run.
+
+- Legacy unit tests
+
+Legacy unit tests are embedded directly in rteval source code. The test engine
+to run them is located in tests/unittest-legacy.py, and may be run with
+the following sequence of commands (starting in the root directory):
+
+$ cd rteval/
+$ sudo python3 ../tests/unittest-legacy.py
+...
+ --------------------
+  ** TEST SUMMARY **
+ --------------------
+
+  - Modules:
+      Declared for test:      4
+      Successfully imported:  4
+      Failed import:          0
+
+  - Tests:
+      Tests scheduled:        4
+      Sucessfully tests:      4
+      Failed tests:           0
+      Missing unit_test()     0
+
+Note that some of the tests require root and will fail if run under normal
+user.
Signature · 1 line
2.51.1
#3 lore raw
In reply to Tomas Glozar
Quoted 24 lines · Tomas Glozar

We now have a tests/ folder. Move unittest.py there, rename it to unittest-legacy.py to prevent conflict with Python's unittest module, and remove the now empty directory unit-tests/.

---
This is a follow-up to [1], in place of patch 2 and 3. Patch 1 got applied, patches 2 and 3 required changes following the merging of [2].

[1] https://lore.kernel.org/linux-rt-users/[email protected]/T/
[2] https://lore.kernel.org/linux-rt-users/[email protected]/T/

 unit-tests/unittest.py => tests/unittest-legacy.py | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename unit-tests/unittest.py => tests/unittest-legacy.py (100%)
tests/unittest-legacy.py renamed from unit-tests/unittest.py +0 -0
similarity index 100%
rename from unit-tests/unittest.py
rename to tests/unittest-legacy.py
Signature · 1 line
2.51.1