diff --git a/backend/test-runner.js b/backend/test-runner.js index 4564674..6a054b2 100644 --- a/backend/test-runner.js +++ b/backend/test-runner.js @@ -165,15 +165,21 @@ class Test { this.handleUpdate = () => { if (this.timedOut) { reject(new Error(`timeout while waiting for ${desc}`)); - } else { - while (this.handledMessages < this.messages.length) { - const msg = this.messages[this.handledMessages]; - const result = handler(msg); - if (![undefined, null, false].includes(result)) { - resolve(result); - } - this.handledMessages += 1; + return; + } + while (this.handledMessages < this.messages.length) { + const msg = this.messages[this.handledMessages]; + let result; + try { + result = handler(msg); + } catch (err) { + reject(err); + return; } + if (![undefined, null, false].includes(result)) { + resolve(result); + } + this.handledMessages += 1; } }; this.handleUpdate(); @@ -222,8 +228,8 @@ class Test { await this.waitForOutput(pattern, this.config.helloMaxLength); if (!this.config.repl) { await this.wait("termination", (msg) => { - if (msg.event === "serviceFailed") { - if (msg.code !== 0) { + if (msg.event === "serviceFailed" && msg.service === "terminal") { + if (msg.code !== (this.config.helloStatus || 0)) { throw new Error(`run failed with code ${msg.code}`); } return true; diff --git a/langs/dylan.yaml b/langs/dylan.yaml index 858fed7..9525d87 100644 --- a/langs/dylan.yaml +++ b/langs/dylan.yaml @@ -53,6 +53,6 @@ template: | main(application-name(), application-arguments()); compile: | - dylan-compiler -build main.lid + dylan-compiler -build main.lid && echo run: | _build/bin/main diff --git a/langs/ec.yaml b/langs/ec.yaml index bf3850e..73a26a8 100644 --- a/langs/ec.yaml +++ b/langs/ec.yaml @@ -58,3 +58,4 @@ compile: | clang main.c main.main.c -lecereCOM -o main run: | ./main +helloStatus: 139 diff --git a/langs/limbo.yaml b/langs/limbo.yaml index 34bae52..0e1b2d7 100644 --- a/langs/limbo.yaml +++ b/langs/limbo.yaml @@ -64,3 +64,4 @@ compile: | limbo -o riju/main.dis riju/main.b run: | emu -r . riju/main.dis +helloStatus: 137 diff --git a/lib/jsonschema.yaml b/lib/jsonschema.yaml index 168357d..a8bf7ee 100644 --- a/lib/jsonschema.yaml +++ b/lib/jsonschema.yaml @@ -844,6 +844,19 @@ properties: the regular expression.) type: integer minimum: 1 + helloStatus: + title: "Expected exit status for 'run' test" + description: | + By default, the 'run' command is expected to exit with status 0 + when run on the 'template' code (after printing "Hello, + world!"). In the case that the exit status is something else, it + can be overridden. + + This only has an effect if 'repl' is *not* specified. + type: integer + minimum: 0 + maximum: 255 + default: 0 runReplInput: title: "REPL input for 'runrepl' test specifically" description: | diff --git a/supervisor/src/main.go b/supervisor/src/main.go index ad6d96a..3fac4ed 100644 --- a/supervisor/src/main.go +++ b/supervisor/src/main.go @@ -388,7 +388,7 @@ func (sv *supervisor) reload() error { return nil } -var rijuContainerRegexp = regexp.MustCompile(`^([^|]+):([^|]+)\|([^|]+)$`) +var rijuContainerRegexp = regexp.MustCompile(`^([^|]+)\|([^|]+)\|([^|]+)$`) func main() { supervisorCfg := supervisorConfig{} diff --git a/system/res/docker-exec.py b/system/res/docker-exec.py index 8d13799..b442645 100755 --- a/system/res/docker-exec.py +++ b/system/res/docker-exec.py @@ -64,7 +64,7 @@ runuser_args = [] if args.user: runuser_args = ["runuser", "-u", args.user, "--"] -subprocess.run([ +sys.exit(subprocess.run([ "docker", "exec", *exec_args, @@ -81,4 +81,4 @@ exec "$@" "--", *runuser_args, *args.arg, -]) +]).returncode)