aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure.sh2
-rwxr-xr-xtest/test.sh14
-rwxr-xr-xtools/run_tool.sh6
-rwxr-xr-xutils/genmovecode.sh2
-rwxr-xr-xutils/genmoveswitch.sh2
-rwxr-xr-xutils/gentranscode.sh2
-rwxr-xr-xutils/gentransswitch.sh4
-rwxr-xr-xutils/gentranstests.sh8
8 files changed, 20 insertions, 20 deletions
diff --git a/configure.sh b/configure.sh
index 03873e5..06688e8 100755
--- a/configure.sh
+++ b/configure.sh
@@ -5,7 +5,7 @@ greparch() {
5} 5}
6 6
7grepsan() { 7grepsan() {
8 $CC -fsanitize=$1 -dM -E -x c - </dev/null 2>/dev/null | grep "SANITIZE" 8 $CC -fsanitize="$1" -dM -E -x c - </dev/null 2>/dev/null | grep "SANITIZE"
9} 9}
10 10
11detectthreads() { 11detectthreads() {
diff --git a/test/test.sh b/test/test.sh
index ce120eb..14b4ca3 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -8,19 +8,19 @@ TESTERR="test/last.err"
8CUBEOBJ="debugcube.o" 8CUBEOBJ="debugcube.o"
9 9
10for t in test/*; do 10for t in test/*; do
11 if [ -n "$re" ] && [ -z "$(echo "$t" | grep "$re")" ]; then 11 if [ -n "$re" ] && !(echo "$t" | grep -q "$re"); then
12 continue 12 continue
13 fi 13 fi
14 14
15 # Verify if $t is a directory and if its name starts with three digits 15 # Verify if $t is a directory and if its name starts with three digits
16 if [ -d "$t" ] && echo "$(basename "$t")" | grep -Eq '^[0-9]{3}'; then 16 if [ -d "$t" ] && basename "$t" | grep -Eq '^[0-9]{3}'; then
17 $CC -o $TESTBIN $t/*.c $CUBEOBJ || exit 1 17 $CC -o $TESTBIN "$t"/*.c $CUBEOBJ || exit 1
18 for cin in $t/*.in; do 18 for cin in "$t"/*.in; do
19 c=$(echo "$cin" | sed 's/\.in//') 19 c=$(echo "$cin" | sed 's/\.in//')
20 cout=$c.out 20 cout="$c.out"
21 printf "$c: " 21 printf "%s: " "$c"
22 $TESTBIN < "$cin" > $TESTOUT 2> $TESTERR 22 $TESTBIN < "$cin" > $TESTOUT 2> $TESTERR
23 if diff $cout $TESTOUT; then 23 if diff "$cout" "$TESTOUT"; then
24 printf "OK\n" 24 printf "OK\n"
25 else 25 else
26 printf "Test failed! stderr:\n" 26 printf "Test failed! stderr:\n"
diff --git a/tools/run_tool.sh b/tools/run_tool.sh
index cec7630..7e09684 100755
--- a/tools/run_tool.sh
+++ b/tools/run_tool.sh
@@ -11,14 +11,14 @@ BIN="tools/run"
11d="$(date +'%Y-%m-%d-%H-%M-%S')" 11d="$(date +'%Y-%m-%d-%H-%M-%S')"
12 12
13for t in tools/*; do 13for t in tools/*; do
14 if [ ! -d "$t" ] || [ -z "$(echo "$t" | grep "$TOOL")" ]; then 14 if [ ! -d "$t" ] || ! (echo "$t" | grep -q "$TOOL"); then
15 continue 15 continue
16 fi 16 fi
17 toolname="$(basename "$t" .c)" 17 toolname="$(basename "$t" .c)"
18 $CC -o $BIN $t/*.c $CUBEOBJ || exit 1; 18 $CC -o $BIN "$t"/*.c "$CUBEOBJ" || exit 1;
19 $BIN | tee "tools/results/$toolname-$d.txt" "tools/results/last.out" 19 $BIN | tee "tools/results/$toolname-$d.txt" "tools/results/last.out"
20 break 20 break
21done 21done
22 22
23# $BIN is kept so it can be run manually for profiling 23# $BIN is kept so it can be run manually for profiling
24rm -rf $CUBEOBJ 24rm -rf "$CUBEOBJ"
diff --git a/utils/genmovecode.sh b/utils/genmovecode.sh
index ddde0f7..cf13441 100755
--- a/utils/genmovecode.sh
+++ b/utils/genmovecode.sh
@@ -4,7 +4,7 @@ cc -DDEBUG h48_to_lst.c ../src/nissy.c -o h48_to_lst
4 4
5gen() { 5gen() {
6 for f in cubes/move_??_*.txt; do 6 for f in cubes/move_??_*.txt; do
7 move="$(echo $f | sed 's/.*_// ; s/\.txt//')" 7 move="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
8 printf '#define _move_cube_%s fastcube( \\\n ' "$move" 8 printf '#define _move_cube_%s fastcube( \\\n ' "$move"
9 ./h48_to_lst <"$f" 9 ./h48_to_lst <"$f"
10 printf ')\n' 10 printf ')\n'
diff --git a/utils/genmoveswitch.sh b/utils/genmoveswitch.sh
index 4fe057c..3b2a74b 100755
--- a/utils/genmoveswitch.sh
+++ b/utils/genmoveswitch.sh
@@ -2,7 +2,7 @@
2 2
3printf '\tswitch (m) {\n' 3printf '\tswitch (m) {\n'
4for f in cubes/move_??_*.txt; do 4for f in cubes/move_??_*.txt; do
5 t="$(echo $f | sed 's/.*_// ; s/\.txt//')" 5 t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
6 printf '\tcase %s:\n\t\treturn _move(%s, c);\n' "$t" "$t" 6 printf '\tcase %s:\n\t\treturn _move(%s, c);\n' "$t" "$t"
7done 7done
8printf '\t}\n' 8printf '\t}\n'
diff --git a/utils/gentranscode.sh b/utils/gentranscode.sh
index e3e199e..9a1de2c 100755
--- a/utils/gentranscode.sh
+++ b/utils/gentranscode.sh
@@ -10,7 +10,7 @@ sedsrc() { sed '3s/$/ };/ ; 3q'; }
10 10
11gen() { 11gen() {
12 for f in cubes/transform_??_???.txt; do 12 for f in cubes/transform_??_???.txt; do
13 trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" 13 trans="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
14 printf '#define _trans_cube_%s fastcube( \\\n ' "$trans" 14 printf '#define _trans_cube_%s fastcube( \\\n ' "$trans"
15 ./h48_to_lst <"$f" 15 ./h48_to_lst <"$f"
16 printf ')\n' 16 printf ')\n'
diff --git a/utils/gentransswitch.sh b/utils/gentransswitch.sh
index 447c9be..20e2bfb 100755
--- a/utils/gentransswitch.sh
+++ b/utils/gentransswitch.sh
@@ -2,8 +2,8 @@
2 2
3printf '\tswitch (t) {\n' 3printf '\tswitch (t) {\n'
4for f in cubes/transform_??_???.txt; do 4for f in cubes/transform_??_???.txt; do
5 t="$(echo $f | sed 's/.*_// ; s/\.txt//')" 5 t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
6 mirror_or_rotation="$(echo $t | grep m)" 6 mirror_or_rotation="$(echo "$t" | grep m)"
7 if [ -z "$mirror_or_rotation" ]; then 7 if [ -z "$mirror_or_rotation" ]; then
8 m="rotation" 8 m="rotation"
9 else 9 else
diff --git a/utils/gentranstests.sh b/utils/gentranstests.sh
index 62ebbda..a257a0a 100755
--- a/utils/gentranstests.sh
+++ b/utils/gentranstests.sh
@@ -8,9 +8,9 @@ i=100
8while read -r line; do 8while read -r line; do
9 [ -z "$line" ] && continue 9 [ -z "$line" ] && continue
10 10
11 trans_piece="$(echo $line | awk '{print $1}' | tr -d 'rm')" 11 trans_piece="$(echo "$line" | awk '{print $1}' | tr -d 'rm')"
12 move1="$(echo $line | awk '{print $2}')" 12 move1="$(echo "$line" | awk '{print $2}')"
13 move2="$(echo $line | awk '{print $3}')" 13 move2="$(echo "$line" | awk '{print $3}')"
14 14
15 rotation="rotation $trans_piece" 15 rotation="rotation $trans_piece"
16 16
@@ -23,7 +23,7 @@ while read -r line; do
23 i=$((i+1)) 23 i=$((i+1))
24 24
25 mirrored="mirrored $trans_piece" 25 mirrored="mirrored $trans_piece"
26 move2m="$(echo ${move2} | tr 'LR' 'RL')3" 26 move2m="$(echo "${move2}" | tr 'LR' 'RL')3"
27 27
28 file1="$(ls cubes | grep "move_.*_${move1}.txt")" 28 file1="$(ls cubes | grep "move_.*_${move1}.txt")"
29 file2="$(ls cubes | grep "move_.*_${move2m}.txt")" 29 file2="$(ls cubes | grep "move_.*_${move2m}.txt")"

Generated with cgit - Back to sebastiano.tronto.net