lib/fmt+lib/log+lib/memio: drop rt_syscall stubs in tests; use os
After12436dd, lib/fmt and lib/log production code routed through os.write / os.exit. The test files (fmttest, logtest, memiotest) still carried the same @symbol("rt_syscall") syscall1ww / doexit stub block with the (now stale) os↔io collision rationale. Same mechanical drop as12436dd: add use os;, route fail() through os.exit, remove the stubs. Also reword the stale workaround comment in lib/memio/memio.ww covering rt_alloc/rt_free. The decls themselves stay until lib/os exports alloc/free as a follow-up. No combined.ww regen (these files aren't bootstrap-folded).
This commit is contained in:
@@ -10,20 +10,13 @@
|
|||||||
use fmt;
|
use fmt;
|
||||||
use io;
|
use io;
|
||||||
use memio;
|
use memio;
|
||||||
|
use os;
|
||||||
// Direct exit(2) binding rather than `use os;` — os exports
|
|
||||||
// read/write/close, which collide with io.read/write/close under
|
|
||||||
// the driver's flat-scope concat.
|
|
||||||
@symbol("rt_syscall") fn syscall1ww(num: i64, a: i64) i64;
|
|
||||||
fn doexit(code: i32) void = {
|
|
||||||
syscall1ww(60i64, code: i64);
|
|
||||||
};
|
|
||||||
|
|
||||||
// signalled — bumped before each scenario so a failing exit code
|
// signalled — bumped before each scenario so a failing exit code
|
||||||
// pinpoints the offending case.
|
// pinpoints the offending case.
|
||||||
let signalled: i32 = 0;
|
let signalled: i32 = 0;
|
||||||
|
|
||||||
fn fail() void = { doexit(signalled + 10); };
|
fn fail() void = { os.exit(signalled + 10); };
|
||||||
|
|
||||||
fn streq(a: str, b: str) bool = {
|
fn streq(a: str, b: str) bool = {
|
||||||
if (a.len != b.len) { return false; };
|
if (a.len != b.len) { return false; };
|
||||||
|
|||||||
@@ -13,21 +13,13 @@ use fmt;
|
|||||||
use io;
|
use io;
|
||||||
use log;
|
use log;
|
||||||
use memio;
|
use memio;
|
||||||
|
use os;
|
||||||
// Direct exit(2) binding rather than `use os;` — os exports
|
|
||||||
// read/write/close, which collide with io.read/write/close under
|
|
||||||
// the driver's flat-scope concat. Same workaround as bufiotest /
|
|
||||||
// fmttest / memiotest.
|
|
||||||
@symbol("rt_syscall") fn syscall1ww(num: i64, a: i64) i64;
|
|
||||||
fn doexit(code: i32) void = {
|
|
||||||
syscall1ww(60i64, code: i64);
|
|
||||||
};
|
|
||||||
|
|
||||||
// signalled — bumped before each scenario so a failing exit code
|
// signalled — bumped before each scenario so a failing exit code
|
||||||
// pinpoints the offending case.
|
// pinpoints the offending case.
|
||||||
let signalled: i32 = 0;
|
let signalled: i32 = 0;
|
||||||
|
|
||||||
fn fail() void = { doexit(signalled + 10); };
|
fn fail() void = { os.exit(signalled + 10); };
|
||||||
|
|
||||||
fn streq(a: str, b: str) bool = {
|
fn streq(a: str, b: str) bool = {
|
||||||
if (a.len != b.len) { return false; };
|
if (a.len != b.len) { return false; };
|
||||||
|
|||||||
@@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
use io;
|
use io;
|
||||||
|
|
||||||
// Direct rt_alloc/rt_free bindings rather than `use os;` because os
|
// Direct rt_alloc/rt_free bindings — the runtime heap primitives
|
||||||
// exports read/write/close, which collide with io.read/write/close
|
// memio.dynamic / dynamicfrom need to own the backing buffer. lib/os
|
||||||
// under the driver's flat-scope concatenation. Same pattern as
|
// holds the same FFI shape but doesn't export it; same pattern as
|
||||||
// rt/ensure.ww.
|
// rt/ensure.ww.
|
||||||
@symbol("rt_alloc") fn rtalloc(n: u64) *void;
|
@symbol("rt_alloc") fn rtalloc(n: u64) *void;
|
||||||
@symbol("rt_free") fn rtfree(p: *void, n: u64) void;
|
@symbol("rt_free") fn rtfree(p: *void, n: u64) void;
|
||||||
|
|||||||
@@ -8,20 +8,13 @@
|
|||||||
use bytes;
|
use bytes;
|
||||||
use io;
|
use io;
|
||||||
use memio;
|
use memio;
|
||||||
|
use os;
|
||||||
// Direct exit(2) binding rather than `use os;` — os exports
|
|
||||||
// read/write/close, which collide with io.read/write/close under
|
|
||||||
// the driver's flat-scope concat (task #7).
|
|
||||||
@symbol("rt_syscall") fn syscall1ww(num: i64, a: i64) i64;
|
|
||||||
fn doexit(code: i32) void = {
|
|
||||||
syscall1ww(60i64, code: i64);
|
|
||||||
};
|
|
||||||
|
|
||||||
// signalled — bumped by main before each test so a failing exit code
|
// signalled — bumped by main before each test so a failing exit code
|
||||||
// pinpoints the offending case.
|
// pinpoints the offending case.
|
||||||
let signalled: i32 = 0;
|
let signalled: i32 = 0;
|
||||||
|
|
||||||
fn fail() void = { doexit(signalled + 10); };
|
fn fail() void = { os.exit(signalled + 10); };
|
||||||
|
|
||||||
fn putstr(s: str, into: []u8, off: i32) i32 = {
|
fn putstr(s: str, into: []u8, off: i32) i32 = {
|
||||||
let i: i32 = 0;
|
let i: i32 = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user