Debian Codegraph @

crt/s2n/codebuild/bin/run_ctverif.sh

raw symbols SCIP
1 #!/bin/bash
2 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License").
5 # You may not use this file except in compliance with the License.
6 # A copy of the License is located at
7 #
8 # http://aws.amazon.com/apache2.0
9 #
10 # or in the "license" file accompanying this file. This file is distributed
11 # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 # express or implied. See the License for the specific language governing
13 # permissions and limitations under the License.
14 #
15
16 set -e
17
18 usage() {
19 echo "run_ctverif.sh install_dir"
20 exit 1
21 }
22
23 if [ "$#" -ne "1" ]; then
24 usage
25 fi
26
27 INSTALL_DIR=$1
28 export CTVERIF_DIR="${1}/verifying-constant-time"
29 SMACK_DIR="${1}/smack"
30
31 #Put the dependencies are on the path
32
33 # Disabling ShellCheck using https://github.com/koalaman/shellcheck/wiki/Directive
34 # Turn of Warning in one line as https://github.com/koalaman/shellcheck/wiki/SC1090
35 # shellcheck disable=SC1090
36 source "${INSTALL_DIR}/smack.environment"
37 export PATH="${SMACK_DIR}/bin:${SMACK_DIR}/build:${PATH}"
38 #Test that they are really there
39 which smack || echo "can't find smack"
40 which boogie || echo "can't find z3"
41 which llvm2bpl || echo "can't find llvm2bpl"
42
43 #copy the current version of the file to the test
44 cd "${BASE_S2N_DIR}/tests/ctverif"
45 cp "${BASE_S2N_DIR}/utils/s2n_safety.c" .
46 make clean
47
48 #run the test. We expect both to pass, and none to fail
49 FAILED=0
50 EXPECTED_PASS=2
51 EXPECTED_FAIL=0
52 make 2>&1 | ./count_success.pl $EXPECTED_PASS $EXPECTED_FAIL || FAILED=1
53
54 if [ $FAILED == 1 ];
55 then
56 printf "\\033[31;1mFAILED ctverif\\033[0m\\n"
57 exit -1
58 else
59 printf "\\033[32;1mPASSED ctverif\\033[0m\\n"
60 fi