Skip to content

Commit 3ab2994

Browse files
committed
test: preserve LF in Windows build config output
Signed-off-by: astandrik <astandrik@yandex-team.ru>
1 parent eccc615 commit 3ab2994

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

‎tests/test_main.c‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -921,17 +921,6 @@ extern void suite_dump_verify_io(void);
921921
extern void cbm_kind_in_set_free_cache(void);
922922

923923
int main(int argc, char **argv) {
924-
/* Skip the multi-hundred-MB executable-image hash that computes the exact
925-
* build fingerprint: it is tens of seconds per spawned worker/daemon under
926-
* ASan on constrained CI runners and the sole cause of the daemon-family
927-
* readiness-timeout flakes. Set once here; every forked child and re-exec'd
928-
* worker inherits it, so exact-build match/mismatch still works (a
929-
* mismatch test still passes a DIFFERENT fingerprint via argv). Honoured
930-
* only under CBM_CLI_ENABLE_TEST_API — never in a production binary. */
931-
if (!getenv("CBM_TEST_BUILD_FINGERPRINT")) {
932-
(void)cbm_setenv("CBM_TEST_BUILD_FINGERPRINT",
933-
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", 1);
934-
}
935924
int memory_limit_probe_rc = tf_maybe_run_windows_memory_limit_probe(argc, argv);
936925
if (memory_limit_probe_rc >= 0) {
937926
return memory_limit_probe_rc;
@@ -947,6 +936,12 @@ int main(int argc, char **argv) {
947936
return 0;
948937
}
949938
if (argc == 2 && strcmp(argv[1], "--build-config") == 0) {
939+
#ifdef _WIN32
940+
if (_setmode(cbm_fileno(stdout), _O_BINARY) == -1) {
941+
fprintf(stderr, "failed to set build-config stdout to binary mode\n");
942+
return 2;
943+
}
944+
#endif
950945
#if defined(CBM_ENABLE_TEST_SEAMS) && CBM_ENABLE_TEST_SEAMS
951946
const int test_seams = 1;
952947
#else
@@ -955,6 +950,17 @@ int main(int argc, char **argv) {
955950
(void)printf("sanitized=%d test_seams=%d\n", CBM_SANITIZED, test_seams);
956951
return 0;
957952
}
953+
/* Skip the multi-hundred-MB executable-image hash that computes the exact
954+
* build fingerprint: it is tens of seconds per spawned worker/daemon under
955+
* ASan on constrained CI runners and the sole cause of the daemon-family
956+
* readiness-timeout flakes. Set once here; every forked child and re-exec'd
957+
* worker inherits it, so exact-build match/mismatch still works (a
958+
* mismatch test still passes a DIFFERENT fingerprint via argv). Honoured
959+
* only under CBM_CLI_ENABLE_TEST_API — never in a production binary. */
960+
if (!getenv("CBM_TEST_BUILD_FINGERPRINT")) {
961+
(void)cbm_setenv("CBM_TEST_BUILD_FINGERPRINT",
962+
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", 1);
963+
}
958964
/* #1830 userns smoke probe -- see the test that spawns it.
959965
*
960966
* The ancestor overflow uid is derived ONCE per process (pthread_once in

0 commit comments

Comments
 (0)