Skip to contentSkip to conversation

rteval: Introduce E2E tests with output checking

PATCH NAK Tomas Glozar 2 participants 8 messages Nov 7, 2025 – Nov 11, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 rteval: Introduce E2E tests with output checking

Currently, rteval has two kinds of tests:
- Unit tests, embedded directly in code, and run by unit-tests/unittest.py.
- Manual tests, implemented in Makefile targets runit, load, and sysreport.

Introduce a new test suite in folder tests/e2e that uses Test::Harness ("prove" command) together with a simple test engine adopted from RTLA. The test suite is run using "make e2e-tests".

The test suite runs rteval in a temporary folder for each test case, collects its exit value and output, and validates both according to the test specification. grep is used to check the output, optionally with custom flags. rteval.conf is generated individually based on the test specification of each case.

Three test sets are implemented in the commit:
- "basic", running base checks without any specific modules or module options.
- "loads", testing various kinds of loads, including their options.
- "measurement", testing both cyclictest and timerlat.

The latter two check in rteval output whether the command run by rteval corresponds to the rteval options and to the specified load or measurement, if possible.

A note in README is added about the dependency of end-to-end tests on the Perl Test::Harness package.

---
v2:
- Change default period in timerlat tests to 100us.
- Enable verbose mode for Test::Harness, just like RTLA.
- Put "Output match failed" before the output, to match RTLA test output.
- Makefile target is renamed from "check" to "e2e-tests", keeping "check" reserved for running all tests (in the future).
- Remove deprecation of runit and load. The tests added by this commit do basic command checks, but do not check other properties of the output. "make runit" and "make load" is still useful for that.
- Add tests to README, along with Test::Harness dependency.
- Move unittest.py to the new tests/ subdirectory.

 Makefile                |   3 ++
 README                  |   5 ++
 tests/e2e/basic.t       |  26 +++++++++++
 tests/e2e/engine.sh     |  81 ++++++++++++++++++++++++++++++++
 tests/e2e/loads.t       |  72 ++++++++++++++++++++++++++++
 tests/e2e/measurement.t | 101 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 288 insertions(+)
 create mode 100644 tests/e2e/basic.t
 create mode 100644 tests/e2e/engine.sh
 create mode 100644 tests/e2e/loads.t
 create mode 100644 tests/e2e/measurement.t
Makefile +3 -0
index a250b18..e910b7a 100644
@@ -18,6 +18,9 @@ KLOAD	:=	$(LOADDIR)/linux-6.12-rc4.tar.gz
 BLOAD	:=	$(LOADDIR)/dbench-4.0.tar.gz
 LOADS	:=	$(KLOAD) $(BLOAD)
 
+e2e-tests: rteval-cmd
+	PYTHON="$(PYTHON)" RTEVAL="$(HERE)/rteval-cmd" RTEVAL_PKG="$(HERE)" prove -o -f -v tests/e2e/
+
 runit:
 	[ -d $(HERE)/run ] || mkdir run
 	$(PYTHON) rteval-cmd -D -L -v --workdir=$(HERE)/run --loaddir=$(HERE)/loadsource --duration=$(D) -f $(HERE)/rteval.conf -i $(HERE)/rteval $(EXTRA)
README +5 -0
index 19704b4..cb2700e 100644
@@ -28,6 +28,11 @@ libxml2-python
 rt-tests
     git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
 
+Rteval end-to-end tests additionally require the following packages:
+
+Test::Harness
+    https://metacpan.org/pod/Test::Harness
+
 Clark Williams <[email protected]> wrote rteval
 
 David Sommerseth <[email protected]> wrote the XML-RPC and database
tests/e2e/basic.t new file +26 -0
new file mode 100644
index 0000000..a26f211
@@ -0,0 +1,26 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+source tests/e2e/engine.sh
+test_begin
+
+set_timeout 2m
+
+check "help message" \
+  "--help" 0 "usage: rteval-cmd"
+
+check "help message short" \
+  "-h" 0 "usage: rteval-cmd"
+
+check "debug" \
+  "-D -d 1" 0 '\[DEBUG\]'
+
+check "duration" \
+  "-d 5" 0 "Run duration: 5.0 seconds"
+
+check "verbose" \
+  "-v -d 5" 0 '\[INFO\]'
+
+check "quiet" \
+  "-d 5" 0 '(\[INFO\])|(\[DEBUG\])' "-v"
+
+test_end
tests/e2e/engine.sh new file +81 -0

81 lines not on this page · raw message

tests/e2e/loads.t new file +72 -0

72 lines not on this page · raw message

tests/e2e/measurement.t new file +101 -0

101 lines not on this page · raw message

Signature · 1 line
2.51.0
#1 lore raw

PATCH v2 2/3 rteval: Move unittest.py to tests/

We now have a tests/ folder. Move unittest.py there, and remove folder unit-tests.

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

Re: [PATCH v2 2/3] rteval: Move unittest.py to tests/

Quoted 15 lines · Tomas Glozar

We now have a tests/ folder. Move unittest.py there, and remove folder unit-tests.

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

Nack

This one breaks make test.
this type of unittest is not widely used in rteval and was written before and conflicts with the unittest in the current python library.

In short, I'm thinking of removing the old unittest and might replace it with the built-in version.

#3 lore raw

Re: [PATCH v2 2/3] rteval: Move unittest.py to tests/

po 10. 11. 2025 v 20:11 odesílatel John Kacur <[email protected]> napsal:

Quoted 4 lines

Nack

This one breaks make test.

Well, I sent my patch before you sent yours. But either way, the conflict has to be consolidated somehow.

Quoted 7 lines

this type of unittest is not widely used in rteval and was written before and conflicts with the unittest in the current python library.

In short, I'm thinking of removing the old unittest and might replace it with the built-in version.

Yeah, I believed it was not working for some time, since I got failures, but I ended up discovering it has to be run from the correct directory as root, then it works. So I ended up keeping it.

Tomas

#4 lore raw

PATCH v2 3/3 rteval: Add README-tests

In reply to Tomas Glozar

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

---
 README-tests | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100755 README-tests
README-tests new file +56 -0
new file mode 100755
index 0000000..5745c30
@@ -0,0 +1,56 @@
+There currently exist three kinds of tests for rteval:
+
+- 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.
+
+- Unit tests
+
+Unit tests are embedded directly in rteval source code. The test engine to run
+them is located in tests/unittest.py, and may be run with the following sequence
+of commands (starting in the root directory):
+
+$ cd rteval/
+$ sudo python3 ../tests/unittest.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
+
+- 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.
+
+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.
Signature · 1 line
2.51.0
#6 lore raw

Re: [PATCH v2 3/3] rteval: Add README-tests

po 10. 11. 2025 v 20:13 odesílatel John Kacur <[email protected]> napsal:

Quoted 1 line

Note that the readme doesn't make sense without my previous commit, since it includes instructions to run the unit tests from the new directory. I guess we can resolve that offline, none of the patches have been pushed yet.

Tomas