From: Niels Möller Date: Mon, 13 Oct 2025 19:34:36 +0000 (+0200) Subject: Simplify test scripts. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b2566e32979502cd142fbf53e9eea518209193d;p=thirdparty%2Fnettle.git Simplify test scripts. --- diff --git a/tools/nettle-pbkdf2-test b/tools/nettle-pbkdf2-test index 6e9b25ac..b963b6f1 100755 --- a/tools/nettle-pbkdf2-test +++ b/tools/nettle-pbkdf2-test @@ -19,11 +19,7 @@ test_pbkdf2 () { -i "$iters" -l "$length" "$salt" | tr -d '\r' > test1.out echo "$expected" | tr -d '\r' > test2.out - if cmp test1.out test2.out ; then - true - else - exit 1; - fi + cmp test1.out test2.out || exit 1 } test_pbkdf2 passwd salt 1 "55ac046e56e3089f ec1691c22544b605" diff --git a/tools/sexp-conv-test b/tools/sexp-conv-test index c1cb7b3d..32664b79 100755 --- a/tools/sexp-conv-test +++ b/tools/sexp-conv-test @@ -14,82 +14,47 @@ print_nl () { test_advanced () { print_raw "$1" test.in - if $EMULATOR ./sexp-conv$EXEEXT -s advanced test1.out ; then - true - else - exit 1 - fi + $EMULATOR ./sexp-conv$EXEEXT -s advanced test1.out || exit 1 + print_nl "$2" test2.out - if cmp test1.out test2.out ; then - true - else - exit 1; - fi + cmp test1.out test2.out || exit 1; } test_advanced_hex () { print_raw "$1" test.in - if $EMULATOR ./sexp-conv$EXEEXT -s hex test1.out ; then - true - else - exit 1 - fi + $EMULATOR ./sexp-conv$EXEEXT -s hex test1.out || exit 1 + print_nl "$2" test2.out - if cmp test1.out test2.out ; then - true - else - exit 1; - fi + cmp test1.out test2.out || exit 1; } test_transport () { print_raw "$1" test.in - if $EMULATOR ./sexp-conv$EXEEXT -s transport test1.out ; then - true - else - exit 1 - fi + $EMULATOR ./sexp-conv$EXEEXT -s transport test1.out || exit 1 + print_nl "$2" test2.out - if cmp test1.out test2.out ; then - true - else - exit 1; - fi + cmp test1.out test2.out || exit 1; } test_canonical () { print_raw "$1" test.in - if $EMULATOR ./sexp-conv$EXEEXT -s canonical test1.out ; then - true - else - exit 1 - fi + $EMULATOR ./sexp-conv$EXEEXT -s canonical test1.out || exit 1 + print_raw "$2" test2.out - if cmp test1.out test2.out ; then - true - else - exit 1; - fi + cmp test1.out test2.out || exit 1; } test_hash () { print_raw "$1" test.in - if $EMULATOR ./sexp-conv$EXEEXT --hash=sha256 test1.out ; then - true - else - exit 1 - fi + $EMULATOR ./sexp-conv$EXEEXT --hash=sha256 test1.out || exit 1 + print_nl "$2" test2.out - if cmp test1.out test2.out ; then - true - else - exit 1; - fi + cmp test1.out test2.out || exit 1 } test_advanced '0:' '""'