blob: 2f631668f3820eb7487892fec89680f9a1b2eda5 [file] [log] [blame]
Fabio Utzig0e12f6c2018-10-12 09:52:29 -07001#!/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
15pushd sim
16
17EXIT_CODE=0
18
19if [[ ! -z $SINGLE_FEATURES ]]; then
Fabio Utzig79df58e2019-01-12 14:58:28 -020020 all_features="sig-rsa sig-ecdsa overwrite-only validate-slot0 enc-rsa enc-kw boostrap"
Fabio Utzig0e12f6c2018-10-12 09:52:29 -070021
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
35fi
36
37if [[ ! -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
45fi
46
47popd
48exit $EXIT_CODE