about summary refs log tree commit diff
path: root/fix.m4
diff options
context:
space:
mode:
Diffstat (limited to 'fix.m4')
-rw-r--r--fix.m440
1 files changed, 32 insertions, 8 deletions
diff --git a/fix.m4 b/fix.m4
index d896a5c..356db4a 100644
--- a/fix.m4
+++ b/fix.m4
@@ -111,16 +111,40 @@ rm -fr "$wd/input"
 mkdir -p "$wd/input/benign"
 cp -r "$poc" "$wd/input/malicious"
 find "$wd/fuzzolic" -name 'test_case_*.dat' -print0 |
-  xargs -I '{}' -0 -P$(nproc) -n1 \
-  taosc-sort-inputs $timeout "$wd"/input/{malicious,benign} '{}' \
+  xargs -P$(nproc) -0 -n1 -I @@ \
+  taosc-sort-inputs $timeout "$wd"/input/{malicious,benign} @@ \
   "$bin.covered" $args
 
 rm -fr "$wd/values"
-mkdir -p "$wd"/values/{benign,malicious}
-find "$wd/input" -print0 |
-  xargs -I '{}' -0 -P$(nproc) -n1 \
-  taosc-collect-values $timeout $stack_size "$wd/values" '{}' \
+mkdir -p "$wd"/values/{benign,bottom,malicious,top}
+find "$wd/input" -type f -print0 |
+  xargs -I @@ -0 -P$(nproc) -n1 \
+  taosc-collect-values $timeout $stack_size "$wd/values" @@ \
   "$bin.collect" $args
-# TODO: split if the patch location is reached multiple times with an input
-taosc-synth $stack_size "$wd"/values/{benign,malicious} > "$wd/predicates"
+find "$wd/values" -type f -print0 | xargs -P$(nproc) -0 -n1 -I @@ mkdir @@.d
+find "$wd/values" -maxdepth 2 -type f -print0 |
+  xargs -P$(nproc) -0 -n1 -I @@ \
+  split -b $((stack_size + 16*8)) @@{,.d/}
+find "$wd/values/benign" -mindepth 1 -type d -name '*.d' |
+  while read d
+  do
+    find "$d" -type f -printf '%f\0' |
+      xargs -P$(nproc) -0 -n1 -I @@ \
+      mv "$d/@@" "$wd/values/bottom/$(basename "$d" .d).@@"
+  done
+find "$wd/values/malicious" -mindepth 1 -type d -name '*.d' |
+  while read d
+  do
+    find "$d" -type f -printf '%f\0' |
+      sort -z |
+      head -n -1 -z | # all but last
+      xargs -P$(nproc) -0 -n1 -I @@ \
+      mv "$d/@@" "$wd/values/bottom/$(basename "$d" .d).@@"
+    find "$d" -type f -printf '%f\0' |
+      sort -z |
+      tail -n 1 -z | # last
+      xargs -0 -n1 -I @@ \
+      mv "$d/@@" "$wd/values/top/$(basename "$d" .d).@@"
+  done
+taosc-synth $stack_size "$wd"/values/{bottom,top} > "$wd/predicates"
 # vim: filetype=sh.m4