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 = () => {
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;

View File

@ -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

View File

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

View File

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

View File

@ -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: |

View File

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

View File

@ -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)