-
Notifications
You must be signed in to change notification settings - Fork 675
Expand file tree
/
Copy pathtestcompile.sh
More file actions
executable file
·119 lines (92 loc) · 2.72 KB
/
Copy pathtestcompile.sh
File metadata and controls
executable file
·119 lines (92 loc) · 2.72 KB
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
#!/bin/sh
# This file is part of Firejail project
# Copyright (C) 2014-2026 Firejail Authors
# License GPL v2
# A simple script testing all compile-time config options.
# shellcheck source=config.sh
output=/tmp/testcompile-output.tmp
result=/tmp/testcompile-result.tmp
total_errors=0
testconfigure() {
msg="$1"
shift
printf '%s...' "$msg" >> "$result"
make distclean
(
set -x
./configure "$@" || cat config.log
) 2>&1 | tee -a "$output"
errors="$(grep -E -c '(WARNING|ERROR)' "$output")"
printf '%s\n' "$errors"
if test "$errors" -gt "$total_errors"; then
total_errors="$errors"
printf 'TESTING ERROR - %s\n' "$msg"
echo " FAIL configure" >> "$result"
fi
}
testmake() {
msg="$1"
shift
(
set -x
make -j "$(nproc)" "$@"
) 2>&1 | tee -a "$output"
errors="$(grep -E -c -i 'error:' "$output")"
printf '%s\n' "$errors"
if test "$errors" -gt "$total_errors"; then
total_errors="$errors"
printf 'TESTING ERROR - %s\n' "$msg"
echo " FAIL make" >> "$result"
else
echo " OK" >> "$result"
fi
}
: > "$output"
: > "$result"
msg='default'
testconfigure "$msg" --enable-fatal-warnings &&
testmake "$msg"
msg='disable dbus proxy configuration'
testconfigure "$msg" --enable-fatal-warnings --disable-dbusproxy &&
testmake "$msg"
msg='enable chroot configuration'
testconfigure "$msg" --enable-fatal-warnings --enable-chroot &&
testmake "$msg"
msg='disable user namespace configuration'
testconfigure "$msg" --enable-fatal-warnings --disable-userns &&
testmake "$msg"
msg='disable network namespace configuration'
testconfigure "$msg" --enable-fatal-warnings --disable-network &&
testmake "$msg"
msg='disable X11 support'
testconfigure "$msg" --enable-fatal-warnings --disable-x11 &&
testmake "$msg"
msg='enable selinux'
testconfigure "$msg" --enable-fatal-warnings --enable-selinux &&
testmake "$msg"
msg='disable file transfer'
testconfigure "$msg" --enable-fatal-warnings --disable-file-transfer &&
testmake "$msg"
msg='enable apparmor'
testconfigure "$msg" --enable-fatal-warnings --enable-apparmor &&
testmake "$msg"
msg='disable landlock'
testconfigure "$msg" --enable-fatal-warnings --disable-landlock &&
testmake "$msg"
msg='disable output logging'
testconfigure "$msg" --enable-fatal-warnings --disable-output &&
testmake "$msg"
msg='disable private-lib'
testconfigure "$msg" --enable-fatal-warnings --disable-private-lib &&
testmake "$msg"
msg='enable-only-syscfg-profiles'
testconfigure "$msg" --enable-fatal-warnings --enable-only-syscfg-profiles &&
testmake "$msg"
msg='enable force nonewprivs'
testconfigure "$msg" --enable-fatal-warnings --enable-force-nonewprivs &&
testmake "$msg"
echo "cleanup" >> "$result"
make distclean
echo "*******************************************"
echo "All fine!!!" >> "$result"
cat "$result"