diff mbox

[RISU,v3,08/10] new: generate_all.sh script

Message ID 20161209114830.9158-9-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée Dec. 9, 2016, 11:48 a.m. UTC
A simple script to cut up a full .risu file and generate binaries for
the whole set. Call with risu file and instruction count and directory:

  ./generate_all.sh aarch64.risu 4 20000 testcases.aarch64

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 generate_all.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100755 generate_all.sh

-- 
2.11.0
diff mbox

Patch

diff --git a/generate_all.sh b/generate_all.sh
new file mode 100755
index 0000000..4c490be
--- /dev/null
+++ b/generate_all.sh
@@ -0,0 +1,55 @@ 
+#!/bin/sh
+#
+# Generate All Patterns
+#
+# Work through a given .risu file and generate full coverage
+#
+
+BASE_SHELL_PARAMS="./risugen"
+
+risufile=$1
+divisor=$2
+insns=$3
+dir=$4
+
+if test -z "$risufile"; then
+    echo "Need to specify a risu defintiion file"
+    exit 1
+fi
+
+if test -z "$divisor"; then
+    divisor=4
+fi
+
+if test -n "$insns"; then
+    BASE_SHELL_PARAMS="${BASE_SHELL_PARAMS} --numinsns $insns"
+fi
+
+if test -n "dir"; then
+    mkdir -p $dir
+else
+    dir="./"
+fi
+
+ALL_INSNS=$(cat $risufile | ag "^\w" | cut -f 1 -d " " | sort)
+COUNT=$(cat $risufile | ag "^\w" | cut -f 1 -d " " | wc -l)
+set -- $ALL_INSNS
+
+GROUP=$((COUNT / $divisor))
+
+while test $# -gt 0 ; do
+    INSN_PATTERNS=""
+    I_FILE="$dir/insn_"
+    for i in `seq 1 $divisor`; do
+        I=$1
+        if test -n "${I}"; then
+            shift
+            INSN_PATTERNS="${INSN_PATTERNS} --pattern ${I}"
+            I_FILE="${I_FILE}${I}_"
+        fi
+    done
+    I_FILE="${I_FILE}_INC.risu.bin"
+    CMD="$BASE_SHELL_PARAMS ${INSN_PATTERNS} $risufile ${I_FILE}"
+    echo "Running: $CMD"
+    $CMD
+done