Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)

- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
2014-07-28 17:05:06 +02:00
parent ff10274392
commit 84d9c625bf
4655 changed files with 379308 additions and 151050 deletions
+68 -8
View File
@@ -30,6 +30,8 @@
extern "C" {
#include <sys/stat.h>
#include <signal.h>
}
#include <cstdlib>
@@ -56,7 +58,7 @@ using utils::optional;
namespace {
/// Creates a mock tester.
/// Creates a mock tester that exits cleanly.
///
/// The interface accepted by the tester is 'mock'. This tester outputs the
/// arguments passed to it and then prints a message to both the stdout and the
@@ -64,7 +66,7 @@ namespace {
///
/// \param exit_status Code to exit with.
static void
create_mock_tester(const int exit_status)
create_mock_tester_exit(const int exit_status)
{
atf::utils::create_file(
"kyua-mock-tester",
@@ -82,13 +84,42 @@ create_mock_tester(const int exit_status)
}
/// Creates a mock tester that receives a signal.
///
/// The interface accepted by the tester is 'mock'. This tester outputs the
/// arguments passed to it and then prints a message to both the stdout and the
/// stderr.
///
/// \param term_sig Signal to deliver to the tester. If the tester does not
/// exit due to this reason, it exits with an arbitrary non-zero code.
static void
create_mock_tester_signal(const int term_sig)
{
atf::utils::create_file(
"kyua-mock-tester",
F("#! /bin/sh\n"
"while [ ${#} -gt 0 ]; do\n"
" echo \"Arg: ${1}\"\n"
" shift\n"
"done\n"
"echo 'tester output'\n"
"echo 'tester error' 1>&2\n"
"kill -%s $$\n"
"echo 'signal did not terminate the process\n"
"exit 0\n") % term_sig);
ATF_REQUIRE(::chmod("kyua-mock-tester", 0755) != -1);
utils::setenv("KYUA_TESTERSDIR", fs::current_path().str());
}
} // anonymous namespace
ATF_TEST_CASE_WITHOUT_HEAD(tester__list__defaults);
ATF_TEST_CASE_BODY(tester__list__defaults)
{
create_mock_tester(EXIT_SUCCESS);
create_mock_tester_exit(EXIT_SUCCESS);
engine::tester tester("mock", none, none);
const std::string output = tester.list(fs::path("/foo/bar"));
@@ -107,7 +138,7 @@ ATF_TEST_CASE_BODY(tester__list__explicit_common_args)
const passwd::user user("fake", 123, 456);
const datetime::delta timeout(15, 0);
create_mock_tester(EXIT_SUCCESS);
create_mock_tester_exit(EXIT_SUCCESS);
engine::tester tester("mock", utils::make_optional(user),
utils::make_optional(timeout));
const std::string output = tester.list(fs::path("/another/program/1"));
@@ -137,7 +168,19 @@ ATF_TEST_CASE_BODY(tester__list__unknown_interface)
ATF_TEST_CASE_WITHOUT_HEAD(tester__list__tester_fails);
ATF_TEST_CASE_BODY(tester__list__tester_fails)
{
create_mock_tester(EXIT_FAILURE);
create_mock_tester_exit(EXIT_FAILURE);
engine::tester tester("mock", none, none);
ATF_REQUIRE_THROW_RE(
engine::error,
"Tester did not exit cleanly:.*tester output.*tester error",
tester.list(fs::path("does-not-matter")));
}
ATF_TEST_CASE_WITHOUT_HEAD(tester__list__tester_crashes);
ATF_TEST_CASE_BODY(tester__list__tester_crashes)
{
create_mock_tester_signal(SIGKILL);
engine::tester tester("mock", none, none);
ATF_REQUIRE_THROW_RE(
engine::error,
@@ -151,7 +194,7 @@ ATF_TEST_CASE_BODY(tester__test__defaults)
{
std::map< std::string, std::string > vars;
create_mock_tester(EXIT_FAILURE);
create_mock_tester_exit(EXIT_FAILURE);
engine::tester tester("mock", none, none);
tester.test(fs::path("/foo/bar"), "test-case", fs::path("/the/result/file"),
fs::path("tester.out"), fs::path("tester.err"), vars);
@@ -179,7 +222,7 @@ ATF_TEST_CASE_BODY(tester__test__explicit_common_args_and_vars)
vars["var1"] = "value1";
vars["variable-2"] = "value with spaces";
create_mock_tester(EXIT_SUCCESS);
create_mock_tester_exit(EXIT_SUCCESS);
engine::tester tester("mock", utils::make_optional(user),
utils::make_optional(timeout));
tester.test(fs::path("/foo/bar"), "test-case", fs::path("/the/result/file"),
@@ -221,7 +264,7 @@ ATF_TEST_CASE_BODY(tester__test__tester_fails)
{
const std::map< std::string, std::string > vars;
create_mock_tester(2);
create_mock_tester_exit(2);
engine::tester tester("mock", none, none);
ATF_REQUIRE_THROW_RE(
engine::error,
@@ -231,6 +274,21 @@ ATF_TEST_CASE_BODY(tester__test__tester_fails)
}
ATF_TEST_CASE_WITHOUT_HEAD(tester__test__tester_crashes);
ATF_TEST_CASE_BODY(tester__test__tester_crashes)
{
const std::map< std::string, std::string > vars;
create_mock_tester_signal(SIGKILL);
engine::tester tester("mock", none, none);
ATF_REQUIRE_THROW_RE(
engine::error,
F("Tester received signal %s; this is a bug") % SIGKILL,
tester.test(fs::path("foo"), "bar", fs::path("baz"),
fs::path("out"), fs::path("err"), vars));
}
ATF_TEST_CASE_WITHOUT_HEAD(tester_path__default);
ATF_TEST_CASE_BODY(tester_path__default)
{
@@ -302,11 +360,13 @@ ATF_INIT_TEST_CASES(tcs)
ATF_ADD_TEST_CASE(tcs, tester__list__explicit_common_args);
ATF_ADD_TEST_CASE(tcs, tester__list__unknown_interface);
ATF_ADD_TEST_CASE(tcs, tester__list__tester_fails);
ATF_ADD_TEST_CASE(tcs, tester__list__tester_crashes);
ATF_ADD_TEST_CASE(tcs, tester__test__defaults);
ATF_ADD_TEST_CASE(tcs, tester__test__explicit_common_args_and_vars);
ATF_ADD_TEST_CASE(tcs, tester__test__unknown_interface);
ATF_ADD_TEST_CASE(tcs, tester__test__tester_fails);
ATF_ADD_TEST_CASE(tcs, tester__test__tester_crashes);
ATF_ADD_TEST_CASE(tcs, tester_path__default);
ATF_ADD_TEST_CASE(tcs, tester_path__custom);