Skip to content

Commit b2faa61

Browse files
committed
nit_jail: write a "$dir/done" file when done
Signed-off-by: Jean Privat <jean@pryen.org>
1 parent 1bfb6a5 commit b2faa61

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

nit_jail/runtest.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ tmpl=`get_template "$arg"`
5656
if [ -z "$tmpl" ]; then
5757
echo >&18 "No template"
5858
echo >&2 "Cannot identify the mission you tried to solve. Please use the template provided as is without any modification."
59+
echo "bad template" > "$dir/done"
5960
exit 1
6061
fi
6162

@@ -113,10 +114,11 @@ function default()
113114
function flag()
114115
{
115116
echo >&18 "## $FUNCNAME $@"
116-
md5=(`md5sum "../$file"`)
117-
echo "UQAM{$md5}"
117+
echo "Congratulation"
118118
highlight --fragment -S nit --enclose-pre "../$file" > "$dir/answer.html"
119-
echo >&18 "FLAG $tmpl/$file UQAM{$md5}"
119+
echo >&18 "Solved $tmpl/$file"
120+
echo "solved" > "$dir/done"
121+
exit 0
120122
}
121123

122124
function bis()
@@ -128,6 +130,7 @@ function bis()
128130
function fool()
129131
{
130132
echo >&2 "Are you trying to fool us?"
133+
echo "fool" > "$dir/done"
131134
exit 1
132135
}
133136

@@ -227,7 +230,7 @@ case "$tmpl" in
227230
run ./logolas maenas.logolas &&
228231
run ./logolas elen.logolas &&
229232
run ./logolas bar.logolas &&
230-
checkres || exit 1
233+
checkres || break
231234
{ bis && run ./logolas bar2.logolas && checkres; } 2>/dev/null || fool &&
232235
flag
233236
;;
@@ -256,14 +259,17 @@ case "$tmpl" in
256259
run ./logolas_caca maenas.logolas &&
257260
run ./logolas_caca elen.logolas &&
258261
run ./logolas_caca bar.logolas &&
259-
checkres || exit 1
262+
checkres || break
260263
{ bis && run ./logolas_caca bar2.logolas && checkres; } 2>/dev/null || fool &&
261264
flag
262265
;;
263266

264267
*)
265268
echo >&2 "FATAL ERROR: cannot process mission '$tmpl'"
266269
echo >&18 "## FATAL ERROR for $tmpl"
270+
echo "cannot process" > "$dir/done"
267271
exit 1
268272
;;
269273
esac
274+
275+
echo "failed" > "$dir/done"

0 commit comments

Comments
 (0)