Skip to content

Commit d3a012b

Browse files
author
Lefan Zhang
committed
test script: print representation into txt files, check the program
1 parent 210ce13 commit d3a012b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

regression/abstraction/test.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
#!/bin/bash
22

3+
# whether verify the program or not
4+
CHECK=false
5+
36
# paths to the benchmark repos
47
AWS_C_COMMON_PATH="/home/ubuntu/aws-c-common"
58
AWS_IOT_SDK_PATH="/home/ubuntu/aws-iot-device-sdk-embedded-C-tuttle"
69

710
# executables
811
MAKE="make"
912
GOTO_INSTRUMENT="goto-instrument"
13+
CBMC="cbmc"
14+
CBMC_FLAGS="--unwind 10
15+
--bounds-check
16+
--pointer-check
17+
--unwinding-assertions
18+
--nondet-static
19+
--div-by-zero-check
20+
--float-overflow-check
21+
--nan-check
22+
--pointer-overflow-check
23+
--undefined-shift-check
24+
--signed-overflow-check
25+
--unsigned-overflow-check
26+
--trace"
1027

1128
AWS_C_COMMON_TESTS=(
1229
"aws_array_eq"
@@ -32,6 +49,15 @@ for test in ${AWS_C_COMMON_TESTS[@]}; do
3249
$GOTO_INSTRUMENT --use-abstraction $cwd/$test.json \
3350
$AWS_C_COMMON_PATH/.cbmc-batch/jobs/$test/${test}_harness.goto \
3451
$AWS_C_COMMON_PATH/.cbmc-batch/jobs/$test/${test}_harness_abst.goto
52+
# print the goto-programs into txts
53+
rm $AWS_C_COMMON_PATH/.cbmc-batch/jobs/$test/${test}_harness_abst.txt
54+
$GOTO_INSTRUMENT --print-internal-representation \
55+
$AWS_C_COMMON_PATH/.cbmc-batch/jobs/$test/${test}_harness_abst.goto \
56+
>> $AWS_C_COMMON_PATH/.cbmc-batch/jobs/$test/${test}_harness_abst.txt
57+
# check the program
58+
if [ $CHECK = true ]; then
59+
$CBMC $CBMC_FLAGS $AWS_C_COMMON_PATH/.cbmc-batch/jobs/$test/${test}_harness_abst.goto
60+
fi
3561
done
3662

3763
echo "===== $AWS_IOT_SDK_TEST ====="
@@ -43,3 +69,12 @@ cd $cwd
4369
$GOTO_INSTRUMENT --use-abstraction $cwd/$AWS_IOT_SDK_TEST.json \
4470
$AWS_IOT_SDK_PATH/cbmc/proofs/JsonParser/proofs/String.goto \
4571
$AWS_IOT_SDK_PATH/cbmc/proofs/JsonParser/proofs/String_abst.goto
72+
# print the goto-programs into txts
73+
rm $AWS_IOT_SDK_PATH/cbmc/proofs/JsonParser/proofs/String_abst.txt
74+
$GOTO_INSTRUMENT --print-internal-representation \
75+
$AWS_IOT_SDK_PATH/cbmc/proofs/JsonParser/proofs/String_abst.goto \
76+
>> $AWS_IOT_SDK_PATH/cbmc/proofs/JsonParser/proofs/String_abst.txt
77+
# check the program
78+
if [ $CHECK = true ]; then
79+
$CBMC $CBMC_FLAGS $AWS_IOT_SDK_PATH/cbmc/proofs/JsonParser/proofs/String_abst.goto
80+
fi

0 commit comments

Comments
 (0)