Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

tests: drain child stderr to EOF in fork-capture helpers

monotophice83117e8453b
diff --git a/c/tests/test_fp8_load.c b/c/tests/test_fp8_load.c
index 9c01b24a..b57d9d1a 100644
--- a/c/tests/test_fp8_load.c
+++ b/c/tests/test_fp8_load.c
@@ -183,7 +183,7 @@ static int expect_refuse(int O, int I, int64_t nb, int64_t ns, const char *tag){
_exit(42); /* reaching here is the bug */
}
close(pipefd[1]);
- char err[1024]={0}; ssize_t n=read(pipefd[0],err,sizeof(err)-1); (void)n;
+ char err[1024]={0}; size_t eoff=0; ssize_t n; /* drain to EOF: a single read() can return SHORT on Linux pipes (glibc unbuffered stderr arrives in chunks) -- truncated the refusal message past the marker, CI-caught */ while(eoff<sizeof(err)-1 && (n=read(pipefd[0],err+eoff,sizeof(err)-1-eoff))>0) eoff+=(size_t)n;
close(pipefd[0]);
int status=0; waitpid(pid,&status,0);
int ok = WIFEXITED(status) && WEXITSTATUS(status)==1;
diff --git a/c/tests/test_qt_addrow.c b/c/tests/test_qt_addrow.c
index c97c12b3..cc9f81c5 100644
--- a/c/tests/test_qt_addrow.c
+++ b/c/tests/test_qt_addrow.c
@@ -245,7 +245,7 @@ static int expect_refuse_call(absorb_fn fn, const char *tag){
_exit(42); /* reaching here (surviving the call without exit(1)) is the bug */
}
close(pipefd[1]);
- char err[1024]={0}; ssize_t n=read(pipefd[0],err,sizeof(err)-1); (void)n;
+ char err[1024]={0}; size_t eoff=0; ssize_t n; /* drain to EOF: a single read() can return SHORT on Linux pipes (glibc unbuffered stderr arrives in chunks) -- truncated the refusal message past the marker, CI-caught */ while(eoff<sizeof(err)-1 && (n=read(pipefd[0],err+eoff,sizeof(err)-1-eoff))>0) eoff+=(size_t)n;
close(pipefd[0]);
int status=0; waitpid(pid,&status,0);
if(WIFSIGNALED(status)){