fixed wasishim returning NOSYS, urust --auto-mod flag, -O1

This commit is contained in:
Steven Hugg committed 2026-10-21 14:11:30 +02:00
1 parent 81f7ec215a
commit 3e6e19aa65
4 files changed
+12 -5

No files matched your search

+2 -2
View File
@@ -440,9 +440,9 @@ export class WASIRunner {
} else return WASIErrors.INVAL;
}
} else {
if (file == null) return WASIErrors.NOSYS;
if (file == null) return WASIErrors.NOENT;
if (o_flags & FDOpenFlags.DIRECTORY) { // check type
if (file.type !== FDType.DIRECTORY) return WASIErrors.NOSYS;
if (file.type !== FDType.DIRECTORY) return WASIErrors.NOTDIR;
}
if (o_flags & FDOpenFlags.EXCL) return WASIErrors.INVAL; // already exists
if (o_flags & FDOpenFlags.TRUNC) { // truncate
+2 -1
View File
@@ -27,8 +27,9 @@ export function compileUrust(step: BuildStep): BuildStepResult {
wasi.initSync(wasiModule);
populateWASIFiles(wasi, step);
const args = ['urust', 'build', step.path, '--platform', platform, '--emit', 'bin', '-o', binpath,
'-Ob', '-fno-bounds-checks',
'-O1', '-fno-bounds-checks',
'-Wall',
'--auto-mod',
'--debug-out', dbgpath, '--error-format', 'json'];
args.push.apply(args, extraArgsFor('urust', step.params && step.params.buildArgs));
wasi.setArgs(args);
+1 -1
View File
@@ -54,7 +54,7 @@ describe('urust tool', function () {
assert.strictEqual(urustPlatformName('c64'), 'c64');
assert.strictEqual(urustPlatformName('atari8-800xl'), 'atari8');
assert.strictEqual(urustPlatformName('vcs'), 'vcs');
assert.strictEqual(urustPlatformName('apple2'), undefined);
assert.strictEqual(urustPlatformName('apple2'), 'apple2');
});
it('parses JSON diagnostics; end column only on a single line', function () {
+7 -1
View File
@@ -1,5 +1,5 @@
import assert from "assert";
import { WASIRunner, WASIMemoryFilesystem, WASIErrors, normalizeWASIPath } from "../../src/common/wasi/wasishim";
import { WASIRunner, WASIMemoryFilesystem, WASIErrors, FDOpenFlags, normalizeWASIPath } from "../../src/common/wasi/wasishim";
import * as fs from "fs";
import { loadWASIFilesystemZip, unzipWASIFilesystem } from "../../src/worker/wasiutils";
import { parseOscar64Listing, parseOscar64Lbl, parseOscar64Map } from "../../src/worker/tools/oscar64parse";
@@ -168,6 +168,12 @@ describe('WASIMemoryFilesystem path handling', function () {
assert.strictEqual(normalizeWASIPath('.'), '.');
assert.strictEqual(normalizeWASIPath('/'), '/');
});
it('reports a missing file as NOENT, not NOSYS', function () {
const wasi = new WASIRunner();
assert.strictEqual(wasi.openFile('./missing.bin', 0), WASIErrors.NOENT);
wasi.fs.putFile('./plain.bin', 'x');
assert.strictEqual(wasi.openFile('./plain.bin', FDOpenFlags.DIRECTORY), WASIErrors.NOTDIR);
});
it('finds files written with a different leading ./ depth', function () {
const fsys = new WASIMemoryFilesystem();
fsys.putFile('././main.map', 'map');