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

test(stops): clear environment portably on Windows

ZacharyZcR3472d415e69f
diff --git a/c/tests/test_stops.c b/c/tests/test_stops.c
index ad4e7d78..b864660a 100644
--- a/c/tests/test_stops.c
+++ b/c/tests/test_stops.c
@@ -63,6 +63,14 @@ static int expect(const char *what, int id, int want){
return 0;
}
+static void clear_env(const char *name){
+#ifdef _WIN32
+ SetEnvironmentVariableA(name,NULL);
+#else
+ unsetenv(name);
+#endif
+}
+
int main(void){
int fail=0;
/* Relative to the CWD, like test_compat_direct's TMPF — NOT "/tmp/...".
@@ -131,7 +139,7 @@ int main(void){
/* 6. Private chat uses SERVE=1 for the byte protocol but has no Python
* StopFilter. Only the batched gateway may reduce the engine stop set. */
{ Cfg c; memset(&c,0,sizeof c); c.stop_ids[0]=100; c.n_stop=1;
- setenv("SERVE","1",1); unsetenv("SERVE_BATCH"); unsetenv("COLI_SERVE_ALL_STOPS");
+ setenv("SERVE","1",1); clear_env("SERVE_BATCH"); clear_env("COLI_SERVE_ALL_STOPS");
stops_arm_tok(&c,100,&T);
fail|=expect("private chat keeps <|user|>",101,1);
fail|=expect("private chat keeps <|observation|>",102,1);
@@ -147,7 +155,7 @@ int main(void){
stops_arm_tok(&c,100,&T);
fail|=expect("gateway override restores <|user|>",101,1);
if(g_nstop!=5){ fprintf(stderr," FAIL gateway override: expected 5 stops, got %d\n",g_nstop); fail=1; }
- unsetenv("COLI_SERVE_ALL_STOPS"); unsetenv("SERVE_BATCH"); unsetenv("SERVE");
+ clear_env("COLI_SERVE_ALL_STOPS"); clear_env("SERVE_BATCH"); clear_env("SERVE");
if(!fail) printf(" private chat keeps 5 stops; batched gateway filters to EOS ok\n"); }
rm_file(dir,"config.json"); rm_file(dir,"generation_config.json"); rm_file(dir,"tokenizer.json");