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

Method Run

tests/TestRuntimeFail.cpp:219–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217struct Test_testDepthOverflow : TestQueue
218{
219 virtual void Run()
220 {
221 char *stackMem = new char[32*1024];
222 nullcSetJiTStack(stackMem, stackMem + 32*1024, true);
223 if(Tests::messageVerbose)
224 printf("Call depth test\r\n");
225 {
226 testsCount[1]++;
227 nullcSetExecutor(NULLC_X86);
228 nullres good = nullcBuild(testDepthOverflow);
229 assert(good);
230 good = nullcRun();
231 if(!good)
232 {
233 const char *error = "ERROR: allocated stack overflow";
234 char buf[512];
235 strcpy(buf, strstr(nullcGetLastError(), "ERROR:"));
236 if(char *lineEnd = strchr(buf, '\r'))
237 *lineEnd = 0;
238 if(strcmp(error, buf) != 0)
239 {
240 if(!Tests::messageVerbose)
241 printf("Call depth test\r\n");
242 printf("X86 failed but for wrong reason:\r\n %s\r\nexpected:\r\n %s\r\n", buf, error);
243 }else{
244 testsPassed[1]++;
245 }
246 }else{
247 if(!Tests::messageVerbose)
248 printf("Call depth test\r\n");
249 printf("Test should have failed.\r\n");
250 }
251 }
252 nullcSetJiTStack((void*)0x20000000, NULL, false);
253 delete[] stackMem;
254 }
255};
256Test_testDepthOverflow test_testDepthOverflow;
257

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