|
7 | 7 | */ |
8 | 8 | #include "test_framework.h" |
9 | 9 | #include "cbm.h" |
| 10 | +#include "foundation/platform.h" |
10 | 11 | #include "foundation/constants.h" /* CBM_SZ_* */ |
11 | 12 | #include "preprocessor.h" /* cbm_export_macro_candidates (#1989) */ |
12 | 13 | #include "../src/foundation/compat.h" /* cbm_clock_gettime (wide-flat scaling guard) */ |
@@ -13339,7 +13340,42 @@ TEST(python_namespace_facts_multiple_bindings_and_unsupported_effects) { |
13339 | 13340 | PASS(); |
13340 | 13341 | } |
13341 | 13342 |
|
| 13343 | +#ifdef _WIN32 |
| 13344 | +/* The supervisor sets this path through cbm_setenv. Exercise the actual |
| 13345 | + * journal writer, which must read it as UTF-8 before calling cbm_fopen. */ |
| 13346 | +TEST(extraction_marker_round_trips_non_ascii_environment_path) { |
| 13347 | + char dir[512] = "/tmp/cbm-marker-XXXXXX"; |
| 13348 | + ASSERT_NOT_NULL(cbm_mkdtemp(dir)); |
| 13349 | + char marker[640]; |
| 13350 | + snprintf(marker, sizeof(marker), "%s/marker-\xce\x94-\xe4\xb8\x81.log", dir); |
| 13351 | + char saved[4096]; |
| 13352 | + const char *previous = cbm_safe_getenv("CBM_INDEX_MARKER_FILE", saved, sizeof(saved), NULL); |
| 13353 | + ASSERT_EQ(cbm_setenv("CBM_INDEX_MARKER_FILE", marker, 1), 0); |
| 13354 | + cbm_index_mark_start("synthetic.cpp"); |
| 13355 | + cbm_index_mark_done("synthetic.cpp"); |
| 13356 | + if (previous) { |
| 13357 | + (void)cbm_setenv("CBM_INDEX_MARKER_FILE", saved, 1); |
| 13358 | + } else { |
| 13359 | + (void)cbm_unsetenv("CBM_INDEX_MARKER_FILE"); |
| 13360 | + } |
| 13361 | + FILE *file = cbm_fopen(marker, "rb"); |
| 13362 | + char contents[128] = {0}; |
| 13363 | + if (file) { |
| 13364 | + (void)fread(contents, 1, sizeof(contents) - 1, file); |
| 13365 | + (void)fclose(file); |
| 13366 | + } |
| 13367 | + (void)cbm_unlink(marker); |
| 13368 | + (void)cbm_rmdir(dir); |
| 13369 | + ASSERT_NOT_NULL(file); |
| 13370 | + ASSERT_STR_EQ(contents, "S synthetic.cpp\nD synthetic.cpp\n"); |
| 13371 | + PASS(); |
| 13372 | +} |
| 13373 | +#endif |
| 13374 | + |
13342 | 13375 | SUITE(extraction) { |
| 13376 | +#ifdef _WIN32 |
| 13377 | + RUN_TEST(extraction_marker_round_trips_non_ascii_environment_path); |
| 13378 | +#endif |
13343 | 13379 | RUN_TEST(extract_compact_keeps_every_field_and_shrinks_the_arena); |
13344 | 13380 | RUN_TEST(extract_compact_is_idempotent_and_survives_empty_results); |
13345 | 13381 | RUN_TEST(extract_spill_round_trip_keeps_every_field); |
|
0 commit comments