Miscellaneous fixes

This commit is contained in:
Radon Rosborough 2021-07-10 22:24:42 +00:00
parent 76d0770038
commit 44de19946e
7 changed files with 35 additions and 14 deletions

View File

@ -165,15 +165,21 @@ class Test {
this.handleUpdate = () => { this.handleUpdate = () => {
if (this.timedOut) { if (this.timedOut) {
reject(new Error(`timeout while waiting for ${desc}`)); reject(new Error(`timeout while waiting for ${desc}`));
} else { return;
while (this.handledMessages < this.messages.length) { }
const msg = this.messages[this.handledMessages]; while (this.handledMessages < this.messages.length) {
const result = handler(msg); const msg = this.messages[this.handledMessages];
if (![undefined, null, false].includes(result)) { let result;
resolve(result); try {
} result = handler(msg);
this.handledMessages += 1; } catch (err) {
reject(err);
return;
} }
if (![undefined, null, false].includes(result)) {
resolve(result);
}
this.handledMessages += 1;
} }
}; };
this.handleUpdate(); this.handleUpdate();
@ -222,8 +228,8 @@ class Test {
await this.waitForOutput(pattern, this.config.helloMaxLength); await this.waitForOutput(pattern, this.config.helloMaxLength);
if (!this.config.repl) { if (!this.config.repl) {
await this.wait("termination", (msg) => { await this.wait("termination", (msg) => {
if (msg.event === "serviceFailed") { if (msg.event === "serviceFailed" && msg.service === "terminal") {
if (msg.code !== 0) { if (msg.code !== (this.config.helloStatus || 0)) {
throw new Error(`run failed with code ${msg.code}`); throw new Error(`run failed with code ${msg.code}`);
} }
return true; return true;

View File

@ -53,6 +53,6 @@ template: |
main(application-name(), application-arguments()); main(application-name(), application-arguments());
compile: | compile: |
dylan-compiler -build main.lid dylan-compiler -build main.lid && echo
run: | run: |
_build/bin/main _build/bin/main

View File

@ -58,3 +58,4 @@ compile: |
clang main.c main.main.c -lecereCOM -o main clang main.c main.main.c -lecereCOM -o main
run: | run: |
./main ./main
helloStatus: 139

View File

@ -64,3 +64,4 @@ compile: |
limbo -o riju/main.dis riju/main.b limbo -o riju/main.dis riju/main.b
run: | run: |
emu -r . riju/main.dis emu -r . riju/main.dis
helloStatus: 137

View File

@ -844,6 +844,19 @@ properties:
the regular expression.) the regular expression.)
type: integer type: integer
minimum: 1 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: runReplInput:
title: "REPL input for 'runrepl' test specifically" title: "REPL input for 'runrepl' test specifically"
description: | description: |

View File

@ -388,7 +388,7 @@ func (sv *supervisor) reload() error {
return nil return nil
} }
var rijuContainerRegexp = regexp.MustCompile(`^([^|]+):([^|]+)\|([^|]+)$`) var rijuContainerRegexp = regexp.MustCompile(`^([^|]+)\|([^|]+)\|([^|]+)$`)
func main() { func main() {
supervisorCfg := supervisorConfig{} supervisorCfg := supervisorConfig{}

View File

@ -64,7 +64,7 @@ runuser_args = []
if args.user: if args.user:
runuser_args = ["runuser", "-u", args.user, "--"] runuser_args = ["runuser", "-u", args.user, "--"]
subprocess.run([ sys.exit(subprocess.run([
"docker", "docker",
"exec", "exec",
*exec_args, *exec_args,
@ -81,4 +81,4 @@ exec "$@"
"--", "--",
*runuser_args, *runuser_args,
*args.arg, *args.arg,
]) ]).returncode)