Skip to content

Commit 54e309a

Browse files
committed
Re-enable integration tests.
1 parent 61ff419 commit 54e309a

File tree

1 file changed

+66
-78
lines changed

1 file changed

+66
-78
lines changed

gitlab/integration.sh

Lines changed: 66 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,19 @@ if [ $PIN_JUDGEDAEMON -eq 1 ]; then
143143
fi
144144
section_end more_setup
145145

146-
if [ $cgroupv1 -ne 0 ]; then
147-
section_start runguard_tests "Running isolated runguard tests"
148-
sudo addgroup domjudge-run-0
149-
sudo usermod -g domjudge-run-0 domjudge-run-0
150-
cd ${DIR}/judge/runguard_test
151-
make test
152-
section_end runguard_tests
153-
fi
146+
section_start runguard_tests "Running isolated runguard tests"
147+
sudo addgroup domjudge-run-0
148+
sudo usermod -g domjudge-run-0 domjudge-run-0
149+
cd ${DIR}/judge/runguard_test
150+
make test
151+
section_end runguard_tests
152+
153+
section_start start_judging "Start judging"
154+
cd /opt/domjudge/judgehost/
154155

155-
if [ $cgroupv1 -ne 0 ]; then
156-
section_start start_judging "Start judging"
157-
cd /opt/domjudge/judgehost/
158-
159-
sudo -u domjudge bin/judgedaemon $PINNING |& tee /tmp/judgedaemon.log &
160-
sleep 5
161-
section_end start_judging
162-
fi
156+
sudo -u domjudge bin/judgedaemon $PINNING |& tee /tmp/judgedaemon.log &
157+
sleep 5
158+
section_end start_judging
163159

164160
section_start submitting "Importing Kattis examples"
165161
export SUBMITBASEURL='http://localhost/domjudge/'
@@ -198,62 +194,60 @@ curl $CURLOPTS -F "sendto=" -F "problem=1-" -F "bodytext=Testing" -F "submit=Sen
198194

199195
section_end curlcookie
200196

201-
if [ $cgroupv1 -ne 0 ]; then
202-
section_start judging "Waiting until all submissions are judged"
203-
# wait for and check results
204-
NUMSUBS=$(curl --fail http://admin:$ADMINPASS@localhost/domjudge/api/contests/1/submissions | python3 -mjson.tool | grep -c '"id":')
205-
206-
# Don't spam the log.
207-
set +x
208-
209-
while /bin/true; do
210-
sleep 30s
211-
curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" -o /dev/null
212-
213-
# Check if we are done, i.e. everything is judged or something got disabled by internal error...
214-
if tail /tmp/judgedaemon.log | grep -q "No submissions in queue"; then
215-
break
216-
fi
217-
# ... or something has crashed.
218-
if ! pgrep -f judgedaemon; then
219-
break
220-
fi
221-
done
222-
223-
NUMNOTVERIFIED=$(curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions checked" | sed -r 's/^.* ([0-9]+) submissions checked.*$/\1/')
224-
NUMVERIFIED=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions not checked" | sed -r 's/^.* ([0-9]+) submissions not checked.*$/\1/')
225-
NUMNOMAGIC=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "without magic string" | sed -r 's/^.* ([0-9]+) without magic string.*$/\1/')
226-
section_end judging
227-
228-
# We expect
229-
# - two submissions with ambiguous outcome,
230-
# - one submissions submitted through the submit client, and thus the magic string ignored,
231-
# - and all submissions to be judged.
232-
if [ $NUMNOTVERIFIED -ne 2 ] || [ $NUMNOMAGIC -ne 1 ] || [ $NUMSUBS -gt $((NUMVERIFIED+NUMNOTVERIFIED)) ]; then
233-
section_start error "Short error description"
234-
# We error out below anyway, so no need to fail earlier than that.
235-
set +e
236-
echo "verified subs: $NUMVERIFIED, unverified subs: $NUMNOTVERIFIED, total subs: $NUMSUBS"
237-
echo "(expected 2 submissions to be unverified, but all to be processed)"
238-
echo "Of these $NUMNOMAGIC do not have the EXPECTED_RESULTS string (should be 1)."
239-
curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" | w3m -dump -T text/html
240-
section_end error
241-
242-
section_start logfiles "All the more or less useful logfiles"
243-
for i in /opt/domjudge/judgehost/judgings/*/*/*/*/*/compile.out; do
244-
echo $i;
245-
head -n 100 $i;
246-
dir=$(dirname $i)
247-
if [ -r $dir/testcase001/system.out ]; then
248-
head $dir/testcase001/system.out
249-
head $dir/testcase001/runguard.err
250-
head $dir/testcase001/program.err
251-
head $dir/testcase001/program.meta
252-
fi
253-
echo;
254-
done
255-
exit 1;
197+
section_start judging "Waiting until all submissions are judged"
198+
# wait for and check results
199+
NUMSUBS=$(curl --fail http://admin:$ADMINPASS@localhost/domjudge/api/contests/1/submissions | python3 -mjson.tool | grep -c '"id":')
200+
201+
# Don't spam the log.
202+
set +x
203+
204+
while /bin/true; do
205+
sleep 30s
206+
curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" -o /dev/null
207+
208+
# Check if we are done, i.e. everything is judged or something got disabled by internal error...
209+
if tail /tmp/judgedaemon.log | grep -q "No submissions in queue"; then
210+
break
211+
fi
212+
# ... or something has crashed.
213+
if ! pgrep -f judgedaemon; then
214+
break
215+
fi
216+
done
217+
218+
NUMNOTVERIFIED=$(curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions checked" | sed -r 's/^.* ([0-9]+) submissions checked.*$/\1/')
219+
NUMVERIFIED=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions not checked" | sed -r 's/^.* ([0-9]+) submissions not checked.*$/\1/')
220+
NUMNOMAGIC=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "without magic string" | sed -r 's/^.* ([0-9]+) without magic string.*$/\1/')
221+
section_end judging
222+
223+
# We expect
224+
# - two submissions with ambiguous outcome,
225+
# - one submissions submitted through the submit client, and thus the magic string ignored,
226+
# - and all submissions to be judged.
227+
if [ $NUMNOTVERIFIED -ne 2 ] || [ $NUMNOMAGIC -ne 1 ] || [ $NUMSUBS -gt $((NUMVERIFIED+NUMNOTVERIFIED)) ]; then
228+
section_start error "Short error description"
229+
# We error out below anyway, so no need to fail earlier than that.
230+
set +e
231+
echo "verified subs: $NUMVERIFIED, unverified subs: $NUMNOTVERIFIED, total subs: $NUMSUBS"
232+
echo "(expected 2 submissions to be unverified, but all to be processed)"
233+
echo "Of these $NUMNOMAGIC do not have the EXPECTED_RESULTS string (should be 1)."
234+
curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" | w3m -dump -T text/html
235+
section_end error
236+
237+
section_start logfiles "All the more or less useful logfiles"
238+
for i in /opt/domjudge/judgehost/judgings/*/*/*/*/*/compile.out; do
239+
echo $i;
240+
head -n 100 $i;
241+
dir=$(dirname $i)
242+
if [ -r $dir/testcase001/system.out ]; then
243+
head $dir/testcase001/system.out
244+
head $dir/testcase001/runguard.err
245+
head $dir/testcase001/program.err
246+
head $dir/testcase001/program.meta
256247
fi
248+
echo;
249+
done
250+
exit 1;
257251
fi
258252

259253
section_start api_check "Performing API checks"
@@ -273,13 +267,7 @@ if cat /opt/domjudge/domserver/webapp/var/log/prod.log | egrep '(CRITICAL|ERROR)
273267
fi
274268

275269
# Check the Contest API:
276-
if [ $cgroupv1 -ne 0 ]; then
277-
$CHECK_API -n -C -e -a 'strict=1' http://admin:$ADMINPASS@localhost/domjudge/api
278-
else
279-
# With cgroup v1 not being available we don't judge, so we cannot do
280-
# consistency checks, so running the above command without -C.
281-
$CHECK_API -n -e -a 'strict=1' http://admin:$ADMINPASS@localhost/domjudge/api
282-
fi
270+
$CHECK_API -n -C -e -a 'strict=1' http://admin:$ADMINPASS@localhost/domjudge/api
283271
section_end api_check |& tee "$GITLABARTIFACTS/check_api.log"
284272

285273
section_start validate_feed "Validate the eventfeed against API (ignoring failures)"

0 commit comments

Comments
 (0)