File: s2n_bsd.sh

package info (click to toggle)
aws-crt-python 0.28.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,428 kB
  • sloc: ansic: 437,955; python: 27,657; makefile: 5,855; sh: 4,289; ruby: 208; java: 82; perl: 73; cpp: 25; xml: 11
file content (47 lines) | stat: -rwxr-xr-x 1,492 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
#  http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
set -eu
export CTEST_OUTPUT_ON_FAILURE=1

# FreeBSD and OpenBSD have different ways of getting CPU count
# see https://serverfault.com/questions/203207/how-do-i-count-the-number-of-processors-on-an-openbsd-system
if [ "$(uname)" = 'FreeBSD' ]; then
    export CTEST_PARALLEL_LEVEL=$(sysctl hw.ncpu | awk '{print $2}')
else
    export CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpuonline)
fi

errors=0
onerror() {
  errors=$(($errors+1))
}

mkdir -p output

cmake . -Brelease -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build ./release -j $CTEST_PARALLEL_LEVEL
ninja -C release test || onerror
mv release/Testing/Temporary output/release
# reduce the number of files to copy back
rm -rf release

cmake . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug
cmake --build ./build -j $CTEST_PARALLEL_LEVEL
ninja -C build test || onerror
mv build/Testing/Temporary output/debug
# reduce the number of files to copy back
rm -rf build

exit $errors