-
Notifications
You must be signed in to change notification settings - Fork 276
/
Copy pathprereleasetests.sh
executable file
·135 lines (106 loc) · 3.37 KB
/
prereleasetests.sh
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
set -e
MAINDIR=$( git rev-parse --show-toplevel)
echo $MAINDIR
echo "cleaning main directory"
rm -r -f $MAINDIR/CMakeFiles
rm -f $MAINDIR/CMakeCache.txt
# the directory of the script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# the temp directory used, within $DIR
WORK_DIR=`mktemp -d `
RED='\033[0;31m'
BLUE='\034[0;31m'
NC='\033[0m'
# deletes the temp directory
function cleanup {
rm -rf "$WORK_DIR"
echo "Deleted temp working directory $WORK_DIR"
}
function err_report() {
echo -e "${RED}You have some error.${NC}"
}
trap err_report ERR
# register the cleanup function to be called on the EXIT signal
trap cleanup exit
cd $WORK_DIR
bash $MAINDIR/amalgamation.sh
PROCESSOR=$(uname -m)
if [ "$PROCESSOR" == "x86_64" ]; then
echo "You have an x86-64 processor. Your clang/gcc compiler ought to be able to target this generic architecture."
for flag in "-DROARING_DISABLE_X64" "-mno-sse3" "-mno-ssse3" "-mno-sse4.1" "-mno-sse4.2" "-mno-avx" "-mno-avx2" ; do
echo $flag
echo "Can build in debug mode (C)"
cc $flag -ggdb -std=c11 -o amalgamation_demo amalgamation_demo.c && ./amalgamation_demo && rm ./amalgamation_demo
echo "Can build in debug mode (C++)"
c++ $flag -ggdb -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo && rm ./amalgamation_demo
echo "Can build in release mode (C)"
cc $flag -O2 -std=c11 -o amalgamation_demo amalgamation_demo.c && ./amalgamation_demo && rm ./amalgamation_demo
echo "Can build in release mode (C++)"
c++ $flag -O2 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo && rm ./amalgamation_demo
done
fi
echo "testing amalgamate (debug/native)"
cc -march=native -ggdb -std=c11 -o amalgamation_demo amalgamation_demo.c && ./amalgamation_demo && rm ./amalgamation_demo
c++ -march=native -ggdb -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo && rm ./amalgamation_demo
echo "testing amalgamate (release/native)"
cc -march=native -O3 -std=c11 -o amalgamation_demo amalgamation_demo.c && ./amalgamation_demo
c++ -march=native -O3 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo
echo "working in " $PWD
echo "testing debug (static)"
cd $WORK_DIR
mkdir debugstatic
cd debugstatic
cmake -DCMAKE_BUILD_TYPE=Debug -DROARING_BUILD_STATIC=ON $MAINDIR
make
make test
echo "testing debug no x64 (static)"
cd $WORK_DIR
mkdir debugnox64static
cd debugnox64static
cmake -DROARING_DISABLE_X64=ON -DROARING_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Debug $MAINDIR
make
make test
echo "testing release"
cd $WORK_DIR
mkdir releasestatic
cd releasestatic
cmake -DROARING_BUILD_STATIC=ON $MAINDIR
make
make test
echo "testing release no x64 (static)"
cd $WORK_DIR
mkdir releasenox64static
cd releasenox64static
cmake -DROARING_DISABLE_X64=ON -DROARING_BUILD_STATIC=ON $MAINDIR
make
make test
echo "testing debug"
cd $WORK_DIR
mkdir debug
cd debug
cmake -DCMAKE_BUILD_TYPE=Debug $MAINDIR
make
make test
echo "testing debug no x64"
cd $WORK_DIR
mkdir debugnox64
cd debugnox64
cmake -DROARING_DISABLE_X64=ON -DCMAKE_BUILD_TYPE=Debug $MAINDIR
make
make test
echo "testing release"
cd $WORK_DIR
mkdir release
cd release
cmake $MAINDIR
make
make test
echo "testing release no x64"
cd $WORK_DIR
mkdir releasenox64
cd releasenox64
cmake -DROARING_DISABLE_X64=ON $MAINDIR
make
make test
echo -e "${BLUE}Code looks good.${NC}"