Run cbm_extract_file in a forked child; true if the child died by signal. * Mirrors tests/test_lang_contract.c. On Windows run in-process (a genuine * crash there aborts the runner — hard, visible failure). */
| 413 | * Mirrors tests/test_lang_contract.c. On Windows run in-process (a genuine |
| 414 | * crash there aborts the runner — hard, visible failure). */ |
| 415 | static bool so_extract_crashes(const char *content, CBMLanguage lang, const char *relpath) { |
| 416 | #if defined(_WIN32) |
| 417 | CBMFileResult *r = |
| 418 | cbm_extract_file(content, (int)strlen(content), lang, "so", relpath, 0, NULL, NULL); |
| 419 | if (r) { |
| 420 | cbm_free_result(r); |
| 421 | } |
| 422 | return false; |
| 423 | #else |
| 424 | fflush(NULL); |
| 425 | pid_t pid = fork(); |
| 426 | if (pid < 0) { |
| 427 | return false; |
| 428 | } |
| 429 | if (pid == 0) { |
| 430 | CBMFileResult *r = |
| 431 | cbm_extract_file(content, (int)strlen(content), lang, "so", relpath, 0, NULL, NULL); |
| 432 | if (r) { |
| 433 | cbm_free_result(r); |
| 434 | } |
| 435 | _exit(0); |
| 436 | } |
| 437 | int status = 0; |
| 438 | (void)waitpid(pid, &status, 0); |
| 439 | return WIFSIGNALED(status); |
| 440 | #endif |
| 441 | } |
| 442 | |
| 443 | TEST(lsp_java_deep_nesting_no_crash) { |
| 444 | /* Deeply nested call expressions — the same shape as the elasticsearch |
no test coverage detected