Fabio Utzig | 0e12f6c | 2018-10-12 09:52:29 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | pushd sim |
| 16 | |
| 17 | EXIT_CODE=0 |
| 18 | |
| 19 | if [[ ! -z $SINGLE_FEATURES ]]; then |
| 20 | all_features="sig-rsa sig-ecdsa overwrite-only validate-slot0 enc-rsa enc-kw" |
| 21 | |
| 22 | if [[ $SINGLE_FEATURES =~ "none" ]]; then |
| 23 | echo "Running cargo with no features" |
| 24 | cargo test |
| 25 | rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc |
| 26 | fi |
| 27 | |
| 28 | for feature in $all_features; do |
| 29 | if [[ $SINGLE_FEATURES =~ $feature ]]; then |
| 30 | echo "Running cargo for feature=\"${feature}\"" |
| 31 | cargo test --features $feature |
| 32 | rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc |
| 33 | fi |
| 34 | done |
| 35 | fi |
| 36 | |
| 37 | if [[ ! -z $MULTI_FEATURES ]]; then |
| 38 | IFS=',' |
| 39 | read -ra multi_features <<< "$MULTI_FEATURES" |
| 40 | for features in "${multi_features[@]}"; do |
| 41 | echo "Running cargo for features=\"${features}\"" |
| 42 | cargo test --features "$features" |
| 43 | rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc |
| 44 | done |
| 45 | fi |
| 46 | |
| 47 | popd |
| 48 | exit $EXIT_CODE |