blob: 5b0e4aa495992a8627a41abba4f5d3911f48dfd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#!/bin/bash
set -e
cd "$(dirname "$0")"
ulimit -s 4000000
export MALLOC_PERTURB_="$((2#01011001))"
declare -A cppstandard
cppstandard["string/suffixArray.cpp"]="gnu++20"
seedmacro=""
process_awk() {
awk_file=$(realpath --relative-to="${PWD}" "${1}")
cpp_file=${awk_file%.awk}
folder=$(dirname $awk_file)
#echo "$awk_file"
mkdir -p "./awk/$folder"
awk -f "$awk_file" < "../content/$cpp_file" > "./awk/$cpp_file"
}
test_file() {
file=$(realpath --relative-to="${PWD}" "${1}")
echo "$file:"
echo "compiling..."
std="gnu++17"
if [[ -v cppstandard[$file] ]]; then
std=${cppstandard[$file]}
fi
g++ -std=$std "$file" -I ./awk/ -I ../content/ -O2 -Wall -Wextra -Wshadow -Werror $seedmacro
echo "running..."
timeout --foreground 60s ./a.out
echo ""
rm ./a.out
}
list_missing() {
declare -A ignore
ignore["other/bitOps.cpp"]=1
ignore["other/pragmas.cpp"]=1
ignore["other/stuff.cpp"]=1
ignore["other/timed.cpp"]=1
ignore["tests/gcc5bug.cpp"]=1
ignore["tests/precision.cpp"]=1
ignore["tests/whitespace.cpp"]=1
echo "missing tests:"
find ../content/ -type f -name '*.cpp' -print0 | sort -z | while read -d $'\0' file
do
file=${file#../content/}
if [ ! -f "$file" ] && [[ ! -v ignore["$file"] ]]; then
echo " $file"
fi
done
}
rm -rf ./awk/
find . -type f -path '*.awk' -print0 | sort -z | while read -d $'\0' file
do
process_awk "$file"
done
if [ "$#" -ne 0 ]; then
for arg in "$@"
do
if [[ $arg == "--awk" ]]; then
echo "processed all awk files"
elif [[ $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
do
test_file "$file"
done
elif [ -f "$arg" ]; then
test_file "$arg"
else
echo "did not recognize: $arg"
fi
done
else
find . -type f -path '*.cpp' -print0 | sort -z | while read -d $'\0' file
do
test_file "$file"
done
list_missing
fi
|