| 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 -ex |
| 17 | |
| 18 | usage() { |
| 19 | echo "run_sidetrail.sh install_dir s2n_dir" |
| 20 | exit 1 |
| 21 | } |
| 22 | |
| 23 | runSingleTest() { |
| 24 | cd "${BASE_S2N_DIR}/tests/sidetrail/working/${1}" |
| 25 | ./copy_as_needed.sh |
| 26 | make clean |
| 27 | make 2>&1 | tee out.txt |
| 28 | |
| 29 | ../../count_success.pl 1 0 out.txt |
| 30 | } |
| 31 | |
| 32 | runNegativeTest() { |
| 33 | cd "${BASE_S2N_DIR}/tests/sidetrail/working/${1}" |
| 34 | ./copy_as_needed.sh |
| 35 | make clean |
| 36 | make 2>&1 | tee out.txt |
| 37 | |
| 38 | ../../count_success.pl 0 1 out.txt |
| 39 | } |
| 40 | |
| 41 | if [[ "$#" -ne "2" ]]; then |
| 42 | usage |
| 43 | fi |
| 44 | |
| 45 | INSTALL_DIR=$1 |
| 46 | SMACK_DIR="${1}/smack" |
| 47 | BASE_S2N_DIR=$2 |
| 48 | |
| 49 | #Put the dependencies on the path |
| 50 | |
| 51 | # Disabling ShellCheck using https://github.com/koalaman/shellcheck/wiki/Directive |
| 52 | # Turn of Warning in one line as https://github.com/koalaman/shellcheck/wiki/SC1090 |
| 53 | # shellcheck disable=SC1090 |
| 54 | source "${INSTALL_DIR}/smack.environment" |
| 55 | export PATH="${SMACK_DIR}/bin:${SMACK_DIR}/build:${PATH}" |
| 56 | #Test that they are really there |
| 57 | which smack || echo "can't find smack" |
| 58 | which boogie || echo "can't find z3" |
| 59 | which llvm2bpl || echo "can't find llvm2bpl" |
| 60 | which clang |
| 61 | clang --version |
| 62 | echo $BOOGIE |
| 63 | echo $CORRAL |
| 64 | |
| 65 | runNegativeTest "s2n-record-read-cbc-negative-test" |
| 66 | runSingleTest "s2n-cbc" # Takes 6m 30s |
| 67 | runSingleTest "s2n-record-read-aead" |
| 68 | runSingleTest "s2n-record-read-cbc" |
| 69 | runSingleTest "s2n-record-read-composite" |
| 70 | runSingleTest "s2n-record-read-stream" |
| 71 |