summaryrefslogtreecommitdiff
path: root/test/test.sh
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2024-08-02 15:46:22 +0200
committermzuenni <michi.zuendorf@gmail.com>2024-08-02 15:46:22 +0200
commit011a119ecda46ed50edb9e9ba8002db91e2b5a70 (patch)
treed573d987b13fee363556bd1927d6b19138d1341a /test/test.sh
parent2419f32f0d4b4884dc0fc7567efed7aa711036c3 (diff)
add fuzz script
Diffstat (limited to 'test/test.sh')
-rwxr-xr-xtest/test.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/test.sh b/test/test.sh
index 0ca230b..d34c446 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -6,6 +6,7 @@ export MALLOC_PERTURB_="$((2#01011001))"
declare -A cppstandard
cppstandard["string/suffixArray.cpp"]="gnu++20"
+seedmacro=""
test_file() {
file=$(realpath --relative-to="${PWD}" "${1}")
@@ -15,7 +16,7 @@ test_file() {
if [[ -v cppstandard[$file] ]]; then
std=${cppstandard[$file]}
fi
- g++ -std=$std "$file" -I ../content/ -O2 -Wall -Wextra -Wshadow -Werror
+ g++ -std=$std "$file" -I ../content/ -O2 -Wall -Wextra -Wshadow -Werror $seedmacro
echo "running..."
timeout --foreground 60s ./a.out
echo ""
@@ -48,8 +49,10 @@ list_missing() {
if [ "$#" -ne 0 ]; then
for arg in "$@"
do
- if [[ "$arg" == "--missing" ]]; then
+ if [[ $arg == "--missing" ]]; then
list_missing
+ elif [[ $arg == --seed=* ]]; then
+ seedmacro="-DSEED=${arg:7}ll"
elif [ -d "$arg" ]; then
dir=$(realpath --relative-to="${PWD}" "$arg")
find . -type f -path "./${dir}/*.cpp" -print0 | sort -z | while read -d $'\0' file
@@ -58,6 +61,8 @@ if [ "$#" -ne 0 ]; then
done
elif [ -f "$arg" ]; then
test_file "$arg"
+ else
+ echo "did not recognize: $arg"
fi
done
else