wip
This commit is contained in:
parent
4bb8f8f973
commit
626aa2ffc5
139
src/compiler.cpp
139
src/compiler.cpp
@ -548,45 +548,45 @@ void entry_point(Slice<char* const> arguments, Slice<char* const> envp)
|
|||||||
|
|
||||||
bool has_debug_info_array[] = {true, false};
|
bool has_debug_info_array[] = {true, false};
|
||||||
|
|
||||||
for (auto name: names)
|
// for (auto name: names)
|
||||||
{
|
// {
|
||||||
for (BuildMode build_mode = BuildMode::debug_none; build_mode < BuildMode::count; build_mode = (BuildMode)((backing_type(BuildMode))build_mode + 1))
|
// for (BuildMode build_mode = BuildMode::debug_none; build_mode < BuildMode::count; build_mode = (BuildMode)((backing_type(BuildMode))build_mode + 1))
|
||||||
{
|
// {
|
||||||
for (bool has_debug_info : has_debug_info_array)
|
// for (bool has_debug_info : has_debug_info_array)
|
||||||
{
|
// {
|
||||||
auto position = arena->position;
|
// auto position = arena->position;
|
||||||
|
//
|
||||||
String relative_file_path_parts[] = { string_literal("tests/"), name, string_literal(".bbb") };
|
// String relative_file_path_parts[] = { string_literal("tests/"), name, string_literal(".bbb") };
|
||||||
auto relative_file_path = arena_join_string(arena, array_to_slice(relative_file_path_parts));
|
// auto relative_file_path = arena_join_string(arena, array_to_slice(relative_file_path_parts));
|
||||||
|
//
|
||||||
auto executable_path = compile_file(arena, {
|
// auto executable_path = compile_file(arena, {
|
||||||
.relative_file_path = relative_file_path,
|
// .relative_file_path = relative_file_path,
|
||||||
.build_mode = build_mode,
|
// .build_mode = build_mode,
|
||||||
.has_debug_info = has_debug_info,
|
// .has_debug_info = has_debug_info,
|
||||||
.silent = true,
|
// .silent = true,
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
char* const arguments[] =
|
// char* const arguments[] =
|
||||||
{
|
// {
|
||||||
(char*)executable_path.pointer,
|
// (char*)executable_path.pointer,
|
||||||
0,
|
// 0,
|
||||||
};
|
// };
|
||||||
Slice<char* const> arg_slice = array_to_slice(arguments);
|
// Slice<char* const> arg_slice = array_to_slice(arguments);
|
||||||
arg_slice.length -= 1;
|
// arg_slice.length -= 1;
|
||||||
auto execution = os_execute(arena, arg_slice, environment, {});
|
// auto execution = os_execute(arena, arg_slice, environment, {});
|
||||||
auto success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0;
|
// auto success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0;
|
||||||
if (!success)
|
// if (!success)
|
||||||
{
|
// {
|
||||||
print(string_literal("Test failed: "));
|
// print(string_literal("Test failed: "));
|
||||||
print(executable_path);
|
// print(executable_path);
|
||||||
print(string_literal("\n"));
|
// print(string_literal("\n"));
|
||||||
bb_fail();
|
// bb_fail();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
arena_restore(arena, position);
|
// arena_restore(arena, position);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (BuildMode compiler_build_mode = BuildMode::debug_none; compiler_build_mode < BuildMode::count; compiler_build_mode = (BuildMode)((backing_type(BuildMode))compiler_build_mode + 1))
|
for (BuildMode compiler_build_mode = BuildMode::debug_none; compiler_build_mode < BuildMode::count; compiler_build_mode = (BuildMode)((backing_type(BuildMode))compiler_build_mode + 1))
|
||||||
{
|
{
|
||||||
@ -599,24 +599,10 @@ void entry_point(Slice<char* const> arguments, Slice<char* const> envp)
|
|||||||
.silent = true,
|
.silent = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
Slice<String> name_slice = array_to_slice(names);
|
|
||||||
for (auto name: name_slice(0, 1))
|
|
||||||
{
|
|
||||||
for (BuildMode build_mode = BuildMode::debug_none; build_mode < BuildMode::count; build_mode = (BuildMode)((backing_type(BuildMode))build_mode + 1))
|
|
||||||
{
|
|
||||||
for (bool has_debug_info : has_debug_info_array)
|
|
||||||
{
|
|
||||||
// COMPILATION START
|
|
||||||
|
|
||||||
String relative_file_path_parts[] = { string_literal("tests/"), name, string_literal(".bbb") };
|
|
||||||
auto relative_file_path = arena_join_string(arena, array_to_slice(relative_file_path_parts));
|
|
||||||
char* const compiler_arguments[] =
|
char* const compiler_arguments[] =
|
||||||
{
|
{
|
||||||
(char*)compiler.pointer,
|
(char*)compiler.pointer,
|
||||||
(char*)"compile",
|
(char*)"test",
|
||||||
(char*)relative_file_path.pointer,
|
|
||||||
(char*)build_mode_to_string(build_mode).pointer,
|
|
||||||
(char*)(has_debug_info ? "true" : "false"),
|
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
Slice<char* const> arg_slice = array_to_slice(compiler_arguments);
|
Slice<char* const> arg_slice = array_to_slice(compiler_arguments);
|
||||||
@ -625,50 +611,11 @@ void entry_point(Slice<char* const> arguments, Slice<char* const> envp)
|
|||||||
auto success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0;
|
auto success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0;
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
print(string_literal("Self-hosted test failed to compile: "));
|
print(string_literal("Self-hosted tests failed to compile: "));
|
||||||
print(name);
|
print(build_mode_to_string(compiler_build_mode));
|
||||||
print(string_literal("\n"));
|
print(compiler_has_debug_info ? string_literal(" with debug info\n") : string_literal(" with no debug info\n"));
|
||||||
bb_fail();
|
bb_fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
// COMPILATION END
|
|
||||||
|
|
||||||
// RUN START
|
|
||||||
|
|
||||||
String exe_parts[] = {
|
|
||||||
string_literal("self-hosted-bb-cache/"),
|
|
||||||
build_mode_to_string(compiler_build_mode),
|
|
||||||
string_literal("_"),
|
|
||||||
compiler_has_debug_info ? string_literal("di") : string_literal("nodi"),
|
|
||||||
string_literal("/"),
|
|
||||||
build_mode_to_string(build_mode),
|
|
||||||
string_literal("_"),
|
|
||||||
has_debug_info ? string_literal("di") : string_literal("nodi"),
|
|
||||||
string_literal("/"),
|
|
||||||
name,
|
|
||||||
};
|
|
||||||
String exe_path = arena_join_string(arena, array_to_slice(exe_parts));
|
|
||||||
char* const run_arguments[] =
|
|
||||||
{
|
|
||||||
(char*)exe_path.pointer,
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
arg_slice = array_to_slice(run_arguments);
|
|
||||||
arg_slice.length -= 1;
|
|
||||||
execution = os_execute(arena, arg_slice, environment, {});
|
|
||||||
success = execution.termination_kind == TerminationKind::exit && execution.termination_code == 0;
|
|
||||||
if (!success)
|
|
||||||
{
|
|
||||||
print(string_literal("Self-hosted test failed to run: "));
|
|
||||||
print(name);
|
|
||||||
print(string_literal("\n"));
|
|
||||||
bb_fail();
|
|
||||||
}
|
|
||||||
|
|
||||||
// RUN END
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user