|
|
|
@ -3,7 +3,6 @@
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <boost/process/env.hpp>
|
|
|
|
|
|
|
|
|
|
namespace elna
|
|
|
|
@ -105,22 +104,6 @@ namespace elna
|
|
|
|
|
return elna_child.wait();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string find_object(const std::vector<std::filesystem::path>& environment, const std::string& object)
|
|
|
|
|
{
|
|
|
|
|
auto variable = std::find(environment.cbegin(), environment.cend(), object);
|
|
|
|
|
|
|
|
|
|
for (const auto& variable : environment)
|
|
|
|
|
{
|
|
|
|
|
auto full_path = variable / object;
|
|
|
|
|
|
|
|
|
|
if (std::filesystem::exists(full_path))
|
|
|
|
|
{
|
|
|
|
|
return full_path.native();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test_status build_test(boost::asio::io_context& context, const std::filesystem::directory_entry& test_entry)
|
|
|
|
|
{
|
|
|
|
|
const std::filesystem::path test_filename = test_entry.path().filename();
|
|
|
|
@ -145,17 +128,7 @@ namespace elna
|
|
|
|
|
std::vector<std::filesystem::path> environment;
|
|
|
|
|
std::vector<std::string> linker_arguments = { "-o", test_binary.string() };
|
|
|
|
|
|
|
|
|
|
for (const auto segment : boost::this_process::environment()["LIBRARY_PATH"].to_vector())
|
|
|
|
|
{
|
|
|
|
|
linker_arguments.push_back("-L" + segment);
|
|
|
|
|
environment.push_back(std::filesystem::path(segment));
|
|
|
|
|
}
|
|
|
|
|
linker_arguments.push_back(find_object(environment, "crt0.o"));
|
|
|
|
|
linker_arguments.push_back(find_object(environment, "crtbegin.o"));
|
|
|
|
|
linker_arguments.push_back(test_object.string());
|
|
|
|
|
linker_arguments.insert(linker_arguments.cend(),
|
|
|
|
|
{ "--start-group", "-lgcc", "-lc", "-lgloss", "--end-group" });
|
|
|
|
|
linker_arguments.push_back(find_object(environment, "crtend.o"));
|
|
|
|
|
|
|
|
|
|
boost::process::v2::execute(boost::process::v2::process(context, boost::process::search_path("ld"),
|
|
|
|
|
linker_arguments
|
|
|
|
@ -248,7 +221,7 @@ namespace elna
|
|
|
|
|
"-nographic",
|
|
|
|
|
"-M", "virt",
|
|
|
|
|
"-bios", "default",
|
|
|
|
|
"-kernel", "build/tools/linux-5.15.158/arch/riscv/boot/Image",
|
|
|
|
|
"-kernel", "build/tools/linux-5.15.159/arch/riscv/boot/Image",
|
|
|
|
|
"-append", "quiet",
|
|
|
|
|
"-initrd", "build/root.cpio"
|
|
|
|
|
};
|
|
|
|
|