[PATCH v1 1/2] libubox: fix test_base64.t for bash
Peter Seiderer
ps.report at gmx.net
Sat Mar 6 10:54:49 GMT 2021
On my system 'make test' fails like the following:
$ make test
Running tests...
Test project .../build_libubox
Start 1: cram
1/2 Test #1: cram .............................***Failed 38.05 sec
Start 2: shunit2
2/2 Test #2: shunit2 .......................... Passed 0.21 sec
50% tests passed, 1 tests failed out of 2
Total Test time (real) = 38.27 sec
The following tests FAILED:
1 - cram (Failed)
Errors while running CTest
make: *** [Makefile:105: test] Error 8
$ cat Testing/Temporary/LastTest.log
Start testing: Mar 06 11:36 CET
----------------------------------------------------------
1/2 Testing: cram
1/2 Test: cram
Command: ".../tests/cram/.venv/bin/cram" ".../tests/cram/test_avl.t" ".../tests/cram/test_base64.t" ".../tests/cram/test_blob_parse.t" ".../tests/cram/test_blobmsg.t" ".../tests/cram/test_blobmsg_check_array.t" ".../tests/cram/test_blobmsg_parse.t" ".../tests/cram/test_blobmsg_procd_instance.t" ".../tests/cram/test_jshn.t" ".../tests/cram/test_json_script.t" ".../tests/cram/test_list.t" ".../tests/cram/test_runqueue.t"
Directory: .../tests/cram
"cram" start time: Mar 06 11:36 CET
Output:
----------------------------------------------------------
.!
--- .../tests/cram/test_base64.t
+++ .../tests/cram/test_base64.t.err
@@ -41,13 +41,17 @@
$ alias check="grep Assertion output.log | sed 's;.*\(b64_.*code\).*\(Assertion.*$\);\1: \2;' | LC_ALL=C sort"
$ test-b64_decode > output.log 2>&1; check
+ /bin/sh: line 10: 2441 Aborted (core dumped) test-b64_decode > output.log 2>&1
b64_decode: Assertion `dest && targsize > 0' failed.
$ test-b64_encode > output.log 2>&1; check
+ /bin/sh: line 12: 2456 Aborted (core dumped) test-b64_encode > output.log 2>&1
b64_encode: Assertion `dest && targsize > 0' failed.
$ test-b64_decode-san > output.log 2>&1; check
+ /bin/sh: line 14: 2473 Aborted (core dumped) test-b64_decode-san > output.log 2>&1
b64_decode: Assertion `dest && targsize > 0' failed.
$ test-b64_encode-san > output.log 2>&1; check
+ /bin/sh: line 16: 2487 Aborted (core dumped) test-b64_encode-san > output.log 2>&1
b64_encode: Assertion `dest && targsize > 0' failed.
.........
# Ran 11 tests, 0 skipped, 1 failed.
<end of output>
Test time = 38.22 sec
----------------------------------------------------------
Test Failed.
"cram" end time: Mar 06 11:37 CET
"cram" time elapsed: 00:00:38
----------------------------------------------------------
[...]
My shell/bash seems to emit a more detailed failure message than
expected. Fix this by complete avoiding the failure message using
command substitution instead of direct command execution.
Signed-off-by: Peter Seiderer <ps.report at gmx.net>
---
tests/cram/test_base64.t | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/cram/test_base64.t b/tests/cram/test_base64.t
index b028ac8..33fb454 100644
--- a/tests/cram/test_base64.t
+++ b/tests/cram/test_base64.t
@@ -40,14 +40,14 @@ check that b64_encode and b64_decode assert invalid input
$ alias check="grep Assertion output.log | sed 's;.*\(b64_.*code\).*\(Assertion.*$\);\1: \2;' | LC_ALL=C sort"
- $ test-b64_decode > output.log 2>&1; check
+ $ $(test-b64_decode > output.log 2>&1); check
b64_decode: Assertion `dest && targsize > 0' failed.
- $ test-b64_encode > output.log 2>&1; check
+ $ $(test-b64_encode > output.log 2>&1); check
b64_encode: Assertion `dest && targsize > 0' failed.
- $ test-b64_decode-san > output.log 2>&1; check
+ $ $(test-b64_decode-san > output.log 2>&1); check
b64_decode: Assertion `dest && targsize > 0' failed.
- $ test-b64_encode-san > output.log 2>&1; check
+ $ $(test-b64_encode-san > output.log 2>&1); check
b64_encode: Assertion `dest && targsize > 0' failed.
--
2.30.1
More information about the openwrt-devel
mailing list