This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test-unixbench
executable file
·117 lines (97 loc) · 4 KB
/
test-unixbench
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
#!/bin/bash
set -e
resultsdir="$(pwd)/results"
unixbenchrepo=https://github.com/kdlucas/byte-unixbench.git
localdir=unixbench
if [ ! -d "$localdir" ]
then
echo -e "Cloning unixbench..."
git clone --depth 1 "$unixbenchrepo" "$localdir"
else
echo -e "Unixbench has already been cloned. Continuing..."
fi
cd "$localdir"/UnixBench
JOBS=$(nproc||echo 1)
# reset Makefile and patch CFLAGS to append project-specific flags
git checkout Makefile
sed 's/^CFLAGS =/CFLAGS +=/g' -i Makefile
if [ -z "$1" ] || [ "1" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong and partial relro"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro' \
CFLAGS='-fstack-protector-strong -D_FORTIFY_SOURCE=2' \
make -j${JOBS}
echo -e "Compilation finished, running test 1"
bash -c './Run' &> "$resultsdir"/unixbench-test1-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 1 completed."
fi
if [ -z "$1" ] || [ "2" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, partial relro, and -fstack-check"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fstack-check' \
make -j${JOBS}
echo -e "Compilation finished, running test 2"
bash -c './Run' &> "$resultsdir"/unixbench-test2-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 2 completed."
fi
if [ -z "$1" ] || [ "3" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, partial relro, and PIE"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro -pie' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE' \
make -j${JOBS}
echo -e "Compilation finished, running test 3"
bash -c './Run' &> "$resultsdir"/unixbench-test3-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 3 completed."
fi
if [ -z "$1" ] || [ "4" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, partial relro, PIE, and -fstack-check"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro -pie' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fstack-check -fPIE' \
make -j${JOBS}
echo -e "Compilation finished, running test 4"
bash -c './Run' &> "$resultsdir"/unixbench-test4-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 4 completed."
fi
if [ -z "$1" ] || [ "5" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -pie' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE' \
make -j${JOBS}
echo -e "Compilation finished, running test 5"
bash -c './Run' &> "$resultsdir"/unixbench-test5-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 5 completed."
fi
if [ -z "$1" ] || [ "6" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE, -fstack-check"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -pie' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -fstack-check' \
make -j${JOBS}
echo -e "Compilation finished, running test 6"
bash -c './Run' &> "$resultsdir"/unixbench-test6-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 6 completed."
fi
if [ -z "$1" ] || [ "7" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE, -fno-plt"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -pie' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -fno-plt' \
make -j${JOBS}
echo -e "Compilation finished, running test 7"
bash -c './Run' &> "$resultsdir"/unixbench-test7-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 7 completed."
fi
if [ -z "$1" ] || [ "8" == "$1" ]; then
echo -e "Compiling with -fstack-protector-strong, full relro, PIE, -fno-plt, and -fstack-check"
make clean
LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -pie' \
CFLAGS='-pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -fno-plt -fstack-check' \
make -j${JOBS}
echo -e "Compilation finished, running test 8"
bash -c './Run' &> "$resultsdir"/unixbench-test8-`date +%Y-%m-%d.%H:%M:%S`
echo -e "Test 8 completed."
fi