Commit graph

21 commits

Author SHA1 Message Date
3fba1c2a89 os.CmdTestOs: Add support for --phases argument
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:27 +01:00
174286e3cc TestPhases: Add phases spec alias "All"
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:27 +01:00
b5d849ce44 Add test/audit
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:27 +01:00
8d62ea3939 jw-devtest.py: Code beautification
Just for the heck of it: Make it even shorter.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:27 +01:00
1592ea933c os.Environment: Add method conf_value()
Since all command instances carry config information from
~/.jw-devtestrc, make it available via a dedicated conf_value()
method to all interested test cases.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
ab8b04ad30 os.Connection._read(): Safeguard against non-utf8
Don't try to decode non-UTF-8 garbage as UTF-8 if it shows up in _read().

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
6239c0546a test.expect(): Add support for cmd keyword argument
expect now takes a cmd argument, which defaults to None, and which
runs the command over the given connection before it takes to waiting
for a matching regex to be sent.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
50abdbb3c7 os.CmdTestOs: Beautify test summary
Log a greppable summary of all failed tests in one line at the end of
the output.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
86a6939688 os.TestResults: Beautify dump()
Test results are now output via slog(), and are decorated with a
count of failed and total tests.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
82bb65b6c0 os.CmdTestOs: Add get_ run_ test_cases() and friend
Make the private CmdTestOs.__run_test_cases() method available to
external code interested in running a selection of test cases.

This is useful, e.g. for re-running a failed firmware installation
encapsulated in a test case from inside another test case.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
d747aa78d5 os.TestResutls: Add method addResults()
Add method addResults(), which allows to merge results of another
TestResults instance into the called instance.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
6e04ffdcbe os.be.*.Machine: Rename CPU -> DUT
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
1c674dfa3f Add test.cmds_exec()
test.cmds_exec() takes a list of lists with commands to be sent to a
console, returns None on success and an error message on failure.

The list can consist of up to three entries, 2 + 3 are optional:

  [ cmd, expect-regex, timeout]

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
7d709ecc58 os.misc.cmd_exec(): Fix echo_cmd=False
cmd_exec() sometimes returned the command in the output albeit
echo_cmd=False was specified, notably if the command contained a
newline.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
0f723cfd1b test.cases.ProcMounts: Add ":" to device name regex
Devices may be called ubi0:rescue0 or so.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
5b54b637fd os.conn.Serial: Don't use line_buffering in fdopen()
It's wrong to use line buffering in fdopen(..., ".b"), there's no
such thing as a line in binary data, also see

	https://bugs.python.org/issue32236

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
142c1dbf6d Add support for test-os --cases option
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
765e6f3a1b Add test.cases.LsofUds
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
e0819d7c39 Add test.cases.LsofNet
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
03da0449c4 Add test/list-cmd
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:26 +01:00
4b912741cb First commit
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-17 11:12:21 +01:00