]> git.codecow.com Git - Monocypher.git/commitdiff
Facilitated the test suite
authorLoup Vaillant <loup@loup-vaillant.fr>
Wed, 14 Feb 2018 22:43:12 +0000 (23:43 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Wed, 14 Feb 2018 22:43:12 +0000 (23:43 +0100)
README.md
tests/coverage.sh
tests/test.sh [new file with mode: 0755]

index 789f1a495136a81a75a4191725ea796fd21c25f6..e728dfed592b8b4148e7e53d3a88ef90ce54e590 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@ Monocypher
 ----------
 
 Monocypher is an easy to use, easy to deploy, auditable crypto library
-written in portable C.  It approches the size of [TweetNaCl][] and the
+written in portable C.  It approaches the size of [TweetNaCl][] and the
 speed of [Libsodium][].
 
 [Official site.](https://monocypher.org/)  
@@ -69,28 +69,10 @@ somewhere.
 
 *Do not* use Monocypher without running those tests at least once.
 
+The same test suite can be run under clang sanitisers and valgrind, and
+be checked for code coverage:
 
-### More serious testing
-
-You can run the test suite under clang sanitizers or valgrind:
-
-    $ make clean
-    $ make test CC="clang -std=c99" CFLAGS="-fsanitize=address"
-
-    $ make clean
-    $ make test CC="clang -std=c99" CFLAGS="-fsanitize=memory"
-
-    $ make clean
-    $ make test CC="clang -std=c99" CFLAGS="-fsanitize=undefined"
-
-    $ make clean
-    $ make test.out
-    $ valgrind ./test.out
-
-You can also check code coverage:
-
-    $ make clean
-    $ make test CC="clang -std=c99" CFLAGS="-fprofile-instr-generate -fcoverage-mapping"
+    $ tests/test.sh
     $ tests/coverage.sh
 
 
@@ -135,6 +117,13 @@ There are similar benchmarks for Libsodium and TweetNaCl:
     $ make speed-sodium
     $ make speed-tweetnacl
 
+You can also adjust the optimisation options for Monocypher and
+TweetNaCl (the default is `-O3 march=native`):
+
+    $ make speed           CFLAGS="-O2"
+    $ make speed-tweetnacl CFLAGS="-O2"
+
+
 Customisation
 -------------
 
index 9bf5bc9e2845287843a008b57876e1a13f72e266..a34709ed496a849fd5cd411fc892e92c9e9a9316 100755 (executable)
@@ -1,4 +1,8 @@
 #! /bin/sh
 
+set -e
+
+make clean
+make test CC="clang -std=c99" CFLAGS="-fprofile-instr-generate -fcoverage-mapping"
 llvm-profdata-3.8 merge default.profraw -o all.profdata
 llvm-cov-3.8 show -instr-profile=all.profdata "./test.out"
diff --git a/tests/test.sh b/tests/test.sh
new file mode 100755 (executable)
index 0000000..df655bc
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+set -e
+
+make clean;  make test
+make clean;  make test CC="clang -std=c99" CFLAGS="-g -fsanitize=address"
+make clean;  make test CC="clang -std=c99" CFLAGS="-g -fsanitize=memory"
+make clean;  make test CC="clang -std=c99" CFLAGS="-g -fsanitize=undefined"
+make clean;  make test.out;  valgrind ./test.out
+
+echo "All sanitisers passed!"