]> Nishi Git Mirror - gwion.git/commitdiff
:art: Update scripts 122/head
authorfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 6 Jun 2019 17:13:19 +0000 (19:13 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 6 Jun 2019 17:13:19 +0000 (19:13 +0200)
help/afl.sh [new file with mode: 0644]
help/struct_check.sh
help/test.sh

diff --git a/help/afl.sh b/help/afl.sh
new file mode 100644 (file)
index 0000000..02d4363
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+: "${AFL_PREFIX:=afl-}"
+: "${AFL_CC:=afl-gcc}"
+: "${RESULT_DIR:=${AFL_PREFIX}result}"
+
+clean_lib() {
+  echo "🛀 cleaning $1"
+  cd "$1" && make clean all && cd ..
+}
+
+compile() {
+  export CC="$AFL_CC"
+  clean_lib util
+  clean_lib ast
+  clean_lib "$PWD"
+}
+
+prepare() {
+  CRASH_DIR=${AFL_PREFIX}crash
+  if [ -d "$CRASH_DIR" ]
+  then echo "✋ $CRASH_DIR already contains at risk data"
+  else mkdir "$CRASH_DIR"
+  fi
+  for file in "$RESULT_DIR"/*/crashes/id*
+  do
+    NEW_NAME="$(basename "$file" | sed 's/id:0*\([0-9]*\),.*/\1.gw/')"
+    cp "$file" "$NEW_NAME"
+  done
+}
+
+#compile
+prepare
index 6e906358a80dd83b6d905389c3d5cf78384507a6..34fa0af365c2e357a82575aa6e9b0629c47722b3 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 : "${PRG:=./gwion}"
 
-pahole -s ${PRG} | while read name size gap
-do [ $size -gt 64 ] && echo $name $size
-   [ $gap -gt 0 ] && echo "$name has a gap"
+pahole -s ${PRG} | while read -r name size gap
+do [ "$size" -gt 64 ] && echo "$name $size"
+   [ "$gap" -gt 0 ] && echo "$name has a gap"
 done
index cb5825880448155ca65a4c6df2c5d9390e7d9c30..6ae46d1acfb36c989a5709b973a0ea293d50aa6e 100644 (file)
@@ -465,7 +465,7 @@ clean() {
 [ -f test.log ] && rm test.log
 [ $# -ne 0 ] && do_test "${@}" | consummer
 
-if [ -f test.log ] && [ -z $NO_LOG ]
+if [ -f test.log ] && [ -z "$NO_LOG" ]
 then
   cat test.log
   exit 1