summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-04-17 11:47:51 +0800
committerIru Cai <mytbk920423@gmail.com>2019-04-17 11:47:51 +0800
commit92d9c897f1ad3d08a8c225b1fd57eebfd47087d1 (patch)
treec626b9991a0e65e785c49629829312556c8631de
parentd59e191b59b325e9e3d31b7f9f349853f9652445 (diff)
downloadgem5-92d9c897f1ad3d08a8c225b1fd57eebfd47087d1.tar.xz
add a test script
-rwxr-xr-xtest.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 000000000..a50b3bc86
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+GEM5="./build/X86_MESI_Two_Level/gem5.opt -q configs/example/se.py --cpu-type=DerivO3CPU --ruby --needsTSO=1 --output=stdout.txt"
+SCMS=(
+"--scheme=UnsafeBaseline"
+"--scheme=SpectreSafeInvisibleSpec --useIFT=0"
+"--scheme=SpectreSafeInvisibleSpec --useIFT=1 --trackBranch=0"
+"--scheme=SpectreSafeInvisibleSpec --useIFT=1 --trackBranch=1"
+"--scheme=SpectreSafeFence --useIFT=0"
+"--scheme=SpectreSafeFence --useIFT=1 --trackBranch=0"
+"--scheme=SpectreSafeFence --useIFT=1 --trackBranch=1"
+)
+
+echo "Testing Spectre PoC victim function"
+for scm in "${SCMS[@]}"
+do
+ echo "$scm"
+ $GEM5 $scm -c attack
+ grep hit stdout.txt && echo unsafe || echo safe
+done
+
+echo "Testing victim function v10"
+for scm in "${SCMS[@]}"
+do
+ echo "$scm"
+ $GEM5 $scm -c attack_v10
+ grep '^[123]' stdout.txt && echo unsafe || echo safe
+done