qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RISU PATCH 7/9] new: generate_all.sh script


From: Alex Bennée
Subject: [Qemu-devel] [RISU PATCH 7/9] new: generate_all.sh script
Date: Fri, 2 Dec 2016 15:59:33 +0000

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 <address@hidden>
---
 generate_all.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100755 generate_all.sh

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
-- 
2.10.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]