diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 56ee842a2c..e9d9d0c651 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -42,6 +42,12 @@ jobs: run: sudo misc-tools/dj_make_chroot -a amd64 - name: Check nginx run: curl -v https://localhost/domjudge/ + - name: Configure print command + working-directory: submit + run: | + curl --fail -u 'admin:password' -X 'GET' 'http://localhost/domjudge/api/v4/config?strict=false' \ + | jq '.print_command |= "cp [file] /tmp/dj-printfile"' \ + | curl --fail -u 'admin:password' -X 'PUT' -T - 'http://localhost/domjudge/api/v4/config?strict=false' \ - name: Testing submit client working-directory: submit run: make check-full diff --git a/submit/submit_online.bats b/submit/submit_online.bats index 1177854542..26b3179109 100755 --- a/submit/submit_online.bats +++ b/submit/submit_online.bats @@ -136,3 +136,12 @@ setup() { assert_regex "Submission received: id = s[0-9]*, time = [0-9]{2}:[0-9]{2}:[0-9]{2}" assert_regex "Check http[^ ]*/[0-9]* for the result." } + +@test "submit print job" { + run ./submit -P -l C ../example_problems/hello/submissions/accepted/test-hello.c + assert_success + assert_regex "DOMjudge reported a successful print job." + run diff /tmp/dj-printfile ../example_problems/hello/submissions/accepted/test-hello.c + # Diff has exit code 0 iff the files are equal + assert_success +} diff --git a/submit/submit_standalone.bats b/submit/submit_standalone.bats index dd476fd6e8..dcaffe5250 100755 --- a/submit/submit_standalone.bats +++ b/submit/submit_standalone.bats @@ -40,7 +40,7 @@ setup() { @test "display basic usage information" { run ./submit --help assert_success - assert_line "usage: submit [--version] [-h] [-c CONTEST] [-p PROBLEM] [-l LANGUAGE] [-e ENTRY_POINT]" + assert_line "usage: submit [--version] [-h] [-c CONTEST] [-P] [-p PROBLEM] [-l LANGUAGE] [-e ENTRY_POINT]" assert_line " [-v [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]] [-q] [-y] [-u URL]" # The help printer does print this differently on versions of argparse for nargs=*. assert_regex " (filename )?[filename ...]"