-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathquick-test.sh
46 lines (38 loc) · 1.29 KB
/
quick-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
function assert_violation() {
local cmd="$@"
log=$(mktemp)
bash -c "$cmd" > $log
status=$?
output=$(cat $log)
if [[ "$status" -eq 1 && "$output" = *"=== Violations detected ==="* ]]; then
echo "Detection: OK"
else
echo "Detection: FAIL"
echo "Command: $cmd"
echo "Exit code: $status"
echo "Output: '$output'"
exit 1
fi
}
function assert_no_violation() {
local cmd="$@"
log=$(mktemp)
bash -c "$cmd" > $log
status=$?
output=$(cat $log)
if [[ "$status" -eq 0 && "$output" != *"=== Violations detected ==="* ]]; then
echo "Filtering: OK"
else
echo "Filtering: FAIL"
echo "Command: $cmd"
echo "Exit code: $status"
echo "Output: '$output'"
exit 1
fi
}
SCRIPT_DIR=$(dirname $(realpath $0))
cmd="rvzr $cli fuzz -s $SCRIPT_DIR/../base.json --save-violations f -I $SCRIPT_DIR/x86_tests/configs -t $SCRIPT_DIR/x86_tests/asm/spectre_v1.asm -c $SCRIPT_DIR/x86_tests/configs/ct-seq.yaml -i 20"
assert_violation "$cmd"
cmd="rvzr $cli fuzz -s $SCRIPT_DIR/../base.json --save-violations f -I $SCRIPT_DIR/x86_tests/configs -t $SCRIPT_DIR/x86_tests/asm/spectre_v1.asm -c $SCRIPT_DIR/x86_tests/configs/ct-cond.yaml -i 20"
assert_no_violation "$cmd"