Skip to contentSkip to conversation

rteval: Introduce E2E tests with output checking

PATCH Superseded Tomas Glozar 3 participants 8 messages Jul 25, 2025 – Nov 4, 2025 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.
- End-to-end tests, implemented in Makefile targets runit, load, and sysreport.

Introduce a new test suite in folder e2e-tests/ (analogically to unit-tests) that uses Test::Harness ("prove" command) together with a simple test engine adopted from RTLA.

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. Replaces "make runit".
- "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.

"make runit" and "make load" targets are depracated with a warning; "make sysreport" is kept until sysreport tests are added to the new test suite.

---
 Makefile                |   5 ++
 e2e-tests/basic.t       |  26 +++++++++++
 e2e-tests/engine.sh     |  81 ++++++++++++++++++++++++++++++++
 e2e-tests/loads.t       |  72 ++++++++++++++++++++++++++++
 e2e-tests/measurement.t | 101 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 285 insertions(+)
 create mode 100644 e2e-tests/basic.t
 create mode 100644 e2e-tests/engine.sh
 create mode 100644 e2e-tests/loads.t
 create mode 100644 e2e-tests/measurement.t
Makefile +5 -0
index a250b18..dbb2aef 100644
@@ -18,11 +18,16 @@ KLOAD	:=	$(LOADDIR)/linux-6.12-rc4.tar.gz
 BLOAD	:=	$(LOADDIR)/dbench-4.0.tar.gz
 LOADS	:=	$(KLOAD) $(BLOAD)
 
+check: rteval-cmd
+	PYTHON="$(PYTHON)" RTEVAL="$(HERE)/rteval-cmd" RTEVAL_PKG="$(HERE)" prove -o -f e2e-tests/
+
 runit:
+	$(warning "'make runit' is depracated, please use 'make check'")
 	[ -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)
 
 load:
+	$(warning "'make load' is depracated, please use 'make check'")
 	[ -d ./run ] || mkdir run
 	$(PYTHON) rteval-cmd --onlyload -D -L -v --workdir=./run --loaddir=$(HERE)/loadsource -f $(HERE)/rteval/rteval.conf -i $(HERE)/rteval
 
e2e-tests/basic.t new file +26 -0
new file mode 100644
index 0000000..c7b7b17
@@ -0,0 +1,26 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+source e2e-tests/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
e2e-tests/engine.sh new file +81 -0

81 lines not on this page · raw message

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

72 lines not on this page · raw message

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

101 lines not on this page · raw message

Signature · 1 line
2.49.0
#1 lore raw
Quoted 22 lines · Tomas Glozar

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

Introduce a new test suite in folder e2e-tests/ (analogically to unit-tests) that uses Test::Harness ("prove" command) together with a simple test engine adopted from RTLA.

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. Replaces "make runit".
- "loads", testing various kinds of loads, including their options.
- "measurement", testing both cyclictest and timerlat.

Quoted 8 lines

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.

"make runit" and "make load" targets are depracated with a warning; "make sysreport" is kept until sysreport tests are added to the new test suite.

Interesting.
Note the correct spelling is "deprecated"

I'm not sure we want to deprecate runit and loads, they have different purposes. I often run in a non-rt environment and without tuned if I'm just testing functionality and not performance, and I got this after running make check (skipping some of the output before that)

# Output match failed: "Command: rtla timerlat hist -p1100 -P f:95 -u -c[0-9|-]+ -E3500 --no-summary -T1 -t=trace.txt" e2e-tests/measurement.t .. Failed 6/19 subtests

Test Summary Report
-------------------
e2e-tests/loads.t (Wstat: 0 Tests: 8 Failed: 1)
Failed test: 5
e2e-tests/measurement.t (Wstat: 0 Tests: 19 Failed: 6)
Failed tests: 13-14, 16-19
Files=3, Tests=33, 308 wallclock secs ( 0.06 usr 0.00 sys + 146.20 cusr 281.79 csys = 428.05 CPU)
Result: FAIL
make: *** [Makefile:22: check] Error 1

How do I identify which test is test number 5?
Am I failing tests because of performance reasons or because the tests expect an environment different from mine?

Thanks

John Kacur

#5 lore raw
In reply to Tomas Glozar
Quoted 9 lines · Tomas Glozar

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

Introduce a new test suite in folder e2e-tests/ (analogically to unit-tests) that uses Test::Harness ("prove" command) together with a simple test engine adopted from RTLA.

If we're going to use this, please mention the dependency in the README along with how to install it. Don't assume familiarity with the Perl ecosystem.

Can we just put all the tests in tests/ rather than making this distinction? And have the unit tests be something that can be run just like any other test?

e2e-tests/engine.sh line 57

Quoted 11 lines
e2e-tests/engine.sh new file +11 -0
+		if [ $exitcode -eq $expected_exitcode ] && [ $grep_result -eq 0 ]
+		then
+			echo "ok $ctr - $1"
+		else
+			echo "not ok $ctr - $1"
+			# Add rtla output and exit code as comments in case of failure
+			echo "$result" | col -b | while read line; do echo "# $line"; done
+			printf "#\n# exit code %s\n" $exitcode
+			[ -n "$expected_output" ] && [ $grep_result -ne 0 ] && \
+				printf "# Output match failed: \"%s\"\n" "$expected_output"
+		fi

Any reason to not take the updated version of the engine from the rtla consolidation patchset?

It would also be nice if there were a way to just run specific tests by number, rather than a whole .t file.

-Crystal

#2 lore raw
In reply to John Kacur
Quoted 11 lines · John Kacur

Test Summary Report
-------------------
e2e-tests/loads.t (Wstat: 0 Tests: 8 Failed: 1)
Failed test: 5
e2e-tests/measurement.t (Wstat: 0 Tests: 19 Failed: 6)
Failed tests: 13-14, 16-19
Files=3, Tests=33, 308 wallclock secs ( 0.06 usr 0.00 sys + 146.20 cusr 281.79 csys = 428.05 CPU)
Result: FAIL
make: *** [Makefile:22: check] Error 1

Quoted 3 lines

How do I identify which test is test number 5?
Am I failing tests because of performance reasons or because the tests expect an environment different from mine?

Passing -v to prove does this; not sure why we aren't using it in make check.

-Crystal

#6 lore raw
In reply to Crystal Wood

čt 18. 9. 2025 v 21:22 odesílatel Crystal Wood <[email protected]> napsal:

Quoted 5 lines

Can we just put all the tests in tests/ rather than making this distinction? And have the unit tests be something that can be run just like any other test?

I agree that the organization is not the best. This patch only deals with end-to-end tests, though. As long as there is a top-level unit-tests/ directory, adding another one named tests/ would be confusing.

Quoted 12 lines

e2e-tests/engine.sh line 57

Quoted 11 lines
e2e-tests/engine.sh new file +11 -0
+             if [ $exitcode -eq $expected_exitcode ] && [ $grep_result -eq 0 ]
+             then
+                     echo "ok $ctr - $1"
+             else
+                     echo "not ok $ctr - $1"
+                     # Add rtla output and exit code as comments in case of failure
+                     echo "$result" | col -b | while read line; do echo "# $line"; done
+                     printf "#\n# exit code %s\n" $exitcode
+                     [ -n "$expected_output" ] && [ $grep_result -ne 0 ] && \
+                             printf "# Output match failed: \"%s\"\n" "$expected_output"
+             fi
Quoted 3 lines

Any reason to not take the updated version of the engine from the rtla consolidation patchset?

This patch was sent quite some time ago, I think it was before the updated version of the engine.

Quoted 3 lines

It would also be nice if there were a way to just run specific tests by number, rather than a whole .t file.

Yes, that can be implemented.

Tomas

#3 lore raw
In reply to John Kacur

čt 18. 9. 2025 v 19:56 odesílatel John Kacur <[email protected]> napsal:

Quoted 4 lines

Interesting.
Note the correct spelling is "deprecated"

Oops. Thanks for noticing that.

Quoted 21 lines

I'm not sure we want to deprecate runit and loads, they have different purposes. I often run in a non-rt environment and without tuned if I'm just testing functionality and not performance, and I got this after running make check (skipping some of the output before that)

# Output match failed: "Command: rtla timerlat hist -p1100 -P f:95 -u -c[0-9|-]+ -E3500 --no-summary -T1 -t=trace.txt" e2e-tests/measurement.t .. Failed 6/19 subtests

Test Summary Report
-------------------
e2e-tests/loads.t (Wstat: 0 Tests: 8 Failed: 1)
Failed test: 5
e2e-tests/measurement.t (Wstat: 0 Tests: 19 Failed: 6)
Failed tests: 13-14, 16-19
Files=3, Tests=33, 308 wallclock secs ( 0.06 usr 0.00 sys + 146.20 cusr 281.79 csys = 428.05 CPU)
Result: FAIL
make: *** [Makefile:22: check] Error 1

Quoted 4 lines

How do I identify which test is test number 5?
Am I failing tests because of performance reasons or because the tests expect an environment different from mine?

The tests should work in any environment, I have to fix that.

Thanks for testing the patch.

Tomas

#7 lore raw
In reply to Tomas Glozar
Quoted 11 lines · Tomas Glozar

čt 18. 9. 2025 v 21:22 odesílatel Crystal Wood <[email protected]> napsal:

Quoted 5 lines

Can we just put all the tests in tests/ rather than making this distinction? And have the unit tests be something that can be run just like any other test?

I agree that the organization is not the best. This patch only deals with end-to-end tests, though. As long as there is a top-level unit-tests/ directory, adding another one named tests/ would be confusing.

I was suggesting putting *all* tests in a single tests/ directory, including the unit tests. So, there wouldn't be a unit-tests/ directory.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
e2e-tests/engine.sh new file +11 -0
+             if [ $exitcode -eq $expected_exitcode ] && [ $grep_result -eq 0 ]
+             then
+                     echo "ok $ctr - $1"
+             else
+                     echo "not ok $ctr - $1"
+                     # Add rtla output and exit code as comments in case of failure
+                     echo "$result" | col -b | while read line; do echo "# $line"; done
+                     printf "#\n# exit code %s\n" $exitcode
+                     [ -n "$expected_output" ] && [ $grep_result -ne 0 ] && \
+                             printf "# Output match failed: \"%s\"\n" "$expected_output"
+             fi
Quoted 6 lines
Quoted 3 lines

Any reason to not take the updated version of the engine from the rtla consolidation patchset?

This patch was sent quite some time ago, I think it was before the updated version of the engine.

Ah, I thought it was a new patch, not a reply to an older patch.

-Crystal

#4 lore raw
In reply to John Kacur

čt 18. 9. 2025 v 19:56 odesílatel John Kacur <[email protected]> napsal:

Quoted 17 lines

I got this after running make check (skipping some of the output before that)

# Output match failed: "Command: rtla timerlat hist -p1100 -P f:95 -u -c[0-9|-]+ -E3500 --no-summary -T1 -t=trace.txt" e2e-tests/measurement.t .. Failed 6/19 subtests

Test Summary Report
-------------------
e2e-tests/loads.t (Wstat: 0 Tests: 8 Failed: 1)
Failed test: 5
e2e-tests/measurement.t (Wstat: 0 Tests: 19 Failed: 6)
Failed tests: 13-14, 16-19
Files=3, Tests=33, 308 wallclock secs ( 0.06 usr 0.00 sys + 146.20 cusr 281.79 csys = 428.05 CPU)
Result: FAIL
make: *** [Makefile:22: check] Error 1

Quoted 4 lines

How do I identify which test is test number 5?
Am I failing tests because of performance reasons or because the tests expect an environment different from mine?

It is failing because it is expecting the timerlat interval of 1100us, see the "Output match failed" part. The interval changed in the meanwhile to 100us, the patch simply needs updating.

I'm working on a v2 fixing this and incorporating feedback. It will also enable verbose messages, so that all test names are printed, just like [1] does for RTLA.

[1] https://lore.kernel.org/linux-trace-kernel/[email protected]/

Tomas