Debian Codegraph @

crt/s2n/.github/s2n_bsd.sh

raw symbols SCIP
1 #!/bin/sh
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 set -eu
16 export CTEST_OUTPUT_ON_FAILURE=1
17
18 # FreeBSD and OpenBSD have different ways of getting CPU count
19 # see https://serverfault.com/questions/203207/how-do-i-count-the-number-of-processors-on-an-openbsd-system
20 if [ "$(uname)" = 'FreeBSD' ]; then
21 export CTEST_PARALLEL_LEVEL=$(sysctl hw.ncpu | awk '{print $2}')
22 else
23 export CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpuonline)
24 fi
25
26 errors=0
27 onerror() {
28 errors=$(($errors+1))
29 }
30
31 mkdir -p output
32
33 cmake . -Brelease -GNinja -DCMAKE_BUILD_TYPE=Release
34 cmake --build ./release -j $CTEST_PARALLEL_LEVEL
35 ninja -C release test || onerror
36 mv release/Testing/Temporary output/release
37 # reduce the number of files to copy back
38 rm -rf release
39
40 cmake . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug
41 cmake --build ./build -j $CTEST_PARALLEL_LEVEL
42 ninja -C build test || onerror
43 mv build/Testing/Temporary output/debug
44 # reduce the number of files to copy back
45 rm -rf build
46
47 exit $errors