diff --git a/src/torture/torture.c b/src/torture/torture.c index 7bae4739..6edc083a 100644 --- a/src/torture/torture.c +++ b/src/torture/torture.c @@ -60,6 +60,16 @@ t_read_file(Arena *arena, String8 name) return data; } +internal B32 +t_delete_file(String8 name) +{ + Temp scratch = scratch_begin(0,0); + String8 path = t_make_file_path(scratch.arena, name); + B32 is_deleted = os_delete_file_at_path(path); + scratch_end(scratch); + return is_deleted; +} + internal String8 t_make_file_path(Arena *arena, String8 name) { diff --git a/src/torture/torture.h b/src/torture/torture.h index 7a1638f6..2c5b5a89 100644 --- a/src/torture/torture.h +++ b/src/torture/torture.h @@ -83,6 +83,7 @@ return result_; \ internal B32 t_write_file_list(String8 name, String8List data); internal B32 t_write_file(String8 name, String8 data); internal String8 t_read_file(Arena *arena, String8 name); +internal B32 t_delete_file(String8 name); internal String8 t_make_file_path(Arena *arena, String8 name); // test runner diff --git a/src/torture/torture_radlink.c b/src/torture/torture_radlink.c index 90df9e12..b3f8506d 100644 --- a/src/torture/torture_radlink.c +++ b/src/torture/torture_radlink.c @@ -4758,6 +4758,36 @@ T_BeginTest(patch_cv_symbol_tree) } T_EndTest; +#if 0 +T_BeginTest(pdb_determ_test) +{ + T_Ok(os_copy_file_path(t_make_file_path(scratch.arena, str8_lit("torture_main.obj")), str8_lit("torture_main.obj"))); + + t_delete_file(str8_lit("a.pdb")); + t_delete_file(str8_lit("b.pdb")); + + String8 refs_path = t_make_file_path(scratch.arena, str8_lit("b.types")); + t_invoke_linkerf("torture_main.obj /debug:full /rad_time_stamp:0 /rad_workers:1 /rad_store_types:%S /out:a.exe", refs_path); + T_Ok(g_last_exit_code == 0); + T_Ok(os_move_file_path(t_make_file_path(scratch.arena, str8_lit("b.pdb")), t_make_file_path(scratch.arena, str8_lit("a.pdb")))); + String8 b = t_read_file(scratch.arena, str8_lit("b.pdb")); + + for EachIndex(i, 50) { + Temp temp = temp_begin(scratch.arena); + + t_delete_file(str8_lit("a.pdb")); + t_invoke_linkerf("torture_main.obj /debug:full /rad_time_stamp:0 /out:a.exe"); + T_Ok(g_last_exit_code == 0); + + String8 a = t_read_file(temp.arena, str8_lit("a.pdb")); + T_Ok(str8_match(a, b, 0)); + + temp_end(temp); + } +} +T_EndTest; +#endif + #if 0 T_BeginTest(fold_two_funcs)