Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 4 | if ! make >/dev/null; then |
| 5 | echo "Building liblockdep failed." |
| 6 | echo "FAILED!" |
| 7 | exit 1 |
| 8 | fi |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 9 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 10 | find tests -name '*.c' | sort | while read -r i; do |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 11 | testname=$(basename "$i" .c) |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 12 | echo -ne "$testname... " |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 13 | if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP && |
| 14 | timeout 1 "tests/$testname" 2>&1 | /bin/bash "tests/${testname}.sh"; then |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 15 | echo "PASSED!" |
| 16 | else |
| 17 | echo "FAILED!" |
| 18 | fi |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 19 | rm -f "tests/$testname" |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 20 | done |
| 21 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 22 | find tests -name '*.c' | sort | while read -r i; do |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 23 | testname=$(basename "$i" .c) |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 24 | echo -ne "(PRELOAD) $testname... " |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 25 | if gcc -o "tests/$testname" -pthread -Iinclude "$i" && |
| 26 | timeout 1 ./lockdep "tests/$testname" 2>&1 | |
| 27 | /bin/bash "tests/${testname}.sh"; then |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 28 | echo "PASSED!" |
| 29 | else |
| 30 | echo "FAILED!" |
| 31 | fi |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 32 | rm -f "tests/$testname" |
| 33 | done |
| 34 | |
| 35 | find tests -name '*.c' | sort | while read -r i; do |
| 36 | testname=$(basename "$i" .c) |
| 37 | echo -ne "(PRELOAD + Valgrind) $testname... " |
| 38 | if gcc -o "tests/$testname" -pthread -Iinclude "$i" && |
| 39 | { timeout 10 valgrind --read-var-info=yes ./lockdep "./tests/$testname" >& "tests/${testname}.vg.out"; true; } && |
| 40 | /bin/bash "tests/${testname}.sh" < "tests/${testname}.vg.out" && |
| 41 | ! grep -Eq '(^==[0-9]*== (Invalid |Uninitialised ))|Mismatched free|Source and destination overlap| UME ' "tests/${testname}.vg.out"; then |
| 42 | echo "PASSED!" |
| 43 | else |
| 44 | echo "FAILED!" |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 45 | fi |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 46 | rm -f "tests/$testname" |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 47 | done |