| 275 | struct 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 | }; |
| 314 | Test_testGlobalOverflow test_testGlobalOverflow; |
| 315 |
nothing calls this directly
no test coverage detected