Debian Codegraph @

src/vendor/azure-uamqp-c/jenkins/linux_c_option_test.sh

raw
1 #!/bin/bash
2 #set -o pipefail
3 #
4 # Copyright (c) Microsoft. All rights reserved.
5 # Licensed under the MIT license. See LICENSE file in the project root for full license information.
6
7 set -e
8
9 cat /etc/*release | grep VERSION*
10 gcc --version
11 openssl version
12
13 script_dir=$(cd "$(dirname "$0")" && pwd)
14 build_root=$(cd "${script_dir}/.." && pwd)
15 build_folder=$build_root"/cmake/mqtt_option"
16
17 # Set the default cores
18 MAKE_CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
19
20 echo "Initial MAKE_CORES=$MAKE_CORES"
21
22 # Make sure there is enough virtual memory on the device to handle more than one job
23 MINVSPACE="1500000"
24
25 # Acquire total memory and total swap space setting them to zero in the event the command fails
26 MEMAR=( $(sed -n -e 's/^MemTotal:[^0-9]*\([0-9][0-9]*\).*/\1/p' -e 's/^SwapTotal:[^0-9]*\([0-9][0-9]*\).*/\1/p' /proc/meminfo) )
27 [ -z "${MEMAR[0]##*[!0-9]*}" ] && MEMAR[0]=0
28 [ -z "${MEMAR[1]##*[!0-9]*}" ] && MEMAR[1]=0
29
30 let VSPACE=${MEMAR[0]}+${MEMAR[1]}
31
32 if [ "$VSPACE" -lt "$MINVSPACE" ] ; then
33 echo "WARNING: Not enough space. Setting MAKE_CORES=1"
34 MAKE_CORES=1
35 fi
36
37 declare -a arr=(
38 "-Dskip_samples=ON"
39 "-Dno_logging=ON"
40 "-Denable_raw_logging=ON"
41 "-Denable_raw_logging=ON -Dno_logging=ON"
42 )
43
44 for item in "${arr[@]}"
45 do
46 rm -r -f $build_folder
47 mkdir -p $build_folder
48 pushd $build_folder
49
50 echo "executing cmake/make with options <<$item>>"
51 cmake $build_root "$item"
52
53 make --jobs=$MAKE_CORES
54 done
55 popd