From 9730254c415e913ae151be6fdf0336df8d7caf93 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Wed, 30 Nov 2022 23:56:58 -0800 Subject: [PATCH] Add predicate script for `wasm-tools shrink` and similar reduction tools. --- scripts/reduce-predicate.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 scripts/reduce-predicate.sh diff --git a/scripts/reduce-predicate.sh b/scripts/reduce-predicate.sh new file mode 100755 index 0000000..eb69948 --- /dev/null +++ b/scripts/reduce-predicate.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +timeout 1 wasmtime run --disable-cache $1 +if [ $? -ne 0 ]; then + echo bad: initial run crashes too + exit 1 +fi +target/release/waffle-util roundtrip -i $1 -o o.wasm +if [ $? -ne 0 ]; then + echo bad: roundtrip + exit 1 +fi +wasmtime run --disable-cache o.wasm +if [ $? -ne 0 ]; then + echo ok: still crashes + exit 0 +else + echo bad: no longer crashes + exit 1 +fi