run tests on Linux

This commit is contained in:
Nikita Smith
2026-06-02 12:10:18 -07:00
committed by Ryan Fleury
parent e92947057d
commit ffe18834dd
4 changed files with 39 additions and 7 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
set -eu
cd "$(dirname "$0")"
# compile our targets
./build.sh raddbg raddbg_non_graphical radlink radbin torture
# run torture
cd build
./torture
cd ..
+9 -5
View File
@@ -167,12 +167,10 @@ t_run_caller(void *raw_ctx)
fprintf(stderr, "%.*s", str8_varg(n->string));
}
if (g_errors.size) {
fprintf(stderr, "--- STDERR ---------------------------------------------------------------------\n");
fprintf(stderr, "%.*s\n", str8_varg(g_errors));
fprintf(stderr, "stderr: \"%.*s\"\n", str8_varg(g_errors));
}
if (g_output.size) {
fprintf(stderr, "--- STDOUT ---------------------------------------------------------------------\n");
fprintf(stderr, "%.*s\n", str8_varg(g_output));
fprintf(stderr, "stdout: \"%.*s\"\n", str8_varg(g_output));
}
}
scratch_end(scratch);
@@ -355,6 +353,7 @@ t_cwd_path(void)
} else {
cwd = str8_chop_last_slash(cwd);
}
MemoryCopyStr8(path, cwd);
path[cwd.size] = 0;
scratch_end(scratch);
@@ -1325,7 +1324,12 @@ t_entry_point(CmdLine *cmdline)
(int)(label_max - strlen(g_torture_tests[s.target_idx].label)) + 4, dots,
str8_varg(elapsed_time));
}
if (pass_count == target_indices.count) {
fprintf(stdout, "\n \x1b[32m" "%s" "\x1b[0m\n\n", "All Tests Passed!");
fprintf(stderr, "--------------------------------------------------------------------------------\n");
}
fprintf(stderr, "\n");
}
+13 -1
View File
@@ -279,7 +279,19 @@ TEST(d2r_line_table)
for EachIndex(k, test_table[i].line_size) {
t_invoke_radbin("-voff2line -voff:0x%llx a.rdi", test_table[i].voff + k);
T_Ok(g_last_exit_code == 0);
T_MatchLinef(&g_output, "%S:%llu", test_table[i].file->path, test_table[i].ln);
if ( ! t_match_linef(&g_output, "%S:%llu", test_table[i].file->path, test_table[i].ln)) {
fprintf(stderr,
"ERROR: conversion produced unexpected lines for voff 0x%llx\n" \
"\tExpected: %.*s:%llu\n" \
"\tGot: %.*s\n",
(unsigned long long)test_table[i].voff,
str8_varg(test_table[i].file->path), (unsigned long long)test_table[i].ln,
str8_varg(g_output));
T_Ok(0);
}
}
}
+5 -1
View File
@@ -742,7 +742,11 @@ internal void
t_dbg_register_script_tests(Arena *arena, String8 folder_path)
{
Temp scratch = scratch_begin(&arena, 1);
AssertAlways(os_folder_path_exists(folder_path));
if ( ! os_folder_path_exists(folder_path)) {
fprintf(stderr, "ERROR: this folder does not exists: %.*s\n", str8_varg(folder_path));
return;
}
// gather file paths in a folder
String8List paths = t_file_paths_from_dir(arena, folder_path);