diff options
| author | Enji Cooper <ngie@FreeBSD.org> | 2026-10-07 17:50:26 +0000 |
|---|---|---|
| committer | Enji Cooper <ngie@FreeBSD.org> | 2026-10-07 17:50:26 +0000 |
| commit | eb8f69902f7de8012a31a85db2f88a54584f81af (patch) | |
| tree | 1499ad12948cb1a4dbbc9860c46ec36e988087dc /contrib/kyua/utils/process | |
| parent | de2c0f157a9cce0b763da9ae97ada870fa4d1824 (diff) | |
| parent | 144afd05f8a2300361ec30c1c2020e4022ddd943 (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/process')
| -rw-r--r-- | contrib/kyua/utils/process/.gitignore | 1 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/Kyuafile | 1 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/Makefile.am.inc | 118 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/child.hpp | 4 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/child_test.cpp | 2 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/executor.cpp | 2 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/executor_pid_test.cpp | 208 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/executor_test.cpp | 23 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/isolation.cpp | 2 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/operations.cpp | 3 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/operations.hpp | 6 | ||||
| -rw-r--r-- | contrib/kyua/utils/process/operations_test.cpp | 4 |
12 files changed, 22 insertions, 352 deletions
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. |
