mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 09:18:09 +00:00
test EXE and PDB determinism
This commit is contained in:
@@ -155,6 +155,22 @@ t_radlink_path(void)
|
||||
return path;
|
||||
}
|
||||
|
||||
internal String8
|
||||
t_src_path(void)
|
||||
{
|
||||
local_persist U8 path[4096] = {0};
|
||||
if (path[0] == 0) {
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 cwd = os_get_current_path(scratch.arena);
|
||||
cwd = str8_chop_last_slash(cwd);
|
||||
cwd = str8f(scratch.arena, "%S/src", cwd);
|
||||
MemoryCopyStr8(path, cwd);
|
||||
path[cwd.size] = 0;
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return str8_cstring_capped(path, path+sizeof(path));
|
||||
}
|
||||
|
||||
internal B32
|
||||
t_invoke_(String8 exe_path, String8 cmdline, U64 timeout, Arena *output_arena, String8 *output_out)
|
||||
{
|
||||
|
||||
@@ -94,7 +94,9 @@ internal T_RunResult t_run(T_Run run);
|
||||
internal String8 t_radbin_path(void);
|
||||
internal String8 t_cl_path(void);
|
||||
internal String8 t_radlink_path(void);
|
||||
internal String8 t_src_path(void);
|
||||
|
||||
internal B32 t_invoke(String8 exe, String8 cmdline, U64 timeout);
|
||||
|
||||
#define t_invoke_cl(f, ...) t_invoke_(t_cl_path(), str8f(scratch.arena, f, ## __VA_ARGS__), max_U64, 0, 0)
|
||||
|
||||
|
||||
@@ -4923,31 +4923,40 @@ T_BeginTest(infer_asan)
|
||||
T_EndTest;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#if OS_WINDOWS
|
||||
T_BeginTest(determ_test)
|
||||
{
|
||||
T_Ok(os_copy_file_path(t_make_file_path(scratch.arena, str8_lit("torture_main.obj")), str8_lit("torture_main.obj")));
|
||||
// compile the test target (torture)
|
||||
String8 cl_line = str8f(scratch.arena, "/fsanitize=address /c /Z7 /Fo:test.obj -I%S /Zc:preprocessor %S/torture/torture_main.c", t_src_path(), t_src_path());
|
||||
String8 cl_out = {0};
|
||||
t_invoke_(t_cl_path(), cl_line, max_U64, scratch.arena, &cl_out);
|
||||
T_Ok(g_last_exit_code == 0);
|
||||
|
||||
// clean up
|
||||
t_delete_file(str8_lit("a.exe"));
|
||||
t_delete_file(str8_lit("b.exe"));
|
||||
t_delete_file(str8_lit("a.pdb"));
|
||||
t_delete_file(str8_lit("b.pdb"));
|
||||
|
||||
// single-threaded link
|
||||
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_invoke_linkerf("test.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);
|
||||
|
||||
// rename a -> b
|
||||
T_Ok(os_move_file_path(t_make_file_path(scratch.arena, str8_lit("b.exe")), t_make_file_path(scratch.arena, str8_lit("a.exe"))));
|
||||
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"))));
|
||||
|
||||
// read b
|
||||
String8 b_exe = t_read_file(scratch.arena, str8_lit("b.exe"));
|
||||
String8 b_pdb = t_read_file(scratch.arena, str8_lit("b.pdb"));
|
||||
|
||||
// multi-threaded links
|
||||
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_invoke_linkerf("test.obj /debug:full /rad_time_stamp:0 /out:a.exe");
|
||||
T_Ok(g_last_exit_code == 0);
|
||||
|
||||
String8 a_exe = t_read_file(temp.arena, str8_lit("a.exe"));
|
||||
|
||||
Reference in New Issue
Block a user