]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Simplify test scripts.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 13 Oct 2025 19:34:36 +0000 (21:34 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 13 Oct 2025 19:34:36 +0000 (21:34 +0200)
tools/nettle-pbkdf2-test
tools/sexp-conv-test

index 6e9b25aca153bf5cca3c5393af6fd6d5dfa7e4a5..b963b6f1e205f6070e228ec9922abb3ba5b42b0f 100755 (executable)
@@ -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"
index c1cb7b3d7b9c2e71e663e4031e29b79183613f84..32664b794c4c144f1231fe82b0eea159b5a1c33f 100755 (executable)
@@ -14,82 +14,47 @@ print_nl () {
 
 test_advanced () {
     print_raw "$1" test.in
-    if $EMULATOR ./sexp-conv$EXEEXT -s advanced <test.in | tr -d '\r' >test1.out ; then
-       true
-    else
-       exit 1
-    fi
+    $EMULATOR ./sexp-conv$EXEEXT -s advanced <test.in | tr -d '\r' >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 <test.in | tr -d '\r' >test1.out ; then
-       true
-    else
-       exit 1
-    fi
+    $EMULATOR ./sexp-conv$EXEEXT -s hex <test.in | tr -d '\r' >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 <test.in | tr -d '\r' >test1.out ; then
-       true
-    else
-       exit 1
-    fi
+    $EMULATOR ./sexp-conv$EXEEXT -s transport <test.in | tr -d '\r' >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 <test.in >test1.out ; then
-       true
-    else
-       exit 1
-    fi
+    $EMULATOR ./sexp-conv$EXEEXT -s canonical <test.in >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 <test.in >test1.out ; then
-       true
-    else
-       exit 1
-    fi
+    $EMULATOR ./sexp-conv$EXEEXT --hash=sha256 <test.in >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:' '""'