MCPcopy Create free account
hub / github.com/WheretIB/nullc / Run

Method Run

tests/TestRuntimeFail.cpp:277–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275struct Test_testGlobalOverflow : TestQueue
276{
277 virtual void Run()
278 {
279 char *stackMem = new char[32*1024];
280 if(Tests::messageVerbose)
281 printf("Global overflow test\r\n");
282 nullcSetJiTStack(stackMem, stackMem + 32*1024, true);
283 {
284 testsCount[1]++;
285 nullcSetExecutor(NULLC_X86);
286 nullres good = nullcBuild(testGlobalOverflow);
287 assert(good);
288 good = nullcRun();
289 if(!good)
290 {
291 const char *error = "ERROR: allocated stack overflow";
292 char buf[512];
293 strcpy(buf, strstr(nullcGetLastError(), "ERROR:"));
294 if(char *lineEnd = strchr(buf, '\r'))
295 *lineEnd = 0;
296 if(strcmp(error, buf) != 0)
297 {
298 if(!Tests::messageVerbose)
299 printf("Global overflow test\r\n");
300 printf("X86 failed but for wrong reason:\r\n %s\r\nexpected:\r\n %s\r\n", buf, error);
301 }else{
302 testsPassed[1]++;
303 }
304 }else{
305 if(!Tests::messageVerbose)
306 printf("Global overflow test\r\n");
307 printf("Test should have failed.\r\n");
308 }
309 }
310 nullcSetJiTStack((void*)0x20000000, NULL, false);
311 delete[] stackMem;
312 }
313};
314Test_testGlobalOverflow test_testGlobalOverflow;
315

Callers

nothing calls this directly

Calls 9

nullcSetJiTStackFunction · 0.85
nullcSetExecutorFunction · 0.85
nullcBuildFunction · 0.85
assertFunction · 0.85
nullcRunFunction · 0.85
strstrFunction · 0.85
nullcGetLastErrorFunction · 0.85
strchrFunction · 0.85
strcmpFunction · 0.85

Tested by

no test coverage detected