import subprocess from . import common def test_memfsmtime(tmpdir): with tmpdir.as_cwd(): with open("main.c", "w") as f: f.write( r"""\ #include #include #include #include #include #include #include void mysleep(int delta) { time_t end = time(NULL) + delta; while (time(NULL) t0); assert(t1 == t2); mysleep(1); unlink(fname); t3 = getmtime(tmpdir); assert(t3 > t1); } """ ) subprocess.run( [ "emcc", "-s", "MAIN_MODULE=1", "main.c", ], check=True, ) out = subprocess.run(["node", "a.out.js"], capture_output=True, check=False) assert out.returncode == 0