Skip to content

Commit

Permalink
Fix findings from test
Browse files Browse the repository at this point in the history
Since the beginning we now also support nginx, and fixed the test with
the erroneous ')'.
  • Loading branch information
vmcj committed Jul 28, 2023
1 parent 046a2c6 commit bc6de37
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
22 changes: 10 additions & 12 deletions .github/jobs/configure-checks/all.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ setup() {
for shared_file in config.log confdefs.h conftest.err; do
chmod a+rw $shared_file || true
done
if grep "fedora" /etc/os-release 2>/dev/zero >&2; then
if [ "$distro_id" = "ID=fedora" ]; then
repo-install httpd
fi
repo-install gcc g++ libcgroup-dev
Expand All @@ -51,7 +51,7 @@ repo-install () {
repo-remove () {
args=$(translate $@)
${cmd} remove $args -y #>/dev/null
if ! grep "fedora" /etc/os-release 2>/dev/zero >&2; then
if [ "$distro_id" != "ID=fedora" ]; then
apt-get autoremove -y 2>/dev/null
fi
}
Expand Down Expand Up @@ -142,8 +142,8 @@ compile_assertions_finished () {
# Fedora has gcc as dependency for clang
skip
fi
run repo-remove gcc g++
run repo-install clang libcgroup-dev
repo-remove gcc g++
repo-install clang libcgroup-dev
compiler_assertions cc c++
assert_line "checking for gcc... no"
assert_line "checking for cc... cc"
Expand Down Expand Up @@ -172,7 +172,7 @@ compile_assertions_finished () {
groupdel ${www_group} || true
done
run ./configure --with-domjudge-user=$u
assert_line "checking webserver-group... configure: error: webserver group could not be detected, use --with-webserver-group=GROUP)"
assert_line "checking webserver-group... configure: error: webserver group could not be detected, use --with-webserver-group=GROUP"
}

@test "Check for newly added webserver group (Apache)" {
Expand All @@ -191,8 +191,7 @@ compile_assertions_finished () {
assert_line " * webserver group.....: apache"
}

@test "Check for newly added webserver group (nginx)" {
# TODO: We don't find the nginx group
@test "Check for newly added webserver group (Nginx)" {
if [ "$distro_id" != "ID=fedora" ]; then
# Debian/Ubuntu start with a www-data group
skip
Expand All @@ -204,9 +203,8 @@ compile_assertions_finished () {
done
repo-install nginx
run ./configure --with-domjudge-user=$u
refute_line "checking webserver-group... nginx (detected)"
refute_line " * webserver group.....: nginx"
assert_line "checking webserver-group... configure: error: webserver group could not be detected, use --with-webserver-group=GROUP)"
assert_line "checking webserver-group... nginx (detected)"
assert_line " * webserver group.....: nginx"
}

@test "Run as normal user" {
Expand Down Expand Up @@ -399,12 +397,12 @@ compile_assertions_finished () {
assert_line " * default user........: domjudge-bats-user"
assert_line " * runguard user.......: domjudge-run"
assert_line " * runguard group......: domjudge-run"
#assert_regex "^ * webserver group.....: (www-data|apache)$"
assert_regex "^ * webserver group.....: (www-data|apache|nginx)$"
run run_configure "--with-domjudge-user=other_user --with-webserver-group=other_group --with-runuser=other-domjudge-run --with-rungroup=other-run-group"
refute_line " * default user........: domjudge-bats-user"
refute_line " * runguard user.......: domjudge-run"
refute_line " * runguard group......: domjudge-run"
#refute_regex "^ * webserver group.....: (www-data|apache)$"
refute_regex "^ * webserver group.....: (www-data|apache|nginx)$"
assert_line " * default user........: other_user"
assert_line " * runguard user.......: other-domjudge-run"
assert_line " * runguard group......: other-run-group"
Expand Down
4 changes: 3 additions & 1 deletion .github/jobs/configure-checks/setup_configure_image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -eux

distro_id=$(grep "^ID=" /etc/os-release)

# Install everything for configure and testing
Expand All @@ -18,4 +20,4 @@ make configure
cp submit/assert.bash .github/jobs/configure-checks/

# Run the configure tests for this usecase
test_path="/__w/domjudge/domjudge" bats .github/jobs/configure-checks/all.bats
test_path="/__w/domjudge/domjudge" bats .github/jobs/configure-checks/all.bats
9 changes: 8 additions & 1 deletion .github/workflows/autoconf-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Check autoconf
on:
push:
branches:
- main
- '[0-9]+.[0-9]+'
pull_request:
branches:
- main
- '[0-9]+.[0-9]+'

jobs:
debian-family:
Expand All @@ -25,7 +32,7 @@ jobs:
image: ${{ matrix.os }}:${{ matrix.version }}
steps:
- name: Install git so we get the .github directory
run: apt update; apt install -y git
run: apt-get update; apt-get install -y git
- uses: actions/checkout@v3
- name: Setup image and run bats tests
run: .github/jobs/configure-checks/setup_configure_image.sh

0 comments on commit bc6de37

Please sign in to comment.