From 32a22779daf5f8be9e952bdfba974a06af2644a9 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Mon, 2 Jun 2025 13:45:17 -0700 Subject: [PATCH] fix run --- .github/workflows/builds.yml | 21 +++++++++++++++++---- src/base/base_core.h | 1 - src/linker/lnk.c | 2 +- src/torture/torture.c | 25 +++++++++++++++---------- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 0c853c90..12613392 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -32,8 +32,21 @@ jobs: run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 call build ${{ matrix.target }} ${{ matrix.compiler }} ${{ matrix.mode }} || exit /b 1 - - name: run_torture - shell: cmd - if: ${{ matrix.target == 'torture' }} - run: torture -l:radlink || exit /b 1 + run-torture: + runs-on: windows-2022 + steps: + # - name: Install ASAN + # shell: cmd + # run: | + # "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --quiet --force --norestart --add Microsoft.VisualStudio.Component.VC.ASAN + - name: checkout + uses: actions/checkout@v2 + - name: run-torture + shell: cmd + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + call build radlink asan debug no_meta || exit /b 1 + call build torture debug no_meta || exit /b 1 + cd build + torture -l:radlink || exit /b 1 diff --git a/src/base/base_core.h b/src/base/base_core.h index 1db2f83f..26e08d64 100644 --- a/src/base/base_core.h +++ b/src/base/base_core.h @@ -315,7 +315,6 @@ CheckNil(nil,p) ? \ #endif #if ASAN_ENABLED -#pragma comment(lib, "clang_rt.asan-x86_64.lib") C_LINKAGE void __asan_poison_memory_region(void const volatile *addr, size_t size); C_LINKAGE void __asan_unpoison_memory_region(void const volatile *addr, size_t size); # define AsanPoisonMemoryRegion(addr, size) __asan_poison_memory_region((addr), (size)) diff --git a/src/linker/lnk.c b/src/linker/lnk.c index 17f2bbd3..78909ba3 100644 --- a/src/linker/lnk.c +++ b/src/linker/lnk.c @@ -1084,7 +1084,7 @@ lnk_section_contrib_ptr_is_before(void *raw_a, void *raw_b) if (a->u.sort_idx_size <= 1 && b->u.sort_idx_size <= 1) { if (a->u.sort_idx_size == b->u.sort_idx_size) { - cmp = cmp = u32_compar(&a->u.obj_idx, &b->u.obj_idx); + cmp = u32_compar(&a->u.obj_idx, &b->u.obj_idx); if (cmp == 0) { cmp = u32_compar(&a->u.obj_sect_idx, &b->u.obj_sect_idx); } diff --git a/src/torture/torture.c b/src/torture/torture.c index 74746b02..ac6bd47d 100644 --- a/src/torture/torture.c +++ b/src/torture/torture.c @@ -149,6 +149,10 @@ t_invoke_linker_with_time_out(U64 time_out, String8 cmdline) } } + if (g_redirect_stdout) { + os_file_close(output_redirect); + } + scratch_end(scratch); return exit_code; } @@ -191,6 +195,16 @@ t_make_file_path(Arena *arena, String8 name) return push_str8f(arena, "%S\\%S", g_wdir, name); } +internal B32 +t_write_file_list(String8 name, String8List data) +{ + Temp scratch = scratch_begin(0,0); + String8 path = t_make_file_path(scratch.arena, name); + B32 is_written = os_write_data_list_to_file_path(path, data); + scratch_end(scratch); + return is_written; +} + internal B32 t_write_file(String8 name, String8 data) { @@ -203,16 +217,6 @@ t_write_file(String8 name, String8 data) return t_write_file_list(name, temp_list); } -internal B32 -t_write_file_list(String8 name, String8List data) -{ - Temp scratch = scratch_begin(0,0); - String8 path = t_make_file_path(scratch.arena, name); - B32 is_written = os_write_data_list_to_file_path(path, data); - scratch_end(scratch); - return is_written; -} - internal String8 t_read_file(Arena *arena, String8 name) { @@ -3531,6 +3535,7 @@ entry_point(CmdLine *cmdline) fprintf(stdout, " Crashed: %llu\n", crash_count); if (fail_count + crash_count != 0) { + fflush(stdout); os_abort(fail_count + crash_count); } }