Skip to content

Commit 24e0440

Browse files
committed
All of those should be safe
1 parent 12dbb68 commit 24e0440

File tree

1 file changed

+84
-84
lines changed

1 file changed

+84
-84
lines changed

.github/jobs/configure-checks/all.bats

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,49 @@
22

33
load 'assert'
44

5-
#u="domjudge-bats-user"
6-
#distro_id=$(grep "^ID=" /etc/os-release)
7-
#if [ -z ${test_path+x} ]; then
8-
# test_path="/domjudge"
9-
# # Used in the CI
10-
#fi
11-
#
12-
#cmd="apt-get"
13-
#if [ "$distro_id" = "ID=alpine" ]; then
14-
# cmd=apk
15-
#elif [ "$distro_id" = "ID=arch" ]; then
16-
# cmd=pacman
17-
#elif [ "$distro_id" = "ID=fedora" ]; then
18-
# cmd=dnf
19-
#elif [ "$distro_id" = 'ID="opensuse-leap"' ]; then
20-
# cmd=zypper
21-
#fi
22-
#
23-
## Functions to annotate the Github actions logs
24-
#section_start () {
25-
# if [ -n ${GITHUB_REPOSITORY} ]; then
26-
# echo "::group::$1"
27-
# fi
28-
#}
29-
#
30-
#section_end () {
31-
# if [ -n ${GITHUB_REPOSITORY} ]; then
32-
# echo "::endgroup::"
33-
# fi
34-
#}
35-
#
36-
## Helper functions
37-
#setup_user() {
38-
# uadd=useradd
39-
# gadd=groupadd
40-
# if [ "$distro_id" = "ID=alpine" ]; then
41-
# uadd=adduser
42-
# gadd=addgroup
43-
# fi
44-
# id -u $u >/dev/null || (${uadd} $u ; ${gadd} $u || true )>/dev/null
45-
# chown -R $u:$u ./
46-
#}
47-
#
5+
u="domjudge-bats-user"
6+
distro_id=$(grep "^ID=" /etc/os-release)
7+
if [ -z ${test_path+x} ]; then
8+
test_path="/domjudge"
9+
# Used in the CI
10+
fi
11+
12+
cmd="apt-get"
13+
if [ "$distro_id" = "ID=alpine" ]; then
14+
cmd=apk
15+
elif [ "$distro_id" = "ID=arch" ]; then
16+
cmd=pacman
17+
elif [ "$distro_id" = "ID=fedora" ]; then
18+
cmd=dnf
19+
elif [ "$distro_id" = 'ID="opensuse-leap"' ]; then
20+
cmd=zypper
21+
fi
22+
23+
# Functions to annotate the Github actions logs
24+
section_start () {
25+
if [ -n ${GITHUB_REPOSITORY} ]; then
26+
echo "::group::$1"
27+
fi
28+
}
29+
30+
section_end () {
31+
if [ -n ${GITHUB_REPOSITORY} ]; then
32+
echo "::endgroup::"
33+
fi
34+
}
35+
36+
# Helper functions
37+
setup_user() {
38+
uadd=useradd
39+
gadd=groupadd
40+
if [ "$distro_id" = "ID=alpine" ]; then
41+
uadd=adduser
42+
gadd=addgroup
43+
fi
44+
id -u $u >/dev/null || (${uadd} $u ; ${gadd} $u || true )>/dev/null
45+
chown -R $u:$u ./
46+
}
47+
4848
#translate () {
4949
# args="$@"
5050
# if [ "$distro_id" = "ID=arch" ]; then
@@ -107,47 +107,47 @@ load 'assert'
107107
# repo-install gcc g++ libcgroup-dev composer
108108
#}
109109
#
110-
#run_configure () {
111-
# su $u -c "./configure $*"
112-
#}
113-
#
114-
#compiler_assertions () {
115-
# run run_configure
116-
# # Depending on where we run this we might runas wrong user or lack libraries
117-
# # so we can't expect either success or failure.
118-
# #assert_line "checking baseurl... https://example.com/domjudge/"
119-
# assert_line "checking whether configure should try to set CFLAGS... yes"
120-
# assert_line "checking whether configure should try to set CXXFLAGS... yes"
121-
# assert_line "checking whether configure should try to set LDFLAGS... yes"
122-
# assert_line "checking whether the C compiler works... yes"
123-
# assert_line "checking for C compiler default output file name... a.out"
124-
# assert_line "checking for suffix of executables... "
125-
# assert_line "checking whether we are cross compiling... no"
126-
# assert_line "checking for suffix of object files... o"
127-
# assert_regex "checking whether .*GNU C.*\.\.\. yes"
128-
# assert_line "checking whether C compiler accepts -Wall... yes"
129-
# assert_line "checking whether C compiler accepts -fstack-protector... yes"
130-
# assert_line "checking whether C compiler accepts -fPIE... yes"
131-
# assert_line "checking whether C compiler accepts -D_FORTIFY_SOURCE=2... yes"
132-
# assert_line "checking whether the linker accepts -fPIE... yes"
133-
# assert_line "checking whether the linker accepts -pie... yes"
134-
# assert_line "checking whether the linker accepts -Wl,-z,relro... yes"
135-
# assert_line "checking whether the linker accepts -Wl,-z,now... yes"
136-
# assert_line "checking whether $1 accepts -g... yes"
137-
# assert_regex "^checking for $1 option to (enable C11 features|accept ISO C89)\.\.\. none needed$"
138-
# assert_line "checking whether $1 accepts -g... (cached) yes"
139-
# if [ -n "$2" ]; then
140-
# assert_line "checking whether $2 accepts -g... yes"
141-
# assert_line "checking how to run the C preprocessor... $1 -E"
142-
# assert_line "checking how to run the C++ preprocessor... $2 -E"
143-
# fi
144-
#}
145-
#
146-
#compile_assertions_finished () {
147-
# assert_line " * CFLAGS..............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c11"
148-
# assert_line " * CXXFLAGS............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c++11"
149-
# assert_line " * LDFLAGS.............: -fPIE -pie -Wl,-z,relro -Wl,-z,now"
150-
#}
110+
run_configure () {
111+
su $u -c "./configure $*"
112+
}
113+
114+
compiler_assertions () {
115+
run run_configure
116+
# Depending on where we run this we might runas wrong user or lack libraries
117+
# so we can't expect either success or failure.
118+
#assert_line "checking baseurl... https://example.com/domjudge/"
119+
assert_line "checking whether configure should try to set CFLAGS... yes"
120+
assert_line "checking whether configure should try to set CXXFLAGS... yes"
121+
assert_line "checking whether configure should try to set LDFLAGS... yes"
122+
assert_line "checking whether the C compiler works... yes"
123+
assert_line "checking for C compiler default output file name... a.out"
124+
assert_line "checking for suffix of executables... "
125+
assert_line "checking whether we are cross compiling... no"
126+
assert_line "checking for suffix of object files... o"
127+
assert_regex "checking whether .*GNU C.*\.\.\. yes"
128+
assert_line "checking whether C compiler accepts -Wall... yes"
129+
assert_line "checking whether C compiler accepts -fstack-protector... yes"
130+
assert_line "checking whether C compiler accepts -fPIE... yes"
131+
assert_line "checking whether C compiler accepts -D_FORTIFY_SOURCE=2... yes"
132+
assert_line "checking whether the linker accepts -fPIE... yes"
133+
assert_line "checking whether the linker accepts -pie... yes"
134+
assert_line "checking whether the linker accepts -Wl,-z,relro... yes"
135+
assert_line "checking whether the linker accepts -Wl,-z,now... yes"
136+
assert_line "checking whether $1 accepts -g... yes"
137+
assert_regex "^checking for $1 option to (enable C11 features|accept ISO C89)\.\.\. none needed$"
138+
assert_line "checking whether $1 accepts -g... (cached) yes"
139+
if [ -n "$2" ]; then
140+
assert_line "checking whether $2 accepts -g... yes"
141+
assert_line "checking how to run the C preprocessor... $1 -E"
142+
assert_line "checking how to run the C++ preprocessor... $2 -E"
143+
fi
144+
}
145+
146+
compile_assertions_finished () {
147+
assert_line " * CFLAGS..............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c11"
148+
assert_line " * CXXFLAGS............: -g -O2 -Wall -Wformat -Wformat-security -pedantic -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -std=c++11"
149+
assert_line " * LDFLAGS.............: -fPIE -pie -Wl,-z,relro -Wl,-z,now"
150+
}
151151

152152
@test "Default empty configure" {
153153
# In the default image none of these tools were installed for:

0 commit comments

Comments
 (0)