]> git.codecow.com Git - Monocypher.git/commitdiff
Restored sanitisers based tests.
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 24 Sep 2017 15:16:44 +0000 (17:16 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 24 Sep 2017 15:16:44 +0000 (17:16 +0200)
We no longer ask the user to modify the makefile.  We instead override
the relevant variables from the command line.

README.md
makefile
tests/coverage.sh

index 6a1a5563e7f8c363031d4b04ed91aeb03c7a13c7..7bf5336427f5fc174b3adbad98dbefa983ba00d0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -70,19 +70,28 @@ least once.
 
 ### More serious testing
 
-_TODO: This section is obsolete._
+You can run the test suite under clang sanitizers or valgrind:
 
-The makefile may be modified to activate sanitising.  Just run the
-previous tests under the various sanitisers.  If you compile for
-coverage mapping, the `coverage.sh` mapping can generate a report.
-Just run one of those (make sure the makefile is set up accordingly):
+    $ make clean
+    $ make test CC="clang -std=c99" CFLAGS="-fsanitize=address"
 
-    $ ./coverage.sh test.out
+    $ make clean
+    $ make test CC="clang -std=c99" CFLAGS="-fsanitize=memory"
 
-You can also run the tests under Valgrind:
+    $ 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"
+    $ tests/coverage.sh
+
+
 ### Serious auditing
 
 The code may be analysed more formally with [Frama-c][] and the
index 4b8a0680c06ba795a9c43eb48c7242d73e7610ad..9a65041e69e80042c62771c387c56b9aa9a499a1 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,23 +1,4 @@
-# compile with any of the following
 CC=gcc -std=gnu99 # speed tests don't work with -std=cxx, they need the POSIX extensions
-#CC=gcc -std=c99
-#CC=gcc -std=c11
-#CC=g++ -std=c++98
-#CC=g++ -std=c++11
-#CC=g++ -std=c++14
-#CC=g++ -std=c++17
-#CC=clang -std=c99
-#CC=clang -std=c11
-#CC=clang++ -std=c++98
-#CC=clang++ -std=c++11
-#CC=clang++ -std=c++14
-
-# These may be used for tests (except speed)
-#CC = clang -std=c99 -fsanitize=address
-#CC = clang -std=c99 -fsanitize=memory
-#CC = clang -std=c99 -fsanitize=undefined
-#CC = clang -std=c99 -fprofile-instr-generate -fcoverage-mapping
-
 CFLAGS= -pedantic -Wall -Wextra -O3 -march=native
 DESTDIR=
 PREFIX=usr/local
index 644b700c69891215499d3eefc03abdd452fe7a0b..a802025c556e00fcfc58942c16c3e8d06e345aa9 100755 (executable)
@@ -1,16 +1,4 @@
 #! /bin/sh
-echo
-echo "Run & record coverage"
-echo "====================="
-"./$1"
 
-echo
-echo "Generate report"
-echo "==============="
 llvm-profdata-3.8 merge default.profraw -o all.profdata
-
-
-echo
-echo "Show report"
-echo "==========="
-llvm-cov show "./$1" -instr-profile=all.profdata
+llvm-cov show "./test.out" -instr-profile=all.profdata