Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ Since the tests are mostly just jUnit tests, IntelliJ and other IDE's provide su
Per exercise, create a new project. The `config.json` file should be in the project root. Mark (or create) the `workdir`, `evaluation` and `solution` directories as "sources root". Add jUnit 4 as a dependency of the project.

If your exercises use some Dodona-specific features, such as the `TabTitle` or the `AssertionStubber`, add the Judge as a dependency. Opening this repository as an IntelliJ project should allow you to create a JAR.

## Developing the judge

While developing, you can use `./integration-tests/run` to validate whether the judge is working properly. It checks the judge's output JSON against previous results (stored as `result.json`) and monitors whether something has changed.

You can also use `./integration-tests/run <path-to-repo>` to run the same checks on an exercise repository, which is useful to validate a larger set op exercises.

With `---overwrite`, you can overwrite previous `result.json` files with the current output, and with `-v` you can check for judge error output and view the exact changes when output differs.
18 changes: 0 additions & 18 deletions i18n/en

This file was deleted.

18 changes: 0 additions & 18 deletions i18n/nl

This file was deleted.

1 change: 1 addition & 0 deletions integration-tests/correct/config.json
1 change: 1 addition & 0 deletions integration-tests/correct/evaluation
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"command": "start-tab",
"hidden": false,
"permission": "student",
"title": "Vertaalde titel"
"title": "Tab title"
}
{
"command": "start-context",
"description": {
"description": "Vertaalde Test",
"description": "Test description",
"format": "code"
}
}
Expand Down
1 change: 1 addition & 0 deletions integration-tests/forgotten-semicolon/config.json
1 change: 1 addition & 0 deletions integration-tests/forgotten-semicolon/evaluation
1 change: 0 additions & 1 deletion integration-tests/i18n-correct-en/config.json

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-correct-en/evaluation

This file was deleted.

34 changes: 0 additions & 34 deletions integration-tests/i18n-correct-en/result.json

This file was deleted.

4 changes: 0 additions & 4 deletions integration-tests/i18n-correct-nl/config.json

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-correct-nl/evaluation

This file was deleted.

7 changes: 0 additions & 7 deletions integration-tests/i18n-correct-nl/submission.java

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-forgotten-semicolon/config.json

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-forgotten-semicolon/evaluation

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-stackoverflow/config.json

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-stackoverflow/evaluation

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions integration-tests/i18n-with-package-nl/config.json

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/i18n-with-package-nl/evaluation

This file was deleted.

37 changes: 0 additions & 37 deletions integration-tests/i18n-with-package-nl/result.json

This file was deleted.

9 changes: 0 additions & 9 deletions integration-tests/i18n-with-package-nl/submission.java

This file was deleted.

19 changes: 15 additions & 4 deletions integration-tests/run
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/usr/bin/env bash
set -e
shopt -s globstar

# Default values
target_dir="integration-tests"
overwrite=0
verbose=0

# Parse arguments
while [ "$#" -gt 0 ]; do
case "$1" in
--overwrite)
overwrite=1
;;
-v|--verbose)
verbose=1
;;
*)
target_dir="$1"
;;
Expand All @@ -25,8 +30,13 @@ description_changed=0
minor_change=0
major_change=0

err_out="/dev/null"
if [ $verbose -gt 0 ]; then
err_out="/dev/stderr"
fi

# Find all config.json files in target directory
for config in "$target_dir"/**/config.json; do
for config in $target_dir/**/config.json; do
test_dir="$(dirname "$config")"

# Extract config values
Expand Down Expand Up @@ -69,7 +79,7 @@ for config in "$target_dir"/**/config.json; do
, "memory_limit": 1000000000
, "source": "'"$judge/$source"'"
}' \
| (timeout -k 10s 60s "$judge/run" 2> /dev/null) \
| (timeout -k 10s 60s "$judge/run" 2> "$err_out") \
| jq --sort-keys 'if(.command == "append-message")
then .message.description |= gsub("\n at [^\n]+\\([^)]+\\)"; "")
else .
Expand All @@ -93,10 +103,11 @@ for config in "$target_dir"/**/config.json; do


# First check if files are exact using diff, then check if they differ except '.description', then check they differ in accepted or failed
if diff "$result_file" <(echo "$output") > /dev/null; then

if diff -c "$result_file" <(echo "$output") > "$err_out"; then
echo "[EXACT MATCH]"
exact_match=$((exact_match + 1))
elif diff <(jq "del(.description)" "$result_file") <(echo "$output" | jq "del(.description)") > /dev/null; then
elif diff -c <(jq "del(.description)" "$result_file") <(echo "$output" | jq "del(.description)") > "$err_out"; then
echo "[DESCRIPTION CHANGED]"
description_changed=$((description_changed + 1))
elif [ "$accepted_output" -eq "$accepted_result" ] && [ "$failed_output" -eq "$failed_result" ]; then
Expand Down
1 change: 1 addition & 0 deletions integration-tests/stackoverflow/config.json
1 change: 1 addition & 0 deletions integration-tests/stackoverflow/evaluation
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"command": "start-tab",
"hidden": false,
"permission": "student",
"title": "Translated title"
"title": "Tab title"
}
{
"command": "start-context",
"description": {
"description": "Translated Test",
"description": "Test description",
"format": "code"
}
}
Expand Down
4 changes: 0 additions & 4 deletions integration-tests/system-exit-nl/config.json

This file was deleted.

1 change: 0 additions & 1 deletion integration-tests/system-exit-nl/evaluation

This file was deleted.

Loading