mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-08 14:58:08 +00:00
rebase fixes
normalize line endings sort test pointers rebase fixes rebase fixes
This commit is contained in:
committed by
Ryan Fleury
parent
58fc57f6a3
commit
a3bac20a73
@@ -140,7 +140,7 @@ popd
|
||||
:: --- Build Everything (@build_targets) --------------------------------------
|
||||
pushd build
|
||||
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg.exe || exit /b 1
|
||||
if "%raddbg_non_graphical%"=="1" set didbuild=1 && %compile% -DWM_STUB=1 -DWM_STUB_DEFAULT_REFRESH_RATE=60.f -DR_BACKEND=R_BACKEND_STUB ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg_non_graphical.exe || exit /b 1
|
||||
if "%raddbg_non_graphical%"=="1" set didbuild=1 && %compile% -DWM_STUB=1 -DWM_STUB_DEFAULT_REFRESH_RATE=60.f -DR_BACKEND=R_BACKEND_STUB ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg_non_graphical.exe || exit /b 1
|
||||
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %linker% /NOIMPLIB %linker% /NATVIS:"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
|
||||
if "%radbin%"=="1" set didbuild=1 && %compile% ..\src\radbin\radbin_main.c %compile_link% %out%radbin.exe || exit /b 1
|
||||
if "%raddump%"=="1" set didbuild=1 && %compile% ..\src\raddump\raddump_main.c %compile_link% %out%raddump.exe || exit /b 1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@echo on
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set TARGET_VALUES=radlink radbin mule_main mule_module torture
|
||||
|
||||
@@ -15,11 +15,11 @@ while [[ $# -gt 0 ]]; do
|
||||
torture_args=("$@")
|
||||
break
|
||||
;;
|
||||
clang|clang-*)
|
||||
clang)
|
||||
cc_values=("$1")
|
||||
shift
|
||||
;;
|
||||
gcc|gcc-*)
|
||||
gcc)
|
||||
cc_values=("$1")
|
||||
shift
|
||||
;;
|
||||
@@ -32,7 +32,7 @@ while [[ $# -gt 0 ]]; do
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 [clang|clang-*|gcc|gcc-*] [debug|release] [no_torture] [-- torture-args]"
|
||||
echo "usage: $0 [clang|gcc] [debug|release] [no_torture] [-- torture-args]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -40,9 +40,6 @@ done
|
||||
|
||||
for m in "${mode_values[@]}"; do
|
||||
for c in "${cc_values[@]}"; do
|
||||
build_cc=clang
|
||||
if [[ "$c" == gcc* ]]; then build_cc=gcc; fi
|
||||
|
||||
# nuke artifacts from last run
|
||||
rm -rf build/torture_artifacts
|
||||
rm -f build/metagen
|
||||
@@ -51,11 +48,25 @@ for m in "${mode_values[@]}"; do
|
||||
done
|
||||
|
||||
# build targets
|
||||
CC="$c" ./build.sh meta "$build_cc" "$m" "${target_values[@]}"
|
||||
./build.sh meta "$c" "$m" "${target_values[@]}"
|
||||
|
||||
# run torture from build folder
|
||||
if [[ "$run_torture" == "1" ]]; then
|
||||
(cd build && ./torture "${torture_args[@]}")
|
||||
torture_compiler_args=()
|
||||
has_clang_arg=0
|
||||
has_gcc_arg=0
|
||||
for arg in "${torture_args[@]}"; do
|
||||
case "$arg" in
|
||||
-clang:*|--clang:*) has_clang_arg=1 ;;
|
||||
-gcc:*|--gcc:*) has_gcc_arg=1 ;;
|
||||
esac
|
||||
done
|
||||
if [[ "$c" == clang && "$has_clang_arg" == "0" ]]; then
|
||||
torture_compiler_args=("-clang:$(command -v "${CC:-clang}")")
|
||||
elif [[ "$c" == gcc && "$has_gcc_arg" == "0" ]]; then
|
||||
torture_compiler_args=("-gcc:$(command -v "${CC:-gcc}")")
|
||||
fi
|
||||
(cd build && ./torture "${torture_compiler_args[@]}" "${torture_args[@]}")
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
@@ -53,12 +53,12 @@ d_init(void)
|
||||
d_ctrl_state->c2u_ring_size = KB(64);
|
||||
d_ctrl_state->c2u_ring_max_string_size = d_ctrl_state->c2u_ring_size/2;
|
||||
d_ctrl_state->c2u_ring_base = push_array_no_zero(arena, U8, d_ctrl_state->c2u_ring_size);
|
||||
d_ctrl_state->c2u_ring_mutex = mutex_alloc();
|
||||
d_ctrl_state->c2u_ring_cv = cond_var_alloc();
|
||||
{
|
||||
d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", g_logs_folder);
|
||||
write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero());
|
||||
}
|
||||
d_ctrl_state->c2u_ring_mutex = mutex_alloc();
|
||||
d_ctrl_state->c2u_ring_cv = cond_var_alloc();
|
||||
{
|
||||
d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", g_logs_folder);
|
||||
write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero());
|
||||
}
|
||||
d_ctrl_state->ctrl_thread_entity_ctx_rw_mutex = rw_mutex_alloc();
|
||||
d_ctrl_state->ctrl_thread_entity_store = d_entity_ctx_rw_store_alloc();
|
||||
d_ctrl_state->ctrl_thread_eval_cache = e_cache_alloc();
|
||||
|
||||
@@ -797,7 +797,7 @@ di_async_tick(void)
|
||||
params.path = get_process_info()->binary_path;
|
||||
params.inherit_env = 1;
|
||||
params.consoleless = 1;
|
||||
str8_list_push(scratch.arena, ¶ms.cmd_line, get_process_info()->binary_file_path);
|
||||
str8_list_push(scratch.arena, ¶ms.cmd_line, get_process_info()->binary_file_path);
|
||||
str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--bin");
|
||||
str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--quiet");
|
||||
if(should_compress)
|
||||
|
||||
+5
-2
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "base/base_inc.h"
|
||||
#include "x64/x64.h"
|
||||
#include "os/os_inc.h"
|
||||
#include "hash_table.h"
|
||||
#include "coff/coff.h"
|
||||
#include "coff/coff_parse.h"
|
||||
@@ -36,10 +35,11 @@
|
||||
#include "pdb/pdb.h"
|
||||
#include "msvc_crt/msvc_crt.h"
|
||||
#include "llvm/llvm.h"
|
||||
#include "dwarf/dwarf.h"
|
||||
#include "dwarf/x64/dwarf_x64.h"
|
||||
|
||||
#include "base/base_inc.c"
|
||||
#include "x64/x64.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "hash_table.c"
|
||||
#include "coff/coff.c"
|
||||
#include "coff/coff_parse.c"
|
||||
@@ -56,11 +56,14 @@
|
||||
#include "pdb/pdb.c"
|
||||
#include "msvc_crt/msvc_crt.c"
|
||||
#include "llvm/llvm.c"
|
||||
#include "dwarf/x64/dwarf_x64.c"
|
||||
|
||||
// --- RDI ---------------------------------------------------------------------
|
||||
|
||||
#include "rdi/rdi_local.h"
|
||||
#include "arch/arch_inc.h"
|
||||
#include "rdi/rdi_local.c"
|
||||
#include "arch/arch_inc.c"
|
||||
|
||||
// --- Code Base Extensions ----------------------------------------------------
|
||||
|
||||
|
||||
+1
-2
@@ -103,7 +103,7 @@ lnk_file_open_with_rename_permissions(String8 path)
|
||||
|
||||
scratch_end(scratch);
|
||||
#else
|
||||
# error "TODO: file rename"
|
||||
file_handle = file_open(AccessFlag_Read|AccessFlag_Write, path);
|
||||
#endif
|
||||
return file_handle;
|
||||
}
|
||||
@@ -369,4 +369,3 @@ lnk_write_data_to_file_path(String8 path, String8 temp_path, String8 data)
|
||||
lnk_write_data_list_to_file_path(path, temp_path, data_list);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
|
||||
@@ -676,7 +676,7 @@ semaphore_take(Semaphore semaphore, U64 endt_us)
|
||||
if(semaphore.u64[0] != 0)
|
||||
{
|
||||
struct timespec t = { .tv_sec = endt_us / 1000000, .tv_nsec = (endt_us % 1000000) * 1000 };
|
||||
err = OS_LNX_RETRY_ON_EINTR(sem_clockwait((sem_t*)semaphore.u64[0], CLOCK_MONOTONIC, &t));
|
||||
err = LNX_RETRY_ON_EINTR(sem_clockwait((sem_t*)semaphore.u64[0], CLOCK_MONOTONIC, &t));
|
||||
}
|
||||
return err == 0;
|
||||
}
|
||||
@@ -687,7 +687,7 @@ semaphore_drop(Semaphore semaphore)
|
||||
int err = -1;
|
||||
if(semaphore.u64[0] != 0)
|
||||
{
|
||||
err = OS_LNX_RETRY_ON_EINTR(sem_post((sem_t*)semaphore.u64[0]));
|
||||
err = LNX_RETRY_ON_EINTR(sem_post((sem_t*)semaphore.u64[0]));
|
||||
Assert(err == 0);
|
||||
}
|
||||
}
|
||||
@@ -1234,14 +1234,11 @@ process_launch(ProcessLaunchParams *params)
|
||||
// package argv
|
||||
char **argv = push_array(scratch.arena, char *, params->cmd_line.node_count + 1);
|
||||
{
|
||||
String8List l = str8_split_path(scratch.arena, params->path);
|
||||
str8_list_push(scratch.arena, &l, params->cmd_line.first->string);
|
||||
String8 path_to_exe = str8_path_list_join_by_style(scratch.arena, &l, PathStyle_SystemAbsolute);
|
||||
argv[0] = (char *)path_to_exe.str;
|
||||
argv[0] = (char *)push_cstr(scratch.arena, params->cmd_line.first->string).str;
|
||||
U64 arg_idx = 1;
|
||||
for EachNode(n, String8Node, params->cmd_line.first->next)
|
||||
{
|
||||
argv[arg_idx] = (char *)n->string.str;
|
||||
argv[arg_idx] = (char *)push_cstr(scratch.arena, n->string).str;
|
||||
arg_idx += 1;
|
||||
}
|
||||
}
|
||||
@@ -1265,7 +1262,7 @@ process_launch(ProcessLaunchParams *params)
|
||||
|
||||
// spawn process
|
||||
pid_t pid = 0;
|
||||
int spawn_code = posix_spawn(&pid, argv[0], &file_actions, &attr, argv, envp);
|
||||
int spawn_code = posix_spawnp(&pid, argv[0], &file_actions, &attr, argv, envp);
|
||||
if(spawn_code == 0)
|
||||
{
|
||||
handle.u64[0] = (U64)pid;
|
||||
@@ -1291,7 +1288,7 @@ process_join(Process process, U64 endt_us, U64 *exit_code_out)
|
||||
for(;;)
|
||||
{
|
||||
int status = 0;
|
||||
pid_t wait_result = OS_LNX_RETRY_ON_EINTR(waitpid(pid, &status, (endt_us == max_U64) ? 0 : WNOHANG));
|
||||
pid_t wait_result = LNX_RETRY_ON_EINTR(waitpid(pid, &status, (endt_us == max_U64) ? 0 : WNOHANG));
|
||||
|
||||
if((wait_result == pid) && (WIFEXITED(status) || WIFSIGNALED(status)))
|
||||
{
|
||||
|
||||
@@ -403,7 +403,7 @@ internal void
|
||||
wm_send_wakeup_event(void)
|
||||
{
|
||||
U64 dummy = 1;
|
||||
ssize_t size = OS_LNX_RETRY_ON_EINTR(write(os_lnx_gfx_state->wakeup_fd, &dummy, sizeof(dummy)));
|
||||
ssize_t size = LNX_RETRY_ON_EINTR(write(os_lnx_gfx_state->wakeup_fd, &dummy, sizeof(dummy)));
|
||||
Assert(size == sizeof(dummy));
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -686,8 +686,8 @@ mg_string_from_row_desc_idx(MD_Node *row_parent, MG_ColumnDescArray descs, U64 i
|
||||
cell_idx -= 1;
|
||||
}
|
||||
}
|
||||
MD_Node *node = md_child_from_index(row_parent, cell_idx);
|
||||
result = node->string;
|
||||
MD_Node *node = md_child_from_index(row_parent, cell_idx);
|
||||
result = node->string;
|
||||
}break;
|
||||
|
||||
case MG_ColumnKind_CheckForTag:
|
||||
@@ -828,8 +828,8 @@ mg_eval_table_expand_expr__string(Arena *arena, MG_StrExpr *expr, MG_TableExpand
|
||||
}break;
|
||||
|
||||
case MG_StrExprOp_Null:
|
||||
{
|
||||
str8_list_push(arena, out, expr->node->string);
|
||||
{
|
||||
str8_list_push(arena, out, expr->node->string);
|
||||
}break;
|
||||
|
||||
case MG_StrExprOp_Dot:
|
||||
@@ -900,14 +900,14 @@ mg_eval_table_expand_expr__string(Arena *arena, MG_StrExpr *expr, MG_TableExpand
|
||||
}
|
||||
|
||||
// rjf: push lookup string
|
||||
{
|
||||
B32 is_multiline = (str8_find_needle(lookup_string, 0, str8_lit("\n"), 0) < lookup_string.size);
|
||||
if(is_multiline)
|
||||
{
|
||||
lookup_string = indented_from_string(mg_arena, lookup_string);
|
||||
lookup_string = escaped_from_raw_str8(mg_arena, lookup_string);
|
||||
lookup_string = escaped_from_raw_str8(mg_arena, lookup_string);
|
||||
}
|
||||
{
|
||||
B32 is_multiline = (str8_find_needle(lookup_string, 0, str8_lit("\n"), 0) < lookup_string.size);
|
||||
if(is_multiline)
|
||||
{
|
||||
lookup_string = indented_from_string(mg_arena, lookup_string);
|
||||
lookup_string = escaped_from_raw_str8(mg_arena, lookup_string);
|
||||
lookup_string = escaped_from_raw_str8(mg_arena, lookup_string);
|
||||
}
|
||||
str8_list_push(arena, out, lookup_string);
|
||||
}
|
||||
}break;
|
||||
@@ -1017,10 +1017,10 @@ mg_loop_table_column_expansion(Arena *arena, String8 strexpr, MG_TableExpandInfo
|
||||
char_idx += 1;
|
||||
}
|
||||
}
|
||||
String8 expansion_str = str8_list_join(arena, &expansion_strs, 0);
|
||||
String8 expansion_str = str8_list_join(arena, &expansion_strs, 0);
|
||||
if(expansion_str.size != 0)
|
||||
{
|
||||
expansion_str = raw_from_escaped_str8(mg_arena, expansion_str);
|
||||
{
|
||||
expansion_str = raw_from_escaped_str8(mg_arena, expansion_str);
|
||||
str8_list_push(arena, out, expansion_str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -10591,13 +10591,13 @@ rd_init(CmdLine *cmdln)
|
||||
rd_state->frame_arenas[idx] = arena_alloc();
|
||||
}
|
||||
rd_state->log = log_alloc();
|
||||
log_select(rd_state->log);
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", g_logs_folder);
|
||||
write_data_to_file_path(rd_state->log_path, str8_zero());
|
||||
scratch_end(scratch);
|
||||
}
|
||||
log_select(rd_state->log);
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", g_logs_folder);
|
||||
write_data_to_file_path(rd_state->log_path, str8_zero());
|
||||
scratch_end(scratch);
|
||||
}
|
||||
rd_state->num_frames_requested = 2;
|
||||
rd_state->seconds_until_autosave = 0.5f;
|
||||
rd_state->eval_cache = e_cache_alloc();
|
||||
|
||||
@@ -11,7 +11,7 @@ r_init(CmdLine *cmdln)
|
||||
//- rjf: window setup/teardown
|
||||
|
||||
r_hook R_Handle
|
||||
r_window_equip(OS_Handle window)
|
||||
r_window_equip(WM_Window window)
|
||||
{
|
||||
R_Handle handle = {0};
|
||||
handle.u64[0] = 1;
|
||||
@@ -19,7 +19,7 @@ r_window_equip(OS_Handle window)
|
||||
}
|
||||
|
||||
r_hook void
|
||||
r_window_unequip(OS_Handle window, R_Handle window_equip)
|
||||
r_window_unequip(WM_Window window, R_Handle window_equip)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -89,18 +89,18 @@ r_end_frame(void)
|
||||
}
|
||||
|
||||
r_hook void
|
||||
r_window_begin_frame(OS_Handle window, R_Handle window_equip)
|
||||
r_window_begin_frame(WM_Window window, R_Handle window_equip)
|
||||
{
|
||||
}
|
||||
|
||||
r_hook void
|
||||
r_window_end_frame(OS_Handle window, R_Handle window_equip)
|
||||
r_window_end_frame(WM_Window window, R_Handle window_equip)
|
||||
{
|
||||
}
|
||||
|
||||
//- rjf: render pass submission
|
||||
|
||||
r_hook void
|
||||
r_window_submit(OS_Handle window, R_Handle window_equip, R_PassList *passes)
|
||||
r_window_submit(WM_Window window, R_Handle window_equip, R_PassList *passes)
|
||||
{
|
||||
}
|
||||
|
||||
+43
-27
@@ -11,8 +11,9 @@ global B32 g_stop_on_first_fail_or_crash = 1;
|
||||
global String8 g_test_data;
|
||||
|
||||
// tests
|
||||
U64 g_torture_test_count;
|
||||
T_Test g_torture_tests[0xffffff];
|
||||
U64 g_torture_test_count;
|
||||
T_Test **g_torture_tests;
|
||||
T_Test g_torture_tests_[0xffffff];
|
||||
|
||||
// invoke
|
||||
global U64 g_last_exit_code;
|
||||
@@ -31,7 +32,7 @@ global String8 g_linker_path;
|
||||
internal String8
|
||||
t_test_name_from_idx(Arena *arena, U64 test_idx)
|
||||
{
|
||||
return str8f(arena, "%s::%s", g_torture_tests[test_idx].group, g_torture_tests[test_idx].label);
|
||||
return str8f(arena, "%s::%s", g_torture_tests[test_idx]->group, g_torture_tests[test_idx]->label);
|
||||
}
|
||||
|
||||
internal char *
|
||||
@@ -723,7 +724,7 @@ t_invoke_env(String8 exe_path, String8 cmdline, String8List env, U64 timeout_us)
|
||||
read_buffer = push_array(scratch.arena, U8, read_buffer_default_size);
|
||||
}
|
||||
|
||||
ssize_t read_size = OS_LNX_RETRY_ON_EINTR(read(captures_linux[i].poll_fd->fd, read_buffer, read_buffer_size));
|
||||
ssize_t read_size = LNX_RETRY_ON_EINTR(read(captures_linux[i].poll_fd->fd, read_buffer, read_buffer_size));
|
||||
if (read_size > 0) {
|
||||
str8_list_push(scratch.arena, captures_linux[i].parts, str8(read_buffer, read_size));
|
||||
read_buffer += read_size;
|
||||
@@ -891,12 +892,18 @@ t_test_compar(const void *raw_a, const void *raw_b)
|
||||
return cmp;
|
||||
}
|
||||
|
||||
internal int
|
||||
force_inline int
|
||||
t_test_is_before(void *raw_a, void *raw_b)
|
||||
{
|
||||
return t_test_compar(raw_a, raw_b) < 0;
|
||||
}
|
||||
|
||||
force_inline int
|
||||
t_test_ptr_is_before(void *raw_a, void *raw_b)
|
||||
{
|
||||
return t_test_compar(*((T_Test * const *)raw_a), *((T_Test * const *)raw_b)) < 0;
|
||||
}
|
||||
|
||||
internal String8List
|
||||
t_file_paths_from_dir(Arena *arena, String8 dir)
|
||||
{
|
||||
@@ -1018,9 +1025,19 @@ t_entry_point(CmdLine *cmdline)
|
||||
abort_self(0);
|
||||
}
|
||||
}
|
||||
// register debugger tests
|
||||
String8 test_folder_path = str8f(scratch.arena, "%S/torture/dbg_tests", t_src_path());
|
||||
t_dbg_register_script_tests(scratch.arena, test_folder_path);
|
||||
|
||||
// Gather tests
|
||||
{
|
||||
// register debugger tests
|
||||
String8 test_folder_path = str8f(scratch.arena, "%S/torture/dbg_tests", t_src_path());
|
||||
t_dbg_register_script_tests(scratch.arena, test_folder_path);
|
||||
|
||||
// sort tests
|
||||
g_torture_tests = push_array(scratch.arena, T_Test *, g_torture_test_count);
|
||||
for EachIndex(i, g_torture_test_count) { g_torture_tests[i] = &g_torture_tests_[i]; }
|
||||
radsort(g_torture_tests, g_torture_test_count, t_test_ptr_is_before);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle -list
|
||||
//
|
||||
@@ -1028,7 +1045,7 @@ t_entry_point(CmdLine *cmdline)
|
||||
if (cmd_line_has_flag(cmdline, str8_lit("list"))) {
|
||||
PrintHeader("Tests");
|
||||
for EachIndex(i, g_torture_test_count) {
|
||||
fprintf(stdout, " %s\n", g_torture_tests[i].label);
|
||||
fprintf(stdout, " %s\n", g_torture_tests[i]->label);
|
||||
}
|
||||
abort_self(0);
|
||||
}
|
||||
@@ -1073,14 +1090,14 @@ t_entry_point(CmdLine *cmdline)
|
||||
for EachNode(pattern_n, String8Node, targets.first) {
|
||||
B32 do_namespace = str8_find_needle(pattern_n->string, 0, str8_lit("::"), 0) < pattern_n->string.size;
|
||||
for EachIndex(test_idx, g_torture_test_count) {
|
||||
String8 name = str8_cstring(g_torture_tests[test_idx].label);
|
||||
String8 name = str8_cstring(g_torture_tests[test_idx]->label);
|
||||
if (do_namespace) {
|
||||
name = t_test_name_from_idx(scratch.arena, test_idx);
|
||||
}
|
||||
if (str8_match_wildcard(name, pattern_n->string, 0)) {
|
||||
if ( ! hash_table_search_string(ht, name)) {
|
||||
hash_table_push_string_raw(scratch.arena, ht, name, 0);
|
||||
str8_list_push(scratch.arena, &target, str8_cstring(g_torture_tests[test_idx].label));
|
||||
str8_list_push(scratch.arena, &target, str8_cstring(g_torture_tests[test_idx]->label));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1149,9 +1166,7 @@ t_entry_point(CmdLine *cmdline)
|
||||
//
|
||||
// Run tests
|
||||
//
|
||||
{
|
||||
radsort(g_torture_tests, g_torture_test_count, t_test_is_before);
|
||||
|
||||
{
|
||||
U64List target_indices_list = {0};
|
||||
if (target.node_count == 0) {
|
||||
for EachIndex(i, g_torture_test_count) { u64_list_push(scratch.arena, &target_indices_list, i); }
|
||||
@@ -1159,7 +1174,7 @@ t_entry_point(CmdLine *cmdline)
|
||||
for EachNode(target_n, String8Node, target.first) {
|
||||
B32 is_target_unknown = 1;
|
||||
for EachIndex(i, g_torture_test_count) {
|
||||
if (str8_match(str8_cstring(g_torture_tests[i].label), target_n->string, 0)) {
|
||||
if (str8_match(str8_cstring(g_torture_tests[i]->label), target_n->string, 0)) {
|
||||
u64_list_push(scratch.arena, &target_indices_list, i);
|
||||
is_target_unknown = 0;
|
||||
break;
|
||||
@@ -1201,8 +1216,8 @@ t_entry_point(CmdLine *cmdline)
|
||||
U64 max_group_size = 0;
|
||||
for EachIndex(i, target_indices.count) {
|
||||
U64 test_idx = target_indices.v[i];
|
||||
max_label_size = Max(max_label_size, cstring8_length((U8*)g_torture_tests[test_idx].label));
|
||||
max_group_size = Max(max_group_size, cstring8_length((U8*)g_torture_tests[test_idx].group));
|
||||
max_label_size = Max(max_label_size, cstring8_length((U8*)g_torture_tests[test_idx]->label));
|
||||
max_group_size = Max(max_group_size, cstring8_length((U8*)g_torture_tests[test_idx]->group));
|
||||
}
|
||||
|
||||
PrintHeader("Tests");
|
||||
@@ -1216,19 +1231,20 @@ t_entry_point(CmdLine *cmdline)
|
||||
for EachElement(i, slowest) { slowest[i].target_idx = max_U64; }
|
||||
for EachIndex(i, target_indices.count) {
|
||||
U64 target_idx = target_indices.v[i];
|
||||
T_Test *test = g_torture_tests[target_idx];
|
||||
|
||||
// print run progress
|
||||
U64 dots_min = 10;
|
||||
U64 dots_count = (max_label_size - cstring8_length((U8*)g_torture_tests[target_idx].label)) + dots_min;
|
||||
U64 dots_count = (max_label_size - cstring8_length((U8*)test->label)) + dots_min;
|
||||
U64 curr_digit_count = count_digits_u64(i+1, 10);
|
||||
int idx_align_space_count = (int)(max_digit_count - curr_digit_count);
|
||||
fprintf(stdout, "[%.*s%llu/%llu] ", idx_align_space_count, spaces, (unsigned long long)i+1, (unsigned long long)target_indices.count);
|
||||
fprintf(stdout, "%s %.*s:: %s", g_torture_tests[target_idx].group, (int)(max_group_size - cstring8_length((U8*)g_torture_tests[target_idx].group)), spaces, g_torture_tests[target_idx].label);
|
||||
fprintf(stdout, "%s %.*s:: %s", test->group, (int)(max_group_size - cstring8_length((U8*)test->group)), spaces, test->label);
|
||||
fprintf(stdout, " %.*s ", (int)dots_count, dots);
|
||||
fflush(stdout);
|
||||
|
||||
// setup output directory
|
||||
g_wdir = push_str8f(scratch.arena, "%S/%s", g_out, g_torture_tests[target_idx].label);
|
||||
g_wdir = push_str8f(scratch.arena, "%S/%s", g_out, test->label);
|
||||
g_wdir = full_path_from_path(scratch.arena, g_wdir);
|
||||
|
||||
// delete files from last run in the work directory
|
||||
@@ -1244,7 +1260,7 @@ t_entry_point(CmdLine *cmdline)
|
||||
|
||||
// run test
|
||||
U64 run_start_time = now_time_us();
|
||||
T_RunResult result = t_run(g_torture_tests[target_idx].r, g_torture_tests[target_idx].user_data);
|
||||
T_RunResult result = t_run(test->r, test->user_data);
|
||||
U64 run_end_time = now_time_us();
|
||||
// print result
|
||||
if (result.status == T_RunStatus_Pass) {
|
||||
@@ -1309,8 +1325,8 @@ t_entry_point(CmdLine *cmdline)
|
||||
for EachElement(i, slowest) {
|
||||
Slowest s = slowest[i];
|
||||
if (s.target_idx >= g_torture_test_count) { break; }
|
||||
label_max = Max(strlen(g_torture_tests[s.target_idx].label), label_max);
|
||||
group_max = Max(strlen(g_torture_tests[s.target_idx].group), group_max);
|
||||
label_max = Max(strlen(g_torture_tests[s.target_idx]->label), label_max);
|
||||
group_max = Max(strlen(g_torture_tests[s.target_idx]->group), group_max);
|
||||
}
|
||||
|
||||
for EachElement(i, slowest) {
|
||||
@@ -1318,10 +1334,10 @@ t_entry_point(CmdLine *cmdline)
|
||||
if (s.target_idx >= g_torture_test_count) { break; }
|
||||
String8 elapsed_time = string_from_elapsed_time(scratch.arena, date_time_from_micro_seconds(s.d));
|
||||
fprintf(stderr, " %s %.*s:: %s %.*s %.*s\n",
|
||||
g_torture_tests[s.target_idx].group,
|
||||
(int)(group_max - strlen(g_torture_tests[s.target_idx].group)), spaces,
|
||||
g_torture_tests[s.target_idx].label,
|
||||
(int)(label_max - strlen(g_torture_tests[s.target_idx].label)) + 4, dots,
|
||||
g_torture_tests[s.target_idx]->group,
|
||||
(int)(group_max - strlen(g_torture_tests[s.target_idx]->group)), spaces,
|
||||
g_torture_tests[s.target_idx]->label,
|
||||
(int)(label_max - strlen(g_torture_tests[s.target_idx]->label)) + 4, dots,
|
||||
str8_varg(elapsed_time));
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ typedef enum
|
||||
T_Linker_LLVM
|
||||
} T_Linker;
|
||||
|
||||
extern U64 g_torture_test_count;
|
||||
extern T_Test g_torture_tests[0xffffff];
|
||||
extern U64 g_torture_running_test_idx;
|
||||
extern U64 g_torture_test_count;
|
||||
extern T_Test **g_torture_tests;
|
||||
extern T_Test g_torture_tests_[0xffffff];
|
||||
|
||||
internal void t_break_if_debugger_present(void);
|
||||
|
||||
@@ -65,7 +65,7 @@ internal void t_break_if_debugger_present(void);
|
||||
T_RunSig(name); \
|
||||
__VA_ARGS__ void t_add_test_##name(void) \
|
||||
{ \
|
||||
g_torture_tests[g_torture_test_count++] = (T_Test){ .group = T_Group, .label = Stringify(name), .r = &t_##name, .decl_line = l }; \
|
||||
g_torture_tests_[g_torture_test_count++] = (T_Test){ .group = T_Group, .label = Stringify(name), .r = &t_##name, .decl_line = l }; \
|
||||
}
|
||||
|
||||
#if COMPILER_MSVC
|
||||
@@ -97,7 +97,7 @@ internal void t_break_if_debugger_present(void);
|
||||
#define TIMEOUT_MS(x) TIMEOUT_US((x)*1000ull)
|
||||
#define TIMEOUT_SEC(x) TIMEOUT_MS((x)*1000ull)
|
||||
|
||||
#define ENDT_US(x) (os_now_microseconds() + (x))
|
||||
#define ENDT_US(x) (now_time_us() + (x))
|
||||
#define ENDT_MS(x) TIMEOUT_US((x)*1000ull)
|
||||
#define ENDT_SEC(x) TIMEOUT_MS((x)*1000ull)
|
||||
|
||||
@@ -132,4 +132,3 @@ internal void t_kill_all(String8 pattern);
|
||||
#define t_invoke_linker_timeout(c, t) T_Ok(t_invoke(t_radlink_path(), c, t))
|
||||
#define t_invoke_linker_timeoutf(t, f, ...) t_invoke_linker_timeout(push_str8f(arena, f, ##__VA_ARGS__), t)
|
||||
#define t_invoke_linker(c) t_invoke_linker_timeout(c, max_U64)
|
||||
|
||||
|
||||
+13
-13
@@ -212,8 +212,8 @@ t_dbg_send_cmd_and_wait_stop(String8 cmd, U64 timeout_us)
|
||||
}
|
||||
|
||||
// "solve" the wait problem
|
||||
if (os_now_microseconds() >= t) { Assert(0 && "timeout"); goto exit; }
|
||||
os_sleep_milliseconds(10);
|
||||
if (now_time_us() >= t) { Assert(0 && "timeout"); goto exit; }
|
||||
sleep_ms(10);
|
||||
}
|
||||
|
||||
//--- Status ---------------------
|
||||
@@ -271,14 +271,14 @@ t_dbg_launch(String8 cmdline, U64 timeout_us)
|
||||
cmdline = str8f(scratch.arena, "%S --gen_crash_dump --user:\"%S\" --project:\"%S\" --logs:\"%S\" %S", t_raddbg_path(), user_path, project_path, g_wdir, cmdline);
|
||||
|
||||
// launch debugger
|
||||
OS_ProcessLaunchParams launch_opts = {
|
||||
ProcessLaunchParams launch_opts = {
|
||||
.path = g_wdir,
|
||||
.inherit_env = 1,
|
||||
.consoleless = 1,
|
||||
.cmd_line = lnk_arg_list_parse_windows_rules(scratch.arena, cmdline),
|
||||
};
|
||||
OS_Handle dbg_handle = os_process_launch(&launch_opts);
|
||||
if (os_handle_match(dbg_handle, os_handle_zero())) { AssertAlways(0 && "failed to launch debugger"); goto exit; }
|
||||
Process dbg_handle = process_launch(&launch_opts);
|
||||
if (process_match(dbg_handle, process_zero())) { AssertAlways(0 && "failed to launch debugger"); goto exit; }
|
||||
|
||||
#if OS_WINDOWS
|
||||
// cache debugger PID
|
||||
@@ -290,7 +290,7 @@ t_dbg_launch(String8 cmdline, U64 timeout_us)
|
||||
#endif
|
||||
|
||||
// close debugger handle
|
||||
os_process_join(dbg_handle, 0, 0);
|
||||
process_detach(dbg_handle);
|
||||
|
||||
// now wait for debugger to init
|
||||
U64 t = ENDT_US(timeout_us);
|
||||
@@ -300,8 +300,8 @@ t_dbg_launch(String8 cmdline, U64 timeout_us)
|
||||
if (dbg_ready) { break; }
|
||||
|
||||
// "solve" the wait problem
|
||||
if (os_now_microseconds() >= t) { Assert(0 && "timeout"); break; }
|
||||
os_sleep_milliseconds(10);
|
||||
if (now_time_us() >= t) { Assert(0 && "timeout"); break; }
|
||||
sleep_ms(10);
|
||||
}
|
||||
|
||||
exit:;
|
||||
@@ -644,13 +644,13 @@ t_dbg_script_invoke(T_DbgScript *script, U64 timeout_us)
|
||||
internal
|
||||
T_RunSig(dbg_script_runner)
|
||||
{
|
||||
if ( ! os_file_path_exists(t_raddbg_path())) {
|
||||
if ( ! file_path_exists(t_raddbg_path())) {
|
||||
fprintf(stderr, "ERROR: failed to find debugger \"%.*s\"\n", str8_varg(t_raddbg_path()));
|
||||
T_Ok(0);
|
||||
}
|
||||
|
||||
// read source file
|
||||
String8 source = os_data_from_file_path(arena, user_data);
|
||||
String8 source = data_from_file_path(arena, user_data);
|
||||
if (source.size == 0) {
|
||||
fprintf(stderr, "ERROR: failed to read script: \"%.*s\"\n", str8_varg(user_data));
|
||||
T_Ok(0);
|
||||
@@ -661,7 +661,7 @@ T_RunSig(dbg_script_runner)
|
||||
|
||||
// write source files to test folder
|
||||
for EachNode(file, T_DbgScriptFile, script.files.first) {
|
||||
if (os_write_data_to_file_path(file->path, file->source) == 0) {
|
||||
if (write_data_to_file_path(file->path, file->source) == 0) {
|
||||
fprintf(stderr, "ERROR: %.*s:%llu: failed to write: \"%.*s\"\n", str8_varg(user_data), (unsigned long long)file->line, str8_varg(file->path));
|
||||
T_Ok(0);
|
||||
}
|
||||
@@ -750,7 +750,7 @@ t_dbg_register_script_tests(Arena *arena, String8 folder_path)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
if ( ! os_folder_path_exists(folder_path)) {
|
||||
if ( ! folder_path_exists(folder_path)) {
|
||||
fprintf(stderr, "ERROR: this folder does not exists: %.*s\n", str8_varg(folder_path));
|
||||
return;
|
||||
}
|
||||
@@ -766,7 +766,7 @@ t_dbg_register_script_tests(Arena *arena, String8 folder_path)
|
||||
String8List file_name_parts = str8_split_by_string_chars(scratch.arena, str8_skip_last_slash(file_path), str8_lit("."), 0);
|
||||
String8 file_name_escaped = str8_list_join(arena, &file_name_parts, &(StringJoin){.sep=str8_lit("-"), .post = str8_lit("\0") });
|
||||
|
||||
g_torture_tests[g_torture_test_count++] = (T_Test){
|
||||
g_torture_tests_[g_torture_test_count++] = (T_Test){
|
||||
.group = T_Group,
|
||||
.label = (char*)file_name_escaped.str,
|
||||
.r = t_dbg_script_runner,
|
||||
|
||||
Reference in New Issue
Block a user