aboutsummaryrefslogtreecommitdiff
path: root/contrib/kyua/utils
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2026-10-07 17:50:26 +0000
committerEnji Cooper <ngie@FreeBSD.org>2026-10-07 17:50:26 +0000
commiteb8f69902f7de8012a31a85db2f88a54584f81af (patch)
tree1499ad12948cb1a4dbbc9860c46ec36e988087dc /contrib/kyua/utils
parentde2c0f157a9cce0b763da9ae97ada870fa4d1824 (diff)
parent144afd05f8a2300361ec30c1c2020e4022ddd943 (diff)
contrib/kyua: update to 0.15.0
This new release contains multiple feature updates and bugfixes. Please see the release notes mentioned in the merge commit for more details. MFC after: 1 month Merge commit '144afd05f8a2300361ec30c1c2020e4022ddd943' Conflicts: contrib/kyua/cli/cmd_debug.cpp contrib/kyua/doc/kyua-debug.1.in contrib/kyua/doc/kyuafile.5.in contrib/kyua/engine/config.cpp contrib/kyua/engine/execenv/execenv.cpp contrib/kyua/engine/execenv/execenv.hpp contrib/kyua/engine/execenv/execenv_host.hpp contrib/kyua/engine/requirements.cpp contrib/kyua/engine/requirements.hpp contrib/kyua/engine/scheduler.cpp contrib/kyua/model/metadata.cpp contrib/kyua/os/freebsd/execenv_jail.hpp contrib/kyua/os/freebsd/execenv_jail_stub.cpp contrib/kyua/os/freebsd/main.cpp contrib/kyua/os/freebsd/reqs_checker_kmods.cpp contrib/kyua/os/freebsd/utils/jail.hpp contrib/kyua/utils/fs/directory.cpp contrib/kyua/utils/process/executor.cpp
Diffstat (limited to 'contrib/kyua/utils')
-rw-r--r--contrib/kyua/utils/.gitignore2
-rw-r--r--contrib/kyua/utils/Makefile.am.inc133
-rw-r--r--contrib/kyua/utils/cmdline/Makefile.am.inc96
-rw-r--r--contrib/kyua/utils/config/Makefile.am.inc87
-rw-r--r--contrib/kyua/utils/config/nodes.cpp20
-rw-r--r--contrib/kyua/utils/config/nodes.hpp2
-rw-r--r--contrib/kyua/utils/config/nodes_test.cpp15
-rw-r--r--contrib/kyua/utils/defs.hpp.in15
-rw-r--r--contrib/kyua/utils/format/Makefile.am.inc59
-rw-r--r--contrib/kyua/utils/fs/Makefile.am.inc84
-rw-r--r--contrib/kyua/utils/fs/directory.cpp13
-rw-r--r--contrib/kyua/utils/fs/operations.cpp120
-rw-r--r--contrib/kyua/utils/logging/Makefile.am.inc53
-rw-r--r--contrib/kyua/utils/process/.gitignore1
-rw-r--r--contrib/kyua/utils/process/Kyuafile1
-rw-r--r--contrib/kyua/utils/process/Makefile.am.inc118
-rw-r--r--contrib/kyua/utils/process/child.hpp4
-rw-r--r--contrib/kyua/utils/process/child_test.cpp2
-rw-r--r--contrib/kyua/utils/process/executor.cpp2
-rw-r--r--contrib/kyua/utils/process/executor_pid_test.cpp208
-rw-r--r--contrib/kyua/utils/process/executor_test.cpp23
-rw-r--r--contrib/kyua/utils/process/isolation.cpp2
-rw-r--r--contrib/kyua/utils/process/operations.cpp3
-rw-r--r--contrib/kyua/utils/process/operations.hpp6
-rw-r--r--contrib/kyua/utils/process/operations_test.cpp4
-rw-r--r--contrib/kyua/utils/sanity.hpp4
-rw-r--r--contrib/kyua/utils/signals/Makefile.am.inc73
-rw-r--r--contrib/kyua/utils/signals/misc_test.cpp2
-rw-r--r--contrib/kyua/utils/sqlite/Makefile.am.inc82
-rw-r--r--contrib/kyua/utils/sqlite/database.hpp1
-rw-r--r--contrib/kyua/utils/sqlite/test_utils.hpp4
-rw-r--r--contrib/kyua/utils/stacktrace.cpp2
-rw-r--r--contrib/kyua/utils/stacktrace_test.cpp9
-rw-r--r--contrib/kyua/utils/test_utils.ipp2
-rw-r--r--contrib/kyua/utils/text/Makefile.am.inc74
-rw-r--r--contrib/kyua/utils/text/operations.ipp1
-rw-r--r--contrib/kyua/utils/text/regex.cpp4
-rw-r--r--contrib/kyua/utils/text/regex.hpp1
38 files changed, 92 insertions, 1240 deletions
diff --git a/contrib/kyua/utils/.gitignore b/contrib/kyua/utils/.gitignore
deleted file mode 100644
index b33d720f27a4..000000000000
--- a/contrib/kyua/utils/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-defs.hpp
-stacktrace_helper
diff --git a/contrib/kyua/utils/Makefile.am.inc b/contrib/kyua/utils/Makefile.am.inc
deleted file mode 100644
index d6690bdbecde..000000000000
--- a/contrib/kyua/utils/Makefile.am.inc
+++ /dev/null
@@ -1,133 +0,0 @@
-# Copyright 2010 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-UTILS_CFLAGS =
-UTILS_LIBS = libutils.a
-
-noinst_LIBRARIES += libutils.a
-libutils_a_CPPFLAGS = -DGDB=\"$(GDB)\"
-libutils_a_SOURCES = utils/auto_array.hpp
-libutils_a_SOURCES += utils/auto_array.ipp
-libutils_a_SOURCES += utils/auto_array_fwd.hpp
-libutils_a_SOURCES += utils/datetime.cpp
-libutils_a_SOURCES += utils/datetime.hpp
-libutils_a_SOURCES += utils/datetime_fwd.hpp
-libutils_a_SOURCES += utils/env.hpp
-libutils_a_SOURCES += utils/env.cpp
-libutils_a_SOURCES += utils/memory.hpp
-libutils_a_SOURCES += utils/memory.cpp
-libutils_a_SOURCES += utils/noncopyable.hpp
-libutils_a_SOURCES += utils/optional.hpp
-libutils_a_SOURCES += utils/optional_fwd.hpp
-libutils_a_SOURCES += utils/optional.ipp
-libutils_a_SOURCES += utils/passwd.cpp
-libutils_a_SOURCES += utils/passwd.hpp
-libutils_a_SOURCES += utils/passwd_fwd.hpp
-libutils_a_SOURCES += utils/sanity.cpp
-libutils_a_SOURCES += utils/sanity.hpp
-libutils_a_SOURCES += utils/sanity_fwd.hpp
-libutils_a_SOURCES += utils/stacktrace.cpp
-libutils_a_SOURCES += utils/stacktrace.hpp
-libutils_a_SOURCES += utils/stream.cpp
-libutils_a_SOURCES += utils/stream.hpp
-libutils_a_SOURCES += utils/units.cpp
-libutils_a_SOURCES += utils/units.hpp
-libutils_a_SOURCES += utils/units_fwd.hpp
-nodist_libutils_a_SOURCES = utils/defs.hpp
-
-EXTRA_DIST += utils/test_utils.ipp
-
-if WITH_ATF
-tests_utilsdir = $(pkgtestsdir)/utils
-
-tests_utils_DATA = utils/Kyuafile
-EXTRA_DIST += $(tests_utils_DATA)
-
-tests_utils_PROGRAMS = utils/auto_array_test
-utils_auto_array_test_SOURCES = utils/auto_array_test.cpp
-utils_auto_array_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_auto_array_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/datetime_test
-utils_datetime_test_SOURCES = utils/datetime_test.cpp
-utils_datetime_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_datetime_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/env_test
-utils_env_test_SOURCES = utils/env_test.cpp
-utils_env_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_env_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/memory_test
-utils_memory_test_SOURCES = utils/memory_test.cpp
-utils_memory_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_memory_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/optional_test
-utils_optional_test_SOURCES = utils/optional_test.cpp
-utils_optional_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_optional_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/passwd_test
-utils_passwd_test_SOURCES = utils/passwd_test.cpp
-utils_passwd_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_passwd_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/sanity_test
-utils_sanity_test_SOURCES = utils/sanity_test.cpp
-utils_sanity_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_sanity_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/stacktrace_helper
-utils_stacktrace_helper_SOURCES = utils/stacktrace_helper.cpp
-
-tests_utils_PROGRAMS += utils/stacktrace_test
-utils_stacktrace_test_SOURCES = utils/stacktrace_test.cpp
-utils_stacktrace_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_stacktrace_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/stream_test
-utils_stream_test_SOURCES = utils/stream_test.cpp
-utils_stream_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_stream_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_PROGRAMS += utils/units_test
-utils_units_test_SOURCES = utils/units_test.cpp
-utils_units_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_units_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
-
-include utils/cmdline/Makefile.am.inc
-include utils/config/Makefile.am.inc
-include utils/format/Makefile.am.inc
-include utils/fs/Makefile.am.inc
-include utils/logging/Makefile.am.inc
-include utils/process/Makefile.am.inc
-include utils/signals/Makefile.am.inc
-include utils/sqlite/Makefile.am.inc
-include utils/text/Makefile.am.inc
diff --git a/contrib/kyua/utils/cmdline/Makefile.am.inc b/contrib/kyua/utils/cmdline/Makefile.am.inc
deleted file mode 100644
index 65081cbeafee..000000000000
--- a/contrib/kyua/utils/cmdline/Makefile.am.inc
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2010 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-libutils_a_SOURCES += utils/cmdline/base_command.cpp
-libutils_a_SOURCES += utils/cmdline/base_command.hpp
-libutils_a_SOURCES += utils/cmdline/base_command_fwd.hpp
-libutils_a_SOURCES += utils/cmdline/base_command.ipp
-libutils_a_SOURCES += utils/cmdline/commands_map.hpp
-libutils_a_SOURCES += utils/cmdline/commands_map_fwd.hpp
-libutils_a_SOURCES += utils/cmdline/commands_map.ipp
-libutils_a_SOURCES += utils/cmdline/exceptions.cpp
-libutils_a_SOURCES += utils/cmdline/exceptions.hpp
-libutils_a_SOURCES += utils/cmdline/globals.cpp
-libutils_a_SOURCES += utils/cmdline/globals.hpp
-libutils_a_SOURCES += utils/cmdline/options.cpp
-libutils_a_SOURCES += utils/cmdline/options.hpp
-libutils_a_SOURCES += utils/cmdline/options_fwd.hpp
-libutils_a_SOURCES += utils/cmdline/parser.cpp
-libutils_a_SOURCES += utils/cmdline/parser.hpp
-libutils_a_SOURCES += utils/cmdline/parser_fwd.hpp
-libutils_a_SOURCES += utils/cmdline/parser.ipp
-libutils_a_SOURCES += utils/cmdline/ui.cpp
-libutils_a_SOURCES += utils/cmdline/ui.hpp
-libutils_a_SOURCES += utils/cmdline/ui_fwd.hpp
-# The following two files are only supposed to be used from test code. They
-# should not be bundled into libutils.a, but doing so simplifies the build
-# significantly.
-libutils_a_SOURCES += utils/cmdline/ui_mock.hpp
-libutils_a_SOURCES += utils/cmdline/ui_mock.cpp
-
-if WITH_ATF
-tests_utils_cmdlinedir = $(pkgtestsdir)/utils/cmdline
-
-tests_utils_cmdline_DATA = utils/cmdline/Kyuafile
-EXTRA_DIST += $(tests_utils_cmdline_DATA)
-
-tests_utils_cmdline_PROGRAMS = utils/cmdline/base_command_test
-utils_cmdline_base_command_test_SOURCES = utils/cmdline/base_command_test.cpp
-utils_cmdline_base_command_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_base_command_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_cmdline_PROGRAMS += utils/cmdline/commands_map_test
-utils_cmdline_commands_map_test_SOURCES = utils/cmdline/commands_map_test.cpp
-utils_cmdline_commands_map_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_commands_map_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_cmdline_PROGRAMS += utils/cmdline/exceptions_test
-utils_cmdline_exceptions_test_SOURCES = utils/cmdline/exceptions_test.cpp
-utils_cmdline_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_cmdline_PROGRAMS += utils/cmdline/globals_test
-utils_cmdline_globals_test_SOURCES = utils/cmdline/globals_test.cpp
-utils_cmdline_globals_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_globals_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_cmdline_PROGRAMS += utils/cmdline/options_test
-utils_cmdline_options_test_SOURCES = utils/cmdline/options_test.cpp
-utils_cmdline_options_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_options_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_cmdline_PROGRAMS += utils/cmdline/parser_test
-utils_cmdline_parser_test_SOURCES = utils/cmdline/parser_test.cpp
-utils_cmdline_parser_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_parser_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_cmdline_PROGRAMS += utils/cmdline/ui_test
-utils_cmdline_ui_test_SOURCES = utils/cmdline/ui_test.cpp
-utils_cmdline_ui_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_cmdline_ui_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/config/Makefile.am.inc b/contrib/kyua/utils/config/Makefile.am.inc
deleted file mode 100644
index 7c276ec4e798..000000000000
--- a/contrib/kyua/utils/config/Makefile.am.inc
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2012 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-UTILS_CFLAGS += $(LUTOK_CFLAGS)
-UTILS_LIBS += $(LUTOK_LIBS)
-
-libutils_a_CPPFLAGS += $(LUTOK_CFLAGS)
-libutils_a_SOURCES += utils/config/exceptions.cpp
-libutils_a_SOURCES += utils/config/exceptions.hpp
-libutils_a_SOURCES += utils/config/keys.cpp
-libutils_a_SOURCES += utils/config/keys.hpp
-libutils_a_SOURCES += utils/config/keys_fwd.hpp
-libutils_a_SOURCES += utils/config/lua_module.cpp
-libutils_a_SOURCES += utils/config/lua_module.hpp
-libutils_a_SOURCES += utils/config/nodes.cpp
-libutils_a_SOURCES += utils/config/nodes.hpp
-libutils_a_SOURCES += utils/config/nodes.ipp
-libutils_a_SOURCES += utils/config/nodes_fwd.hpp
-libutils_a_SOURCES += utils/config/parser.cpp
-libutils_a_SOURCES += utils/config/parser.hpp
-libutils_a_SOURCES += utils/config/parser_fwd.hpp
-libutils_a_SOURCES += utils/config/tree.cpp
-libutils_a_SOURCES += utils/config/tree.hpp
-libutils_a_SOURCES += utils/config/tree.ipp
-libutils_a_SOURCES += utils/config/tree_fwd.hpp
-
-if WITH_ATF
-tests_utils_configdir = $(pkgtestsdir)/utils/config
-
-tests_utils_config_DATA = utils/config/Kyuafile
-EXTRA_DIST += $(tests_utils_config_DATA)
-
-tests_utils_config_PROGRAMS = utils/config/exceptions_test
-utils_config_exceptions_test_SOURCES = utils/config/exceptions_test.cpp
-utils_config_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_config_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_config_PROGRAMS += utils/config/keys_test
-utils_config_keys_test_SOURCES = utils/config/keys_test.cpp
-utils_config_keys_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_config_keys_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_config_PROGRAMS += utils/config/lua_module_test
-utils_config_lua_module_test_SOURCES = utils/config/lua_module_test.cpp
-utils_config_lua_module_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_config_lua_module_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_config_PROGRAMS += utils/config/nodes_test
-utils_config_nodes_test_SOURCES = utils/config/nodes_test.cpp
-utils_config_nodes_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_config_nodes_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_config_PROGRAMS += utils/config/parser_test
-utils_config_parser_test_SOURCES = utils/config/parser_test.cpp
-utils_config_parser_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_config_parser_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_config_PROGRAMS += utils/config/tree_test
-utils_config_tree_test_SOURCES = utils/config/tree_test.cpp
-utils_config_tree_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_config_tree_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/config/nodes.cpp b/contrib/kyua/utils/config/nodes.cpp
index 2747c11989ad..a257a69c347b 100644
--- a/contrib/kyua/utils/config/nodes.cpp
+++ b/contrib/kyua/utils/config/nodes.cpp
@@ -153,7 +153,7 @@ config::detail::inner_node::combine_into(const tree_key& key,
} catch (const std::bad_cast& unused_e) {
throw config::bad_combination_error(
key, "'%s' is an inner node in the base tree but a leaf node in "
- "the overrides treee");
+ "the overrides tree");
}
}
@@ -227,8 +227,10 @@ config::detail::inner_node::lookup_rw(const tree_key& key,
if (child_iter == _children.end()) {
if (_dynamic) {
base_node* const child = (key_pos == key.size() - 1) ?
- static_cast< base_node* >(new_node()) :
- static_cast< base_node* >(new dynamic_inner_node());
+ dynamic_cast< base_node* >(new_node()) :
+ dynamic_cast< base_node* >(new dynamic_inner_node());
+ // The types for `new_node`
+ INV_MSG(child != nullptr, "check the return type for the function called");
_children.insert(children_map::value_type(key[key_pos], child));
child_iter = _children.find(key[key_pos]);
} else {
@@ -530,6 +532,18 @@ config::positive_int_node::validate(const value_type& new_value) const
///
/// \return A dynamically-allocated node.
config::detail::base_node*
+config::positive_int_node::deep_copy(void) const
+{
+ std::unique_ptr< positive_int_node > new_node(new positive_int_node());
+ new_node->_value = _value;
+ return new_node.release();
+}
+
+
+/// Copies the node.
+///
+/// \return A dynamically-allocated node.
+config::detail::base_node*
config::string_node::deep_copy(void) const
{
std::unique_ptr< string_node > new_node(new string_node());
diff --git a/contrib/kyua/utils/config/nodes.hpp b/contrib/kyua/utils/config/nodes.hpp
index 6b766ff5d8f7..0d64cbda9d4e 100644
--- a/contrib/kyua/utils/config/nodes.hpp
+++ b/contrib/kyua/utils/config/nodes.hpp
@@ -181,6 +181,8 @@ public:
/// A leaf node that holds a positive non-zero integer value.
class positive_int_node : public int_node {
virtual void validate(const value_type&) const;
+public:
+ virtual base_node* deep_copy(void) const;
};
diff --git a/contrib/kyua/utils/config/nodes_test.cpp b/contrib/kyua/utils/config/nodes_test.cpp
index e762d3aac38c..1bc3ad743db6 100644
--- a/contrib/kyua/utils/config/nodes_test.cpp
+++ b/contrib/kyua/utils/config/nodes_test.cpp
@@ -85,7 +85,8 @@ ATF_TEST_CASE_BODY(bool_node__deep_copy)
config::bool_node node;
node.set(true);
config::detail::base_node* raw_copy = node.deep_copy();
- config::bool_node* copy = static_cast< config::bool_node* >(raw_copy);
+ config::bool_node* copy = dynamic_cast< config::bool_node* >(raw_copy);
+ ATF_REQUIRE(copy != nullptr);
ATF_REQUIRE(copy->value());
copy->set(false);
ATF_REQUIRE(node.value());
@@ -192,7 +193,8 @@ ATF_TEST_CASE_BODY(int_node__deep_copy)
config::int_node node;
node.set(5);
config::detail::base_node* raw_copy = node.deep_copy();
- config::int_node* copy = static_cast< config::int_node* >(raw_copy);
+ config::int_node* copy = dynamic_cast< config::int_node* >(raw_copy);
+ ATF_REQUIRE(copy != nullptr);
ATF_REQUIRE_EQ(5, copy->value());
copy->set(10);
ATF_REQUIRE_EQ(5, node.value());
@@ -302,8 +304,9 @@ ATF_TEST_CASE_BODY(positive_int_node__deep_copy)
config::positive_int_node node;
node.set(5);
config::detail::base_node* raw_copy = node.deep_copy();
- config::positive_int_node* copy = static_cast< config::positive_int_node* >(
+ config::positive_int_node* copy = dynamic_cast< config::positive_int_node* >(
raw_copy);
+ ATF_REQUIRE(copy != nullptr);
ATF_REQUIRE_EQ(5, copy->value());
copy->set(10);
ATF_REQUIRE_EQ(5, node.value());
@@ -419,7 +422,8 @@ ATF_TEST_CASE_BODY(string_node__deep_copy)
config::string_node node;
node.set("first");
config::detail::base_node* raw_copy = node.deep_copy();
- config::string_node* copy = static_cast< config::string_node* >(raw_copy);
+ config::string_node* copy = dynamic_cast< config::string_node* >(raw_copy);
+ ATF_REQUIRE(copy != nullptr);
ATF_REQUIRE_EQ("first", copy->value());
copy->set("second");
ATF_REQUIRE_EQ("first", node.value());
@@ -523,7 +527,8 @@ ATF_TEST_CASE_BODY(strings_set_node__deep_copy)
node.set(value);
config::detail::base_node* raw_copy = node.deep_copy();
config::strings_set_node* copy =
- static_cast< config::strings_set_node* >(raw_copy);
+ dynamic_cast< config::strings_set_node* >(raw_copy);
+ ATF_REQUIRE(copy != nullptr);
value.insert("bar");
ATF_REQUIRE_EQ(1, copy->value().size());
copy->set(value);
diff --git a/contrib/kyua/utils/defs.hpp.in b/contrib/kyua/utils/defs.hpp.in
index 62fc50d0e525..88207c90aa58 100644
--- a/contrib/kyua/utils/defs.hpp.in
+++ b/contrib/kyua/utils/defs.hpp.in
@@ -34,24 +34,17 @@
#if !defined(UTILS_DEFS_HPP)
#define UTILS_DEFS_HPP
-
-/// Attribute to mark a function as non-returning.
-#define UTILS_NORETURN @ATTRIBUTE_NORETURN@
-
+extern "C" {
+#include <inttypes.h>
+}
/// Attribute to mark a function as pure.
#define UTILS_PURE @ATTRIBUTE_PURE@
-
-/// Attribute to mark an entity as unused.
-#define UTILS_UNUSED @ATTRIBUTE_UNUSED@
-
-
/// Unconstifies a pointer.
///
/// \param type The target type of the conversion.
/// \param ptr The pointer to be unconstified.
-#define UTILS_UNCONST(type, ptr) ((type*)(unsigned long)(const void*)(ptr))
-
+#define UTILS_UNCONST(type, ptr) ((type*)(uintptr_t)(const void*)(ptr))
#endif // !defined(UTILS_DEFS_HPP)
diff --git a/contrib/kyua/utils/format/Makefile.am.inc b/contrib/kyua/utils/format/Makefile.am.inc
deleted file mode 100644
index a37fc4057079..000000000000
--- a/contrib/kyua/utils/format/Makefile.am.inc
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright 2010 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-libutils_a_SOURCES += utils/format/containers.hpp
-libutils_a_SOURCES += utils/format/containers.ipp
-libutils_a_SOURCES += utils/format/exceptions.cpp
-libutils_a_SOURCES += utils/format/exceptions.hpp
-libutils_a_SOURCES += utils/format/formatter.cpp
-libutils_a_SOURCES += utils/format/formatter.hpp
-libutils_a_SOURCES += utils/format/formatter_fwd.hpp
-libutils_a_SOURCES += utils/format/formatter.ipp
-libutils_a_SOURCES += utils/format/macros.hpp
-
-if WITH_ATF
-tests_utils_formatdir = $(pkgtestsdir)/utils/format
-
-tests_utils_format_DATA = utils/format/Kyuafile
-EXTRA_DIST += $(tests_utils_format_DATA)
-
-tests_utils_format_PROGRAMS = utils/format/containers_test
-utils_format_containers_test_SOURCES = utils/format/containers_test.cpp
-utils_format_containers_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_format_containers_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_format_PROGRAMS += utils/format/exceptions_test
-utils_format_exceptions_test_SOURCES = utils/format/exceptions_test.cpp
-utils_format_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_format_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_format_PROGRAMS += utils/format/formatter_test
-utils_format_formatter_test_SOURCES = utils/format/formatter_test.cpp
-utils_format_formatter_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_format_formatter_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/fs/Makefile.am.inc b/contrib/kyua/utils/fs/Makefile.am.inc
deleted file mode 100644
index 2acdadafa79b..000000000000
--- a/contrib/kyua/utils/fs/Makefile.am.inc
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright 2010 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-UTILS_CFLAGS += $(LUTOK_CFLAGS)
-UTILS_LIBS += $(LUTOK_LIBS)
-
-libutils_a_CPPFLAGS += $(LUTOK_CFLAGS)
-libutils_a_SOURCES += utils/fs/auto_cleaners.cpp
-libutils_a_SOURCES += utils/fs/auto_cleaners.hpp
-libutils_a_SOURCES += utils/fs/auto_cleaners_fwd.hpp
-libutils_a_SOURCES += utils/fs/directory.cpp
-libutils_a_SOURCES += utils/fs/directory.hpp
-libutils_a_SOURCES += utils/fs/directory_fwd.hpp
-libutils_a_SOURCES += utils/fs/exceptions.cpp
-libutils_a_SOURCES += utils/fs/exceptions.hpp
-libutils_a_SOURCES += utils/fs/lua_module.cpp
-libutils_a_SOURCES += utils/fs/lua_module.hpp
-libutils_a_SOURCES += utils/fs/operations.cpp
-libutils_a_SOURCES += utils/fs/operations.hpp
-libutils_a_SOURCES += utils/fs/path.cpp
-libutils_a_SOURCES += utils/fs/path.hpp
-libutils_a_SOURCES += utils/fs/path_fwd.hpp
-
-if WITH_ATF
-tests_utils_fsdir = $(pkgtestsdir)/utils/fs
-
-tests_utils_fs_DATA = utils/fs/Kyuafile
-EXTRA_DIST += $(tests_utils_fs_DATA)
-
-tests_utils_fs_PROGRAMS = utils/fs/auto_cleaners_test
-utils_fs_auto_cleaners_test_SOURCES = utils/fs/auto_cleaners_test.cpp
-utils_fs_auto_cleaners_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_fs_auto_cleaners_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_fs_PROGRAMS += utils/fs/directory_test
-utils_fs_directory_test_SOURCES = utils/fs/directory_test.cpp
-utils_fs_directory_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_fs_directory_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_fs_PROGRAMS += utils/fs/exceptions_test
-utils_fs_exceptions_test_SOURCES = utils/fs/exceptions_test.cpp
-utils_fs_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_fs_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_fs_PROGRAMS += utils/fs/lua_module_test
-utils_fs_lua_module_test_SOURCES = utils/fs/lua_module_test.cpp
-utils_fs_lua_module_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_fs_lua_module_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_fs_PROGRAMS += utils/fs/operations_test
-utils_fs_operations_test_SOURCES = utils/fs/operations_test.cpp
-utils_fs_operations_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_fs_operations_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_fs_PROGRAMS += utils/fs/path_test
-utils_fs_path_test_SOURCES = utils/fs/path_test.cpp
-utils_fs_path_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_fs_path_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/fs/directory.cpp b/contrib/kyua/utils/fs/directory.cpp
index b73741aa544d..622d4c607f2c 100644
--- a/contrib/kyua/utils/fs/directory.cpp
+++ b/contrib/kyua/utils/fs/directory.cpp
@@ -32,6 +32,7 @@ extern "C" {
#include <sys/types.h>
#include <dirent.h>
+#include <limits.h>
}
#include <cerrno>
@@ -128,9 +129,6 @@ struct utils::fs::detail::directory_iterator::impl : utils::noncopyable {
::DIR* _dirp;
/// Custom representation of the directory entry.
- ///
- /// We must keep this as a pointer so that we can support the common
- /// operators (* and ->) over iterators.
std::unique_ptr< directory_entry > _entry;
/// Constructs an iterator pointing to the "end" of the directory.
@@ -191,12 +189,9 @@ struct utils::fs::detail::directory_iterator::impl : utils::noncopyable {
{
::dirent* result;
- errno = 0;
- if ((result = ::readdir(_dirp)) == NULL && errno != 0) {
- const int original_errno = errno;
- throw fs::system_error(F("readdir(%s) failed") % _path,
- original_errno);
- }
+ // TODO(ngie): use `std::filesystem::directory_iterator` once the
+ // minimum C++ standard is C++20.
+ result = ::readdir(_dirp);
if (result == NULL) {
_entry.reset();
close();
diff --git a/contrib/kyua/utils/fs/operations.cpp b/contrib/kyua/utils/fs/operations.cpp
index 185d164b88d7..2b80fe317b94 100644
--- a/contrib/kyua/utils/fs/operations.cpp
+++ b/contrib/kyua/utils/fs/operations.cpp
@@ -104,51 +104,11 @@ static enum os_type current_os =
;
-/// Specifies if a real unmount(2) is available.
-///
-/// We use this as a constant instead of a macro so that we can compile both
-/// versions of the unmount code unconditionally. This is a way to prevent
-/// compilation bugs going unnoticed for long.
-static const bool have_unmount2 =
-#if defined(HAVE_UNMOUNT)
- true;
-#else
- false;
-#endif
-
-
-#if !defined(UMOUNT)
-/// Fake replacement value to the path to umount(8).
-# define UMOUNT "do-not-use-this-value"
-#else
-# if defined(HAVE_UNMOUNT)
-# error "umount(8) detected when unmount(2) is also available"
-# endif
-#endif
-
-
-#if !defined(HAVE_UNMOUNT)
-/// Fake unmount(2) function for systems without it.
-///
-/// This is only provided to allow our code to compile in all platforms
-/// regardless of whether they actually have an unmount(2) or not.
-///
-/// \return -1 to indicate error, although this should never happen.
-static int
-unmount(const char* /* path */,
- const int /* flags */)
-{
- PRE(false);
- return -1;
-}
-#endif
-
-
/// Error code returned by subprocess to indicate a controlled failure.
const int exit_known_error = 123;
-static void run_mount_tmpfs(const fs::path&, const uint64_t) UTILS_NORETURN;
+static void run_mount_tmpfs [[noreturn]] (const fs::path&, const uint64_t);
/// Executes 'mount -t tmpfs' (or a similar variant).
@@ -230,72 +190,30 @@ run_mount_tmpfs(const fs::path& mount_point, const uint64_t size)
}
-/// Unmounts a file system using unmount(2).
+/// Unmounts a file system using unmount(2) or umount(2).
///
-/// \pre unmount(2) must be available; i.e. have_unmount2 must be true.
+/// This is a thin wrapper around the filesystem implementation for the actual
+/// underlying system call which implements filesystem unmounting function.
///
/// \param mount_point The file system to unmount.
///
-/// \throw fs::system_error If the call to unmount(2) fails.
+/// \throw fs::system_error The unmount operation fails.
static void
-unmount_with_unmount2(const fs::path& mount_point)
+unmount_impl(const fs::path& mount_point)
{
- PRE(have_unmount2);
- if (::unmount(mount_point.c_str(), 0) == -1) {
- const int original_errno = errno;
- throw fs::system_error(F("unmount(%s) failed") % mount_point,
- original_errno);
- }
-}
-
-
-/// Unmounts a file system using umount(8).
-///
-/// \pre umount(2) must not be available; i.e. have_unmount2 must be false.
-///
-/// \param mount_point The file system to unmount.
-///
-/// \throw fs::error If the execution of umount(8) fails.
-static void
-unmount_with_umount8(const fs::path& mount_point)
-{
- PRE(!have_unmount2);
-
- const pid_t pid = ::fork();
- if (pid == -1) {
- const int original_errno = errno;
- throw fs::system_error("Cannot fork to execute unmount tool",
- original_errno);
- } else if (pid == 0) {
- const int ret = ::execlp(UMOUNT, "umount", mount_point.c_str(), NULL);
- INV(ret == -1);
- std::cerr << "Failed to exec " UMOUNT "\n";
- std::exit(EXIT_FAILURE);
- }
-
- int status;
-retry:
- if (::waitpid(pid, &status, 0) == -1) {
- const int original_errno = errno;
- if (errno == EINTR)
- goto retry;
- throw fs::system_error("Failed to wait for unmount subprocess",
- original_errno);
- }
-
- if (WIFEXITED(status)) {
- if (WEXITSTATUS(status) == EXIT_SUCCESS)
- return;
- else
- throw fs::error(F("Failed to unmount %s; returned exit code %s")
- % mount_point % WEXITSTATUS(status));
- } else
- throw fs::error(F("Failed to unmount %s; unmount tool received signal")
- % mount_point);
+#if defined(HAVE_UNMOUNT)
+ if (::unmount(mount_point.c_str(), 0) == 0)
+ return;
+#elif defined(HAVE_UMOUNT)
+ if (::umount(mount_point.c_str()) == 0)
+ return;
+#endif
+ const int original_errno = errno;
+ throw fs::system_error(F("unmount(%s) failed") % mount_point,
+ original_errno);
}
-
/// Stats a file, without following links.
///
/// \param path The file to stat.
@@ -788,11 +706,7 @@ fs::unmount(const fs::path& in_mount_point)
int retries = unmount_retries;
retry:
try {
- if (have_unmount2) {
- unmount_with_unmount2(mount_point);
- } else {
- unmount_with_umount8(mount_point);
- }
+ unmount_impl(mount_point);
} catch (const fs::system_error& error) {
if (error.original_errno() == EBUSY && retries > 0) {
LW(F("%s busy; unmount retries left %s") % mount_point % retries);
diff --git a/contrib/kyua/utils/logging/Makefile.am.inc b/contrib/kyua/utils/logging/Makefile.am.inc
deleted file mode 100644
index 7d88f16859d7..000000000000
--- a/contrib/kyua/utils/logging/Makefile.am.inc
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2011 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-UTILS_CFLAGS += $(LUTOK_CFLAGS)
-UTILS_LIBS += $(LUTOK_LIBS)
-
-libutils_a_CPPFLAGS += $(LUTOK_CFLAGS)
-libutils_a_SOURCES += utils/logging/macros.hpp
-libutils_a_SOURCES += utils/logging/operations.cpp
-libutils_a_SOURCES += utils/logging/operations.hpp
-libutils_a_SOURCES += utils/logging/operations_fwd.hpp
-
-if WITH_ATF
-tests_utils_loggingdir = $(pkgtestsdir)/utils/logging
-
-tests_utils_logging_DATA = utils/logging/Kyuafile
-EXTRA_DIST += $(tests_utils_logging_DATA)
-
-tests_utils_logging_PROGRAMS = utils/logging/macros_test
-utils_logging_macros_test_SOURCES = utils/logging/macros_test.cpp
-utils_logging_macros_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_logging_macros_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_logging_PROGRAMS += utils/logging/operations_test
-utils_logging_operations_test_SOURCES = utils/logging/operations_test.cpp
-utils_logging_operations_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_logging_operations_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/process/.gitignore b/contrib/kyua/utils/process/.gitignore
deleted file mode 100644
index fb3291b39e0c..000000000000
--- a/contrib/kyua/utils/process/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-helpers
diff --git a/contrib/kyua/utils/process/Kyuafile b/contrib/kyua/utils/process/Kyuafile
index 37ab662982d5..92e62cfac6fc 100644
--- a/contrib/kyua/utils/process/Kyuafile
+++ b/contrib/kyua/utils/process/Kyuafile
@@ -6,7 +6,6 @@ atf_test_program{name="child_test"}
atf_test_program{name="deadline_killer_test"}
atf_test_program{name="exceptions_test"}
atf_test_program{name="executor_test"}
-atf_test_program{name="executor_pid_test"}
atf_test_program{name="fdstream_test"}
atf_test_program{name="isolation_test"}
atf_test_program{name="operations_test"}
diff --git a/contrib/kyua/utils/process/Makefile.am.inc b/contrib/kyua/utils/process/Makefile.am.inc
deleted file mode 100644
index 5ce894091a53..000000000000
--- a/contrib/kyua/utils/process/Makefile.am.inc
+++ /dev/null
@@ -1,118 +0,0 @@
-# Copyright 2010 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-libutils_a_SOURCES += utils/process/child.cpp
-libutils_a_SOURCES += utils/process/child.hpp
-libutils_a_SOURCES += utils/process/child.ipp
-libutils_a_SOURCES += utils/process/child_fwd.hpp
-libutils_a_SOURCES += utils/process/deadline_killer.cpp
-libutils_a_SOURCES += utils/process/deadline_killer.hpp
-libutils_a_SOURCES += utils/process/deadline_killer_fwd.hpp
-libutils_a_SOURCES += utils/process/exceptions.cpp
-libutils_a_SOURCES += utils/process/exceptions.hpp
-libutils_a_SOURCES += utils/process/executor.cpp
-libutils_a_SOURCES += utils/process/executor.hpp
-libutils_a_SOURCES += utils/process/executor.ipp
-libutils_a_SOURCES += utils/process/executor_fwd.hpp
-libutils_a_SOURCES += utils/process/fdstream.cpp
-libutils_a_SOURCES += utils/process/fdstream.hpp
-libutils_a_SOURCES += utils/process/fdstream_fwd.hpp
-libutils_a_SOURCES += utils/process/isolation.cpp
-libutils_a_SOURCES += utils/process/isolation.hpp
-libutils_a_SOURCES += utils/process/operations.cpp
-libutils_a_SOURCES += utils/process/operations.hpp
-libutils_a_SOURCES += utils/process/operations_fwd.hpp
-libutils_a_SOURCES += utils/process/status.cpp
-libutils_a_SOURCES += utils/process/status.hpp
-libutils_a_SOURCES += utils/process/status_fwd.hpp
-libutils_a_SOURCES += utils/process/system.cpp
-libutils_a_SOURCES += utils/process/system.hpp
-libutils_a_SOURCES += utils/process/systembuf.cpp
-libutils_a_SOURCES += utils/process/systembuf.hpp
-libutils_a_SOURCES += utils/process/systembuf_fwd.hpp
-
-if WITH_ATF
-tests_utils_processdir = $(pkgtestsdir)/utils/process
-
-tests_utils_process_DATA = utils/process/Kyuafile
-EXTRA_DIST += $(tests_utils_process_DATA)
-
-tests_utils_process_PROGRAMS = utils/process/child_test
-utils_process_child_test_SOURCES = utils/process/child_test.cpp
-utils_process_child_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_child_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/deadline_killer_test
-utils_process_deadline_killer_test_SOURCES = \
- utils/process/deadline_killer_test.cpp
-utils_process_deadline_killer_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_deadline_killer_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/exceptions_test
-utils_process_exceptions_test_SOURCES = utils/process/exceptions_test.cpp
-utils_process_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/executor_test
-utils_process_executor_test_SOURCES = utils/process/executor_test.cpp
-utils_process_executor_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_executor_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/executor_pid_test
-utils_process_executor_pid_test_SOURCES = utils/process/executor_pid_test.cpp
-utils_process_executor_pid_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_executor_pid_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/fdstream_test
-utils_process_fdstream_test_SOURCES = utils/process/fdstream_test.cpp
-utils_process_fdstream_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_fdstream_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/isolation_test
-utils_process_isolation_test_SOURCES = utils/process/isolation_test.cpp
-utils_process_isolation_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_isolation_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/helpers
-utils_process_helpers_SOURCES = utils/process/helpers.cpp
-
-tests_utils_process_PROGRAMS += utils/process/operations_test
-utils_process_operations_test_SOURCES = utils/process/operations_test.cpp
-utils_process_operations_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_operations_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/status_test
-utils_process_status_test_SOURCES = utils/process/status_test.cpp
-utils_process_status_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_status_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_process_PROGRAMS += utils/process/systembuf_test
-utils_process_systembuf_test_SOURCES = utils/process/systembuf_test.cpp
-utils_process_systembuf_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_process_systembuf_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/process/child.hpp b/contrib/kyua/utils/process/child.hpp
index fbe32311a05b..bddf4b67fe0b 100644
--- a/contrib/kyua/utils/process/child.hpp
+++ b/contrib/kyua/utils/process/child.hpp
@@ -64,8 +64,8 @@ namespace process {
namespace detail {
-void report_error_and_abort(void) UTILS_NORETURN;
-void report_error_and_abort(const std::runtime_error&) UTILS_NORETURN;
+void report_error_and_abort [[noreturn]] (void);
+void report_error_and_abort [[noreturn]] (const std::runtime_error&);
} // namespace detail
diff --git a/contrib/kyua/utils/process/child_test.cpp b/contrib/kyua/utils/process/child_test.cpp
index 68911ae04660..79fa4d782b38 100644
--- a/contrib/kyua/utils/process/child_test.cpp
+++ b/contrib/kyua/utils/process/child_test.cpp
@@ -255,7 +255,7 @@ open_fail(const char* path, const int flags, ...) throw()
///
/// \return Always -1.
template< int Errno >
-static pid_t
+static int
pipe_fail(int* /* fildes */) throw()
{
errno = Errno;
diff --git a/contrib/kyua/utils/process/executor.cpp b/contrib/kyua/utils/process/executor.cpp
index bddbeee7605f..c1ea3d088c34 100644
--- a/contrib/kyua/utils/process/executor.cpp
+++ b/contrib/kyua/utils/process/executor.cpp
@@ -693,6 +693,8 @@ struct utils::process::executor::executor_handle::impl : utils::noncopyable {
executor::exit_handle
reap(const pid_t original_pid)
{
+ PRE(original_pid > 0);
+
const exec_handles_map::iterator iter = all_exec_handles.find(
original_pid);
exec_handle& data = (*iter).second;
diff --git a/contrib/kyua/utils/process/executor_pid_test.cpp b/contrib/kyua/utils/process/executor_pid_test.cpp
deleted file mode 100644
index 22e0b90ba14b..000000000000
--- a/contrib/kyua/utils/process/executor_pid_test.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 2022 Dell Inc.
- * Author: Eric van Gyzen
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-
-1. Run some "bad" tests that prevent kyua from removing the work directory.
- We use "chflags uunlink". Mounting a file system from an md(4) device
- is another common use case.
-2. Fork a lot, nearly wrapping the PID number space, so step 3 will re-use
- a PID from step 1. Running the entire FreeBSD test suite is a more
- realistic scenario for this step.
-3. Run some more tests. If the stars align, the bug is not fixed yet, and
- kyua is built with debugging, kyua will abort with the following messages.
- Without debugging, the tests in step 3 will reuse the context from step 1,
- including stdout, stderr, and working directory, which are still populated
- with stuff from step 1. When I found this bug, step 3 was
- __test_cases_list__, which expects a certain format in stdout and failed
- when it found something completely unrelated.
-4. You can clean up with: chflags -R nouunlink /tmp/kyua.*; rm -rf /tmp/kyua.*
-
-$ cc -o pid_wrap -latf-c pid_wrap.c
-$ kyua test
-pid_wrap:leak_0 -> passed [0.001s]
-pid_wrap:leak_1 -> passed [0.001s]
-pid_wrap:leak_2 -> passed [0.001s]
-pid_wrap:leak_3 -> passed [0.001s]
-pid_wrap:leak_4 -> passed [0.001s]
-pid_wrap:leak_5 -> passed [0.001s]
-pid_wrap:leak_6 -> passed [0.001s]
-pid_wrap:leak_7 -> passed [0.001s]
-pid_wrap:leak_8 -> passed [0.001s]
-pid_wrap:leak_9 -> passed [0.001s]
-pid_wrap:pid_wrap -> passed [1.113s]
-pid_wrap:pid_wrap_0 -> passed [0.001s]
-pid_wrap:pid_wrap_1 -> passed [0.001s]
-pid_wrap:pid_wrap_2 -> passed [0.001s]
-pid_wrap:pid_wrap_3 -> *** /usr/src/main/contrib/kyua/utils/process/executor.cpp:779: Invariant check failed: PID 60876 already in all_exec_handles; not properly cleaned up or reused too fast
-*** Fatal signal 6 received
-*** Log file is /home/vangyzen/.kyua/logs/kyua.20221006-193544.log
-*** Please report this problem to kyua-discuss@googlegroups.com detailing what you were doing before the crash happened; if possible, include the log file mentioned above
-Abort trap (core dumped)
-
-#endif
-
-#include <sys/stat.h>
-
-#include <atf-c++.hpp>
-
-#include <fcntl.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <cerrno>
-#include <cstring>
-
-void
-leak_work_dir()
-{
- int fd;
-
- ATF_REQUIRE((fd = open("unforgettable", O_CREAT|O_EXCL|O_WRONLY, 0600))
- >= 0);
- ATF_REQUIRE_EQ(0, fchflags(fd, UF_NOUNLINK));
- ATF_REQUIRE_EQ(0, close(fd));
-}
-
-void
-wrap_pids()
-{
- pid_t begin, current, target;
- bool wrapped;
-
- begin = getpid();
- target = begin - 15;
- if (target <= 1) {
- target += 99999; // PID_MAX
- wrapped = true;
- } else {
- wrapped = false;
- }
-
- ATF_REQUIRE(signal(SIGCHLD, SIG_IGN) != SIG_ERR);
-
- do {
- current = vfork();
- if (current == 0) {
- _exit(0);
- }
- ATF_REQUIRE(current != -1);
- if (current < begin) {
- wrapped = true;
- }
- } while (!wrapped || current < target);
-}
-
-void
-test_work_dir_reuse()
-{
- // If kyua is built with debugging, it would abort here before the fix.
-}
-
-void
-clean_up()
-{
- (void)system("chflags -R nouunlink ../..");
-}
-
-ATF_TEST_CASE_WITHOUT_HEAD(leak_0);
-ATF_TEST_CASE_BODY(leak_0) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_1);
-ATF_TEST_CASE_BODY(leak_1) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_2);
-ATF_TEST_CASE_BODY(leak_2) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_3);
-ATF_TEST_CASE_BODY(leak_3) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_4);
-ATF_TEST_CASE_BODY(leak_4) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_5);
-ATF_TEST_CASE_BODY(leak_5) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_6);
-ATF_TEST_CASE_BODY(leak_6) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_7);
-ATF_TEST_CASE_BODY(leak_7) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_8);
-ATF_TEST_CASE_BODY(leak_8) { leak_work_dir(); }
-ATF_TEST_CASE_WITHOUT_HEAD(leak_9);
-ATF_TEST_CASE_BODY(leak_9) { leak_work_dir(); }
-
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap);
-ATF_TEST_CASE_BODY(pid_wrap) { wrap_pids(); }
-
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_0);
-ATF_TEST_CASE_BODY(pid_wrap_0) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_1);
-ATF_TEST_CASE_BODY(pid_wrap_1) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_2);
-ATF_TEST_CASE_BODY(pid_wrap_2) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_3);
-ATF_TEST_CASE_BODY(pid_wrap_3) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_4);
-ATF_TEST_CASE_BODY(pid_wrap_4) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_5);
-ATF_TEST_CASE_BODY(pid_wrap_5) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_6);
-ATF_TEST_CASE_BODY(pid_wrap_6) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_7);
-ATF_TEST_CASE_BODY(pid_wrap_7) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_8);
-ATF_TEST_CASE_BODY(pid_wrap_8) { test_work_dir_reuse(); }
-ATF_TEST_CASE_WITHOUT_HEAD(pid_wrap_9);
-ATF_TEST_CASE_BODY(pid_wrap_9) { test_work_dir_reuse(); }
-
-ATF_TEST_CASE_WITHOUT_HEAD(really_clean_up);
-ATF_TEST_CASE_BODY(really_clean_up) { clean_up(); }
-
-ATF_INIT_TEST_CASES(tcs)
-{
- ATF_ADD_TEST_CASE(tcs, leak_0);
- ATF_ADD_TEST_CASE(tcs, leak_1);
- ATF_ADD_TEST_CASE(tcs, leak_2);
- ATF_ADD_TEST_CASE(tcs, leak_3);
- ATF_ADD_TEST_CASE(tcs, leak_4);
- ATF_ADD_TEST_CASE(tcs, leak_5);
- ATF_ADD_TEST_CASE(tcs, leak_6);
- ATF_ADD_TEST_CASE(tcs, leak_7);
- ATF_ADD_TEST_CASE(tcs, leak_8);
- ATF_ADD_TEST_CASE(tcs, leak_9);
-
- ATF_ADD_TEST_CASE(tcs, pid_wrap);
-
- ATF_ADD_TEST_CASE(tcs, pid_wrap_0);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_1);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_2);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_3);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_4);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_5);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_6);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_7);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_8);
- ATF_ADD_TEST_CASE(tcs, pid_wrap_9);
-
- ATF_ADD_TEST_CASE(tcs, really_clean_up);
-}
diff --git a/contrib/kyua/utils/process/executor_test.cpp b/contrib/kyua/utils/process/executor_test.cpp
index 13ae69bd44ed..b52730b5c71c 100644
--- a/contrib/kyua/utils/process/executor_test.cpp
+++ b/contrib/kyua/utils/process/executor_test.cpp
@@ -80,7 +80,7 @@ using utils::optional;
static const datetime::delta infinite_timeout(1000000, 0);
-static void do_exit(const int) UTILS_NORETURN;
+static void do_exit [[noreturn]] (const int);
/// Terminates a subprocess without invoking destructors.
@@ -118,8 +118,7 @@ public:
/// Runs the subprocess.
void
- operator()(const fs::path& /* control_directory */)
- UTILS_NORETURN
+ operator() [[noreturn]] (const fs::path& /* control_directory */)
{
std::cout << "Creating cookie: " << _cookie_name << " (stdout)\n";
std::cerr << "Creating cookie: " << _cookie_name << " (stderr)\n";
@@ -129,7 +128,7 @@ public:
};
-static void child_delete_all(const fs::path&) UTILS_NORETURN;
+static void child_delete_all [[noreturn]] (const fs::path&);
/// Subprocess that deletes all files in the current directory.
@@ -155,7 +154,7 @@ child_delete_all(const fs::path& control_directory)
}
-static void child_dump_unprivileged_user(const fs::path&) UTILS_NORETURN;
+static void child_dump_unprivileged_user [[noreturn]] (const fs::path&);
/// Subprocess that dumps user configuration.
@@ -183,15 +182,14 @@ public:
/// Runs the subprocess.
void
- operator()(const fs::path& /* control_directory */)
- UTILS_NORETURN
+ operator() [[noreturn]] (const fs::path& /* control_directory */)
{
do_exit(_exit_code);
}
};
-static void child_pause(const fs::path&) UTILS_NORETURN;
+static void child_pause [[noreturn]] (const fs::path&);
/// Subprocess that just blocks.
@@ -207,7 +205,7 @@ child_pause(const fs::path& /* control_directory */)
}
-static void child_print(const fs::path&) UTILS_NORETURN;
+static void child_print [[noreturn]] (const fs::path&);
/// Subprocess that writes to stdout and stderr.
@@ -236,8 +234,7 @@ public:
/// Runs the subprocess.
void
- operator()(const fs::path& /* control_directory */)
- UTILS_NORETURN
+ operator() [[noreturn]] (const fs::path& /* control_directory */)
{
::sleep(_seconds);
do_exit(EXIT_SUCCESS);
@@ -245,7 +242,7 @@ public:
};
-static void child_spawn_blocking_child(const fs::path&) UTILS_NORETURN;
+static void child_spawn_blocking_child [[noreturn]] (const fs::path&);
/// Subprocess that spawns a subchild that gets stuck.
@@ -278,7 +275,7 @@ child_spawn_blocking_child(
}
-static void child_validate_isolation(const fs::path&) UTILS_NORETURN;
+static void child_validate_isolation [[noreturn]] (const fs::path&);
/// Subprocess that checks if isolate_child() has been called.
diff --git a/contrib/kyua/utils/process/isolation.cpp b/contrib/kyua/utils/process/isolation.cpp
index 90dd08d5772d..3b2ecaa3e992 100644
--- a/contrib/kyua/utils/process/isolation.cpp
+++ b/contrib/kyua/utils/process/isolation.cpp
@@ -67,7 +67,7 @@ const int process::exit_isolation_failure = 124;
namespace {
-static void fail(const std::string&, const int) UTILS_NORETURN;
+static void fail [[noreturn]] (const std::string&, const int);
/// Fails the process with an errno-based error message.
diff --git a/contrib/kyua/utils/process/operations.cpp b/contrib/kyua/utils/process/operations.cpp
index abcc49f2a443..284b5e0e998a 100644
--- a/contrib/kyua/utils/process/operations.cpp
+++ b/contrib/kyua/utils/process/operations.cpp
@@ -31,7 +31,6 @@
extern "C" {
#include <sys/types.h>
#include <sys/wait.h>
-
#include <signal.h>
#include <unistd.h>
}
@@ -164,7 +163,7 @@ process::exec_unsafe(const fs::path& program, const args_vector& args)
argv[1 + args.size()] = NULL;
const int ret = ::execv(program.c_str(),
- (char* const*)(unsigned long)(const void*)argv);
+ UTILS_UNCONST(char* const, argv));
original_errno = errno;
INV(ret == -1);
std::cerr << "Failed to execute " << program << ": "
diff --git a/contrib/kyua/utils/process/operations.hpp b/contrib/kyua/utils/process/operations.hpp
index 773f9d38bb74..781d7d84af8e 100644
--- a/contrib/kyua/utils/process/operations.hpp
+++ b/contrib/kyua/utils/process/operations.hpp
@@ -42,10 +42,10 @@ namespace utils {
namespace process {
-void exec(const utils::fs::path&, const args_vector&) throw() UTILS_NORETURN;
-void exec_unsafe(const utils::fs::path&, const args_vector&) UTILS_NORETURN;
+void exec [[noreturn]] (const utils::fs::path&, const args_vector&) throw();
+void exec_unsafe [[noreturn]] (const utils::fs::path&, const args_vector&);
void terminate_group(const int);
-void terminate_self_with(const status&) UTILS_NORETURN;
+void terminate_self_with [[noreturn]] (const status&);
status wait(const int);
status wait_any(void);
diff --git a/contrib/kyua/utils/process/operations_test.cpp b/contrib/kyua/utils/process/operations_test.cpp
index d30dc890abd2..863e0937fe0a 100644
--- a/contrib/kyua/utils/process/operations_test.cpp
+++ b/contrib/kyua/utils/process/operations_test.cpp
@@ -117,7 +117,7 @@ child_exit(void)
}
-static void suspend(void) UTILS_NORETURN;
+static void suspend [[noreturn]] (void);
/// Blocks a subprocess from running indefinitely.
@@ -132,7 +132,7 @@ suspend(void)
}
-static void write_loop(const int) UTILS_NORETURN;
+static void write_loop [[noreturn]] (const int);
/// Provides an infinite stream of data in a subprocess.
diff --git a/contrib/kyua/utils/sanity.hpp b/contrib/kyua/utils/sanity.hpp
index 6b126f984999..d4bde12e8060 100644
--- a/contrib/kyua/utils/sanity.hpp
+++ b/contrib/kyua/utils/sanity.hpp
@@ -49,8 +49,8 @@
namespace utils {
-void sanity_failure(const assert_type, const char*, const size_t,
- const std::string&) UTILS_NORETURN;
+void sanity_failure [[noreturn]](
+ const assert_type, const char*, const size_t, const std::string&);
void install_crash_handlers(const std::string&);
diff --git a/contrib/kyua/utils/signals/Makefile.am.inc b/contrib/kyua/utils/signals/Makefile.am.inc
deleted file mode 100644
index b01089c80fea..000000000000
--- a/contrib/kyua/utils/signals/Makefile.am.inc
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright 2010 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-libutils_a_SOURCES += utils/signals/exceptions.cpp
-libutils_a_SOURCES += utils/signals/exceptions.hpp
-libutils_a_SOURCES += utils/signals/interrupts.cpp
-libutils_a_SOURCES += utils/signals/interrupts.hpp
-libutils_a_SOURCES += utils/signals/interrupts_fwd.hpp
-libutils_a_SOURCES += utils/signals/misc.cpp
-libutils_a_SOURCES += utils/signals/misc.hpp
-libutils_a_SOURCES += utils/signals/programmer.cpp
-libutils_a_SOURCES += utils/signals/programmer.hpp
-libutils_a_SOURCES += utils/signals/programmer_fwd.hpp
-libutils_a_SOURCES += utils/signals/timer.cpp
-libutils_a_SOURCES += utils/signals/timer.hpp
-libutils_a_SOURCES += utils/signals/timer_fwd.hpp
-
-if WITH_ATF
-tests_utils_signalsdir = $(pkgtestsdir)/utils/signals
-
-tests_utils_signals_DATA = utils/signals/Kyuafile
-EXTRA_DIST += $(tests_utils_signals_DATA)
-
-tests_utils_signals_PROGRAMS = utils/signals/exceptions_test
-utils_signals_exceptions_test_SOURCES = utils/signals/exceptions_test.cpp
-utils_signals_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_signals_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_signals_PROGRAMS += utils/signals/interrupts_test
-utils_signals_interrupts_test_SOURCES = utils/signals/interrupts_test.cpp
-utils_signals_interrupts_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_signals_interrupts_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_signals_PROGRAMS += utils/signals/misc_test
-utils_signals_misc_test_SOURCES = utils/signals/misc_test.cpp
-utils_signals_misc_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_signals_misc_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_signals_PROGRAMS += utils/signals/programmer_test
-utils_signals_programmer_test_SOURCES = utils/signals/programmer_test.cpp
-utils_signals_programmer_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_signals_programmer_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_signals_PROGRAMS += utils/signals/timer_test
-utils_signals_timer_test_SOURCES = utils/signals/timer_test.cpp
-utils_signals_timer_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_signals_timer_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/signals/misc_test.cpp b/contrib/kyua/utils/signals/misc_test.cpp
index 3b6d57325ee1..398cf50c4c2b 100644
--- a/contrib/kyua/utils/signals/misc_test.cpp
+++ b/contrib/kyua/utils/signals/misc_test.cpp
@@ -51,7 +51,7 @@ namespace signals = utils::signals;
namespace {
-static void program_reset_raise(void) UTILS_NORETURN;
+static void program_reset_raise [[noreturn]] (void);
/// Body of a subprocess that tests the signals::reset function.
diff --git a/contrib/kyua/utils/sqlite/Makefile.am.inc b/contrib/kyua/utils/sqlite/Makefile.am.inc
deleted file mode 100644
index 6064a641c14f..000000000000
--- a/contrib/kyua/utils/sqlite/Makefile.am.inc
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright 2011 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-UTILS_CFLAGS += $(SQLITE3_CFLAGS)
-UTILS_LIBS += $(SQLITE3_LIBS)
-
-libutils_a_CPPFLAGS += $(SQLITE3_CFLAGS)
-libutils_a_SOURCES += utils/sqlite/c_gate.cpp
-libutils_a_SOURCES += utils/sqlite/c_gate.hpp
-libutils_a_SOURCES += utils/sqlite/c_gate_fwd.hpp
-libutils_a_SOURCES += utils/sqlite/database.cpp
-libutils_a_SOURCES += utils/sqlite/database.hpp
-libutils_a_SOURCES += utils/sqlite/database_fwd.hpp
-libutils_a_SOURCES += utils/sqlite/exceptions.cpp
-libutils_a_SOURCES += utils/sqlite/exceptions.hpp
-libutils_a_SOURCES += utils/sqlite/statement.cpp
-libutils_a_SOURCES += utils/sqlite/statement.hpp
-libutils_a_SOURCES += utils/sqlite/statement_fwd.hpp
-libutils_a_SOURCES += utils/sqlite/statement.ipp
-libutils_a_SOURCES += utils/sqlite/transaction.cpp
-libutils_a_SOURCES += utils/sqlite/transaction.hpp
-libutils_a_SOURCES += utils/sqlite/transaction_fwd.hpp
-
-if WITH_ATF
-tests_utils_sqlitedir = $(pkgtestsdir)/utils/sqlite
-
-tests_utils_sqlite_DATA = utils/sqlite/Kyuafile
-EXTRA_DIST += $(tests_utils_sqlite_DATA)
-
-tests_utils_sqlite_PROGRAMS = utils/sqlite/c_gate_test
-utils_sqlite_c_gate_test_SOURCES = utils/sqlite/c_gate_test.cpp \
- utils/sqlite/test_utils.hpp
-utils_sqlite_c_gate_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_sqlite_c_gate_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_sqlite_PROGRAMS += utils/sqlite/database_test
-utils_sqlite_database_test_SOURCES = utils/sqlite/database_test.cpp \
- utils/sqlite/test_utils.hpp
-utils_sqlite_database_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_sqlite_database_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_sqlite_PROGRAMS += utils/sqlite/exceptions_test
-utils_sqlite_exceptions_test_SOURCES = utils/sqlite/exceptions_test.cpp
-utils_sqlite_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_sqlite_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_sqlite_PROGRAMS += utils/sqlite/statement_test
-utils_sqlite_statement_test_SOURCES = utils/sqlite/statement_test.cpp \
- utils/sqlite/test_utils.hpp
-utils_sqlite_statement_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_sqlite_statement_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_sqlite_PROGRAMS += utils/sqlite/transaction_test
-utils_sqlite_transaction_test_SOURCES = utils/sqlite/transaction_test.cpp
-utils_sqlite_transaction_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_sqlite_transaction_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/sqlite/database.hpp b/contrib/kyua/utils/sqlite/database.hpp
index ca91a6a360c6..6c6f259fba07 100644
--- a/contrib/kyua/utils/sqlite/database.hpp
+++ b/contrib/kyua/utils/sqlite/database.hpp
@@ -43,6 +43,7 @@ extern "C" {
#include <cstddef>
#include <memory>
+#include <string>
#include "utils/fs/path_fwd.hpp"
#include "utils/optional_fwd.hpp"
diff --git a/contrib/kyua/utils/sqlite/test_utils.hpp b/contrib/kyua/utils/sqlite/test_utils.hpp
index bf35d209a164..ba6b720b57ed 100644
--- a/contrib/kyua/utils/sqlite/test_utils.hpp
+++ b/contrib/kyua/utils/sqlite/test_utils.hpp
@@ -97,7 +97,7 @@ static const char* create_test_table_sql =
"INSERT INTO test (prime) VALUES (3);\n";
-static void create_test_table(::sqlite3*) UTILS_UNUSED;
+[[maybe_unused]] void create_test_table(::sqlite3*);
/// Creates a 'test' table in a database.
@@ -118,7 +118,7 @@ create_test_table(::sqlite3* db)
}
-static void verify_test_table(::sqlite3*) UTILS_UNUSED;
+[[maybe_unused]] void verify_test_table(::sqlite3*);
/// Verifies that the specified database contains the 'test' table.
diff --git a/contrib/kyua/utils/stacktrace.cpp b/contrib/kyua/utils/stacktrace.cpp
index 11636b31959f..30d8459c98c3 100644
--- a/contrib/kyua/utils/stacktrace.cpp
+++ b/contrib/kyua/utils/stacktrace.cpp
@@ -77,7 +77,7 @@ const char* utils::builtin_gdb = GDB;
/// Maximum time the external GDB process is allowed to run for.
-datetime::delta utils::gdb_timeout(60, 0);
+datetime::delta utils::gdb_timeout(300, 0);
namespace {
diff --git a/contrib/kyua/utils/stacktrace_test.cpp b/contrib/kyua/utils/stacktrace_test.cpp
index ca87e7087f5a..e3b170755764 100644
--- a/contrib/kyua/utils/stacktrace_test.cpp
+++ b/contrib/kyua/utils/stacktrace_test.cpp
@@ -94,7 +94,7 @@ public:
/// Runs the binary.
void
- operator()(void) const UTILS_NORETURN
+ operator() [[noreturn]] (void) const
{
atf::utils::copy_file(_binary.str(), _copy_name.str());
@@ -106,15 +106,14 @@ public:
///
/// This interface is exposed to support passing crash_me to the executor.
void
- operator()(const fs::path& /* control_directory */) const
- UTILS_NORETURN
+ operator() [[noreturn]] (const fs::path& /* control_directory */) const
{
(*this)(); // Delegate to ensure the two entry points remain in sync.
}
};
-static void child_exit(const fs::path&) UTILS_NORETURN;
+static void child_exit [[noreturn]] (const fs::path&);
/// Subprocess that exits cleanly.
@@ -125,7 +124,7 @@ child_exit(const fs::path& /* control_directory */)
}
-static void child_pause(const fs::path&) UTILS_NORETURN;
+static void child_pause [[noreturn]] (const fs::path&);
/// Subprocess that just blocks.
diff --git a/contrib/kyua/utils/test_utils.ipp b/contrib/kyua/utils/test_utils.ipp
index f21d0f4cc172..60b92adf5463 100644
--- a/contrib/kyua/utils/test_utils.ipp
+++ b/contrib/kyua/utils/test_utils.ipp
@@ -67,7 +67,7 @@ avoid_coredump_on_crash(void)
}
-inline void abort_without_coredump(void) UTILS_NORETURN;
+inline void abort_without_coredump [[noreturn]] (void);
/// Aborts execution and tries to not dump core.
diff --git a/contrib/kyua/utils/text/Makefile.am.inc b/contrib/kyua/utils/text/Makefile.am.inc
deleted file mode 100644
index d474ae191bf5..000000000000
--- a/contrib/kyua/utils/text/Makefile.am.inc
+++ /dev/null
@@ -1,74 +0,0 @@
-# Copyright 2012 The Kyua Authors.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-libutils_a_SOURCES += utils/text/exceptions.cpp
-libutils_a_SOURCES += utils/text/exceptions.hpp
-libutils_a_SOURCES += utils/text/operations.cpp
-libutils_a_SOURCES += utils/text/operations.hpp
-libutils_a_SOURCES += utils/text/operations.ipp
-libutils_a_SOURCES += utils/text/regex.cpp
-libutils_a_SOURCES += utils/text/regex.hpp
-libutils_a_SOURCES += utils/text/regex_fwd.hpp
-libutils_a_SOURCES += utils/text/table.cpp
-libutils_a_SOURCES += utils/text/table.hpp
-libutils_a_SOURCES += utils/text/table_fwd.hpp
-libutils_a_SOURCES += utils/text/templates.cpp
-libutils_a_SOURCES += utils/text/templates.hpp
-libutils_a_SOURCES += utils/text/templates_fwd.hpp
-
-if WITH_ATF
-tests_utils_textdir = $(pkgtestsdir)/utils/text
-
-tests_utils_text_DATA = utils/text/Kyuafile
-EXTRA_DIST += $(tests_utils_text_DATA)
-
-tests_utils_text_PROGRAMS = utils/text/exceptions_test
-utils_text_exceptions_test_SOURCES = utils/text/exceptions_test.cpp
-utils_text_exceptions_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_text_exceptions_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_text_PROGRAMS += utils/text/operations_test
-utils_text_operations_test_SOURCES = utils/text/operations_test.cpp
-utils_text_operations_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_text_operations_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_text_PROGRAMS += utils/text/regex_test
-utils_text_regex_test_SOURCES = utils/text/regex_test.cpp
-utils_text_regex_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_text_regex_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_text_PROGRAMS += utils/text/table_test
-utils_text_table_test_SOURCES = utils/text/table_test.cpp
-utils_text_table_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_text_table_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-
-tests_utils_text_PROGRAMS += utils/text/templates_test
-utils_text_templates_test_SOURCES = utils/text/templates_test.cpp
-utils_text_templates_test_CXXFLAGS = $(UTILS_CFLAGS) $(ATF_CXX_CFLAGS)
-utils_text_templates_test_LDADD = $(UTILS_LIBS) $(ATF_CXX_LIBS)
-endif
diff --git a/contrib/kyua/utils/text/operations.ipp b/contrib/kyua/utils/text/operations.ipp
index 511cd6840a08..eb29a0a5e8b7 100644
--- a/contrib/kyua/utils/text/operations.ipp
+++ b/contrib/kyua/utils/text/operations.ipp
@@ -31,6 +31,7 @@
#include "utils/text/operations.hpp"
+#include <string>
#include <sstream>
#include "utils/text/exceptions.hpp"
diff --git a/contrib/kyua/utils/text/regex.cpp b/contrib/kyua/utils/text/regex.cpp
index b078ba88f6b4..86b41cc872aa 100644
--- a/contrib/kyua/utils/text/regex.cpp
+++ b/contrib/kyua/utils/text/regex.cpp
@@ -47,8 +47,8 @@ namespace text = utils::text;
namespace {
-static void throw_regex_error(const int, const ::regex_t*, const std::string&)
- UTILS_NORETURN;
+static void throw_regex_error [[noreturn]] (
+ const int, const ::regex_t*, const std::string&);
/// Constructs and raises a regex_error.
diff --git a/contrib/kyua/utils/text/regex.hpp b/contrib/kyua/utils/text/regex.hpp
index b3d20c246735..d4981dfca3c6 100644
--- a/contrib/kyua/utils/text/regex.hpp
+++ b/contrib/kyua/utils/text/regex.hpp
@@ -36,6 +36,7 @@
#include <cstddef>
#include <memory>
+#include <string>
namespace utils {