@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <cerrno>
|
||||
#include <filesystem>
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <modulus/types.hpp>
|
||||
|
||||
|
||||
namespace vamp_test {
|
||||
|
||||
inline auto build_catalogue(std::filesystem::path const &assets, std::filesystem::path const &database) -> std::bool_t {
|
||||
auto source = assets.string();
|
||||
auto destination = database.string();
|
||||
auto child = ::fork();
|
||||
BOOST_REQUIRE(child >= 0);
|
||||
if (child == 0) {
|
||||
::execl(VAMP_TEST_PYTHON, VAMP_TEST_PYTHON, VAMP_TEST_SOURCE_DIR "/generator/catalogue.py", source.c_str(), destination.c_str(), nullptr);
|
||||
::_exit(127);
|
||||
}
|
||||
auto status = std::int32_t{};
|
||||
auto waited = ::waitpid(child, &status, 0);
|
||||
while (waited < 0 && errno == EINTR) {
|
||||
waited = ::waitpid(child, &status, 0);
|
||||
}
|
||||
BOOST_REQUIRE(waited == child);
|
||||
return WIFEXITED(status) && WEXITSTATUS(status) == 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user