The branch stable/14 has been updated by ngie: URL: https://cgit.FreeBSD.org/src/commit/?id=159762ce4fb175df1431c0ce2b83df1753e26892
commit 159762ce4fb175df1431c0ce2b83df1753e26892 Author: Enji Cooper <[email protected]> AuthorDate: 2026-11-25 21:18:14 +0000 Commit: Enji Cooper <[email protected]> CommitDate: 2026-12-03 23:34:08 +0000 contrib/atf: upgrade to 0.26.1 This is a bugfix release. Please see the related merge commit for more details. MFC after: 1 week Merge commit 'bd8d548676ba2235320c105e0683a758ac742e8e' (cherry picked from commit 87fac2e0c07327a02791fef5d01123abd3e590fe) --- contrib/atf/NEWS | 55 +++ contrib/atf/README.md | 2 +- contrib/atf/atf-c++/atf_c++_test.cpp | 3 +- contrib/atf/atf-c++/build.cpp | 10 +- contrib/atf/atf-c++/build_test.cpp | 46 +- contrib/atf/atf-c++/check.cpp | 21 +- contrib/atf/atf-c++/check.hpp | 7 +- contrib/atf/atf-c++/check_test.cpp | 99 +++-- contrib/atf/atf-c++/detail/application.cpp | 61 +-- contrib/atf/atf-c++/detail/application.hpp | 2 +- contrib/atf/atf-c++/detail/application_test.cpp | 10 +- contrib/atf/atf-c++/detail/env_test.cpp | 3 +- contrib/atf/atf-c++/detail/exceptions.cpp | 23 +- contrib/atf/atf-c++/detail/exceptions.hpp | 2 +- contrib/atf/atf-c++/detail/exceptions_test.cpp | 32 +- contrib/atf/atf-c++/detail/fs.cpp | 119 ++--- contrib/atf/atf-c++/detail/fs.hpp | 6 +- contrib/atf/atf-c++/detail/fs_test.cpp | 88 ++-- contrib/atf/atf-c++/detail/process.cpp | 55 +-- contrib/atf/atf-c++/detail/process.hpp | 111 ++--- contrib/atf/atf-c++/detail/process_test.cpp | 69 +-- contrib/atf/atf-c++/detail/sanity.hpp | 2 +- contrib/atf/atf-c++/detail/test_helpers.cpp | 26 +- contrib/atf/atf-c++/detail/test_helpers.hpp | 66 +-- contrib/atf/atf-c++/detail/text.cpp | 30 +- contrib/atf/atf-c++/detail/text.hpp | 8 +- contrib/atf/atf-c++/detail/text_test.cpp | 33 +- contrib/atf/atf-c++/macros.hpp | 291 +++++++------ contrib/atf/atf-c++/macros_hpp_test.cpp | 48 +- contrib/atf/atf-c++/macros_test.cpp | 209 ++++----- contrib/atf/atf-c++/tests.cpp | 130 +++--- contrib/atf/atf-c++/tests.hpp | 10 +- contrib/atf/atf-c++/tests_test.cpp | 23 +- contrib/atf/atf-c++/unused_test.cpp | 4 +- contrib/atf/atf-c++/utils.cpp | 1 - contrib/atf/atf-c++/utils.hpp | 2 +- contrib/atf/atf-c++/utils_test.cpp | 25 +- contrib/atf/atf-c/atf-c.3 | 101 +++-- contrib/atf/atf-c/atf_c_test.c | 3 +- contrib/atf/atf-c/build.c | 66 ++- contrib/atf/atf-c/build.h | 16 +- contrib/atf/atf-c/build_test.c | 56 ++- contrib/atf/atf-c/check.c | 137 +++--- contrib/atf/atf-c/check.h | 37 +- contrib/atf/atf-c/check_test.c | 121 +++--- contrib/atf/atf-c/defs.h | 9 +- contrib/atf/atf-c/detail/dynstr.c | 71 ++- contrib/atf/atf-c/detail/dynstr.h | 46 +- contrib/atf/atf-c/detail/dynstr_test.c | 109 ++--- contrib/atf/atf-c/detail/env.c | 21 +- contrib/atf/atf-c/detail/env.h | 14 +- contrib/atf/atf-c/detail/env_test.c | 18 +- contrib/atf/atf-c/detail/fs.c | 244 ++++++----- contrib/atf/atf-c/detail/fs.h | 83 ++-- contrib/atf/atf-c/detail/fs_test.c | 320 ++++++++------ contrib/atf/atf-c/detail/list.c | 112 +++-- contrib/atf/atf-c/detail/list.h | 52 +-- contrib/atf/atf-c/detail/list_test.c | 49 ++- contrib/atf/atf-c/detail/map.c | 105 ++--- contrib/atf/atf-c/detail/map.h | 57 +-- contrib/atf/atf-c/detail/map_test.c | 37 +- contrib/atf/atf-c/detail/process.c | 220 ++++------ contrib/atf/atf-c/detail/process.h | 77 ++-- contrib/atf/atf-c/detail/process_helpers.c | 32 +- contrib/atf/atf-c/detail/process_test.c | 320 ++++++-------- contrib/atf/atf-c/detail/sanity.c | 17 +- contrib/atf/atf-c/detail/sanity.h | 32 +- contrib/atf/atf-c/detail/sanity_test.c | 34 +- contrib/atf/atf-c/detail/test_helpers.c | 44 +- contrib/atf/atf-c/detail/test_helpers.h | 78 ++-- contrib/atf/atf-c/detail/text.c | 40 +- contrib/atf/atf-c/detail/text.h | 21 +- contrib/atf/atf-c/detail/text_test.c | 145 ++++--- contrib/atf/atf-c/detail/tp_main.c | 178 ++++---- contrib/atf/atf-c/detail/user.c | 6 +- contrib/atf/atf-c/detail/user.h | 2 + contrib/atf/atf-c/detail/user_test.c | 17 +- contrib/atf/atf-c/error.c | 48 +- contrib/atf/atf-c/error.h | 28 +- contrib/atf/atf-c/error_fwd.h | 4 +- contrib/atf/atf-c/error_test.c | 47 +- contrib/atf/atf-c/h_build.h | 218 +++------- contrib/atf/atf-c/macros.h | 366 ++++++++-------- contrib/atf/atf-c/macros_h_test.c | 64 ++- contrib/atf/atf-c/macros_test.c | 555 ++++++++++++------------ contrib/atf/atf-c/tc.c | 472 ++++++++++---------- contrib/atf/atf-c/tc.h | 101 ++--- contrib/atf/atf-c/tc_test.c | 41 +- contrib/atf/atf-c/tp.c | 60 +-- contrib/atf/atf-c/tp.h | 24 +- contrib/atf/atf-c/tp_test.c | 25 +- contrib/atf/atf-c/unused_test.c | 4 +- contrib/atf/atf-c/utils.c | 71 +-- contrib/atf/atf-c/utils.h | 27 +- contrib/atf/atf-c/utils_test.c | 30 +- contrib/atf/atf-sh/atf-check.1 | 11 +- contrib/atf/atf-sh/atf-check.cpp | 304 +++++++------ contrib/atf/atf-sh/atf-check_test.sh | 130 ++++++ contrib/atf/atf-sh/atf-sh.cpp | 45 +- contrib/atf/atf-sh/integration_test.sh | 20 +- contrib/atf/config.h | 9 +- contrib/atf/test-programs/c_helpers.c | 63 +-- contrib/atf/test-programs/cpp_helpers.cpp | 22 +- 103 files changed, 3897 insertions(+), 3771 deletions(-) diff --git a/contrib/atf/NEWS b/contrib/atf/NEWS index e1c9e5f512f5..ce15f5603c30 100644 --- a/contrib/atf/NEWS +++ b/contrib/atf/NEWS @@ -1,5 +1,60 @@ # Major changes between releases +## Changes in version 0.26.1 + +Released on 2026/11/25. + +### Summary + +This release addresses a number of bugs in ATF that were present in +0.26[.0]. Most of these are Developer Workflow related, however, these +changes deserve special attention: + +* The remaining [known] memory leak issues were resolved by @holmuk in #215. +* A key issue with how macros in atf-c(3) are evaluated was also resolved by + @dag-erling in #229. + +### A Note on Versioning + +This release will be the first release that uses a [SemVer 2.0][] +compatible version. All future versions will start out with a subminor +version of .0, which will increase (monotonically), until the minor version +is bumped. + +[SemVer 2.0]: https://semver.org/ + +### Bugfixes + +* #128: SPDX license identifiers to atf-c +* #199: atf-check: remove pre-C++17 compatibility +* #202: atf-sh/integration_test: fix hang when invoked via kyua +* #203: atf_require_kmod: fix variable name typo +* #205: Add -v flag to atf-check +* #207: atf-c(3): mention `atf_tc_has_config_var` in manpage +* #214: feat: remove `std::vsnprintf` autotools tests/conditionals +* #215: Fix memory leaks reported by Linux ASAN/LSAN +* #219: feat(ci): update CI image/LLVM versions in use +* #221: fix(m4): Express basename and dirname tests using C +* #222: fix: don't spam C*FLAGS and LDFLAGS with ASAN/LSAN/UBSAN flags +* #223: fix: Improve legacy style assertion logic +* #229: atf-c: Guard against multiple evaluation +* #231: Fix Automake escaped-comment warning + +### Developer Workflow Changes + +* #200: [ci] add NetBSD 11.0-RELEASE job +* #208: feat(dev): add commit-check support to the project +* #209: chore: change `ubuntu-latest` to 24.04 where needed +* #210: fix(commit-check): tighten subject criteria +* #211: feat: Enforce C/C++ style in the project with `clang-format` +* #212: chore: change `NO_STYLE_CHECK*` to `NOLINT*` +* #217: Enable sanitizers for Linux, MacOS and FreeBSD +* #224: chore(ci): update FreeBSD 14 image from 14.4 to 14.5 +* #225: Add GHA build timeouts +* #226: chore(ci): sync ATF's build.yaml with Kyua's build.yaml + +**Full Changelog**: https://github.com/freebsd/atf/compare/atf-0.26...atf-0.26.1 + ## Changes in version 0.26 Released on 2026/09/22. diff --git a/contrib/atf/README.md b/contrib/atf/README.md index 0513546fc7cc..850e3dab89dc 100644 --- a/contrib/atf/README.md +++ b/contrib/atf/README.md @@ -18,7 +18,7 @@ this execution engine is *not* shipped with ATF. Formal releases for source files are available for download from GitHub: -* [atf 0.25](../../releases/tag/atf-0.25), released on September 2nd, 2026. +* [atf 0.26.1](../../releases/tag/atf-0.26.1), released on November 25th, 2026. ## Installation diff --git a/contrib/atf/atf-c++/atf_c++_test.cpp b/contrib/atf/atf-c++/atf_c++_test.cpp index cc708863f6cf..f60829a8986c 100644 --- a/contrib/atf/atf-c++/atf_c++_test.cpp +++ b/contrib/atf/atf-c++/atf_c++_test.cpp @@ -23,8 +23,7 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include <atf-c++.hpp> - +#include "atf-c++.hpp" #include "atf-c++/detail/test_helpers.hpp" // ------------------------------------------------------------------------ diff --git a/contrib/atf/atf-c++/build.cpp b/contrib/atf/atf-c++/build.cpp index f2f80f4eb453..ba9d95a76b13 100644 --- a/contrib/atf/atf-c++/build.cpp +++ b/contrib/atf/atf-c++/build.cpp @@ -41,21 +41,19 @@ namespace impl = atf::build; // Auxiliary functions. // ------------------------------------------------------------------------ -inline -atf::process::argv_array +inline atf::process::argv_array cargv_to_argv(const atf_list_t* l) { - std::vector< const char* > aux; + std::vector<const char*> aux; atf_list_citer_t iter; atf_list_for_each_c(iter, l) - aux.push_back(static_cast< const char* >(atf_list_citer_data(iter))); + aux.push_back(static_cast<const char*>(atf_list_citer_data(iter))); return atf::process::argv_array(aux); } -inline -atf::process::argv_array +inline atf::process::argv_array cargv_to_argv_and_free(char** l) { try { diff --git a/contrib/atf/atf-c++/build_test.cpp b/contrib/atf/atf-c++/build_test.cpp index 0a5ab9668af0..7d00b4241dad 100644 --- a/contrib/atf/atf-c++/build_test.cpp +++ b/contrib/atf/atf-c++/build_test.cpp @@ -23,17 +23,15 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "atf-c++/build.hpp" - #include <cstring> #include <iostream> -#include <atf-c++.hpp> - extern "C" { #include "atf-c/h_build.h" } +#include "atf-c++.hpp" +#include "atf-c++/build.hpp" #include "atf-c++/detail/env.hpp" #include "atf-c++/detail/process.hpp" @@ -41,19 +39,17 @@ extern "C" { // Auxiliary functions. // ------------------------------------------------------------------------ -template< class C > +template <class C> void print_col(const char* prefix, const C& c) { std::cout << prefix << ":"; - for (typename C::const_iterator iter = c.begin(); iter != c.end(); - iter++) + for (typename C::const_iterator iter = c.begin(); iter != c.end(); iter++) std::cout << " '" << *iter << "'"; std::cout << "\n"; } -static -void +static void print_array(const char* prefix, const char* const* a) { std::cout << prefix << ":"; @@ -62,16 +58,14 @@ print_array(const char* prefix, const char* const* a) std::cout << "\n"; } -static -void -verbose_set_env(const char *var, const char *val) +static void +verbose_set_env(const char* var, const char* val) { std::cout << "Setting " << var << " to '" << val << "'\n"; atf::env::set(var, val); } -static -bool +static bool equal_argvs(const atf::process::argv_array& aa, const char* const* array) { bool equal = true; @@ -90,8 +84,7 @@ equal_argvs(const atf::process::argv_array& aa, const char* const* array) return equal; } -static -void +static void check_equal_argvs(const atf::process::argv_array& aa, const char* const* array) { print_array("Expected arguments", array); @@ -152,17 +145,15 @@ ATF_TEST_CASE_HEAD(c_o) } ATF_TEST_CASE_BODY(c_o) { - for (struct c_o_test* test = c_o_tests; test->expargv[0] != NULL; - test++) { + for (struct c_o_test* test = c_o_tests; test->expargv[0] != NULL; test++) { std::cout << "> Test: " << test->msg << "\n"; verbose_set_env("ATF_BUILD_CC", test->cc); verbose_set_env("ATF_BUILD_CFLAGS", test->cflags); verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags); - atf::process::argv_array argv = - atf::build::c_o(test->sfile, test->ofile, - atf::process::argv_array(test->optargs)); + atf::process::argv_array argv = atf::build::c_o( + test->sfile, test->ofile, atf::process::argv_array(test->optargs)); check_equal_argvs(argv, test->expargv); } } @@ -174,16 +165,14 @@ ATF_TEST_CASE_HEAD(cpp) } ATF_TEST_CASE_BODY(cpp) { - for (struct cpp_test* test = cpp_tests; test->expargv[0] != NULL; - test++) { + for (struct cpp_test* test = cpp_tests; test->expargv[0] != NULL; test++) { std::cout << "> Test: " << test->msg << "\n"; verbose_set_env("ATF_BUILD_CPP", test->cpp); verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags); - atf::process::argv_array argv = - atf::build::cpp(test->sfile, test->ofile, - atf::process::argv_array(test->optargs)); + atf::process::argv_array argv = atf::build::cpp( + test->sfile, test->ofile, atf::process::argv_array(test->optargs)); check_equal_argvs(argv, test->expargv); } } @@ -203,9 +192,8 @@ ATF_TEST_CASE_BODY(cxx_o) verbose_set_env("ATF_BUILD_CXXFLAGS", test->cxxflags); verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags); - atf::process::argv_array argv = - atf::build::cxx_o(test->sfile, test->ofile, - atf::process::argv_array(test->optargs)); + atf::process::argv_array argv = atf::build::cxx_o( + test->sfile, test->ofile, atf::process::argv_array(test->optargs)); check_equal_argvs(argv, test->expargv); } } diff --git a/contrib/atf/atf-c++/check.cpp b/contrib/atf/atf-c++/check.cpp index 78da33fa9620..d81d1e40edb9 100644 --- a/contrib/atf/atf-c++/check.cpp +++ b/contrib/atf/atf-c++/check.cpp @@ -23,10 +23,10 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "atf-c++/check.hpp" - #include <cstring> +#include "atf-c++/check.hpp" + extern "C" { #include "atf-c/build.h" #include "atf-c/error.h" @@ -54,30 +54,26 @@ impl::check_result::~check_result(void) } bool -impl::check_result::exited(void) - const +impl::check_result::exited(void) const { return atf_check_result_exited(&m_result); } int -impl::check_result::exitcode(void) - const +impl::check_result::exitcode(void) const { PRE(exited()); return atf_check_result_exitcode(&m_result); } bool -impl::check_result::signaled(void) - const +impl::check_result::signaled(void) const { return atf_check_result_signaled(&m_result); } int -impl::check_result::termsig(void) - const +impl::check_result::termsig(void) const { PRE(signaled()); return atf_check_result_termsig(&m_result); @@ -141,7 +137,7 @@ impl::build_cxx_o(const std::string& sfile, const std::string& ofile, return success; } -std::unique_ptr< impl::check_result > +std::unique_ptr<impl::check_result> impl::exec(const atf::process::argv_array& argva) { atf_check_result_t result; @@ -150,6 +146,5 @@ impl::exec(const atf::process::argv_array& argva) if (atf_is_error(err)) throw_atf_error(err); - return std::unique_ptr< impl::check_result >( - new impl::check_result(&result)); + return std::unique_ptr<impl::check_result>(new impl::check_result(&result)); } diff --git a/contrib/atf/atf-c++/check.hpp b/contrib/atf/atf-c++/check.hpp index bcf9cb647f29..ac4fb5254991 100644 --- a/contrib/atf/atf-c++/check.hpp +++ b/contrib/atf/atf-c++/check.hpp @@ -27,7 +27,7 @@ #define ATF_CXX_CHECK_HPP extern "C" { -#include <atf-c/check.h> +#include "atf-c/check.h" } #include <cstddef> @@ -71,8 +71,7 @@ class check_result { check_result(const atf_check_result_t* result); friend check_result test_constructor(const char* const*); - friend std::unique_ptr< check_result > - exec(const atf::process::argv_array&); + friend std::unique_ptr<check_result> exec(const atf::process::argv_array&); public: //! @@ -121,7 +120,7 @@ bool build_cpp(const std::string&, const std::string&, const atf::process::argv_array&); bool build_cxx_o(const std::string&, const std::string&, const atf::process::argv_array&); -std::unique_ptr< check_result > exec(const atf::process::argv_array&); +std::unique_ptr<check_result> exec(const atf::process::argv_array&); // Useful for testing only. check_result test_constructor(void); diff --git a/contrib/atf/atf-c++/check_test.cpp b/contrib/atf/atf-c++/check_test.cpp index ecb5a9380e8f..0cdfa5c69024 100644 --- a/contrib/atf/atf-c++/check_test.cpp +++ b/contrib/atf/atf-c++/check_test.cpp @@ -23,8 +23,6 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "atf-c++/check.hpp" - extern "C" { #include <fcntl.h> #include <signal.h> @@ -39,8 +37,8 @@ extern "C" { #include <memory> #include <vector> -#include <atf-c++.hpp> - +#include "atf-c++.hpp" +#include "atf-c++/check.hpp" #include "atf-c++/detail/fs.hpp" #include "atf-c++/detail/process.hpp" #include "atf-c++/detail/test_helpers.hpp" @@ -51,11 +49,10 @@ extern "C" { // Auxiliary functions. // ------------------------------------------------------------------------ -static -std::unique_ptr< atf::check::check_result > +static std::unique_ptr<atf::check::check_result> do_exec(const atf::tests::tc* tc, const char* helper_name) { - std::vector< std::string > argv; + std::vector<std::string> argv; argv.push_back(get_process_helpers_path(*tc, false).str()); argv.push_back(helper_name); std::cout << "Executing " << argv[0] << " " << argv[1] << "\n"; @@ -64,16 +61,15 @@ do_exec(const atf::tests::tc* tc, const char* helper_name) return atf::check::exec(argva); } -static -std::unique_ptr< atf::check::check_result > -do_exec(const atf::tests::tc* tc, const char* helper_name, const char *carg2) +static std::unique_ptr<atf::check::check_result> +do_exec(const atf::tests::tc* tc, const char* helper_name, const char* carg2) { - std::vector< std::string > argv; + std::vector<std::string> argv; argv.push_back(get_process_helpers_path(*tc, false).str()); argv.push_back(helper_name); argv.push_back(carg2); - std::cout << "Executing " << argv[0] << " " << argv[1] << " " - << argv[2] << "\n"; + std::cout << "Executing " << argv[0] << " " << argv[1] << " " << argv[2] + << "\n"; atf::process::argv_array argva(argv); return atf::check::exec(argva); @@ -187,12 +183,12 @@ ATF_TEST_CASE_HEAD(build_c_o) ATF_TEST_CASE_BODY(build_c_o) { ATF_TEST_CASE_USE(h_build_c_o_ok); - run_h_tc< ATF_TEST_CASE_NAME(h_build_c_o_ok) >(); + run_h_tc<ATF_TEST_CASE_NAME(h_build_c_o_ok)>(); ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout")); ATF_REQUIRE(atf::utils::grep_file("-c test.c", "stdout")); ATF_TEST_CASE_USE(h_build_c_o_fail); - run_h_tc< ATF_TEST_CASE_NAME(h_build_c_o_fail) >(); + run_h_tc<ATF_TEST_CASE_NAME(h_build_c_o_fail)>(); ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout")); ATF_REQUIRE(atf::utils::grep_file("-c test.c", "stdout")); ATF_REQUIRE(atf::utils::grep_file("test.c", "stderr")); @@ -207,13 +203,13 @@ ATF_TEST_CASE_HEAD(build_cpp) ATF_TEST_CASE_BODY(build_cpp) { ATF_TEST_CASE_USE(h_build_cpp_ok); - run_h_tc< ATF_TEST_CASE_NAME(h_build_cpp_ok) >(); + run_h_tc<ATF_TEST_CASE_NAME(h_build_cpp_ok)>(); ATF_REQUIRE(atf::utils::grep_file("-o.*test.p", "stdout")); ATF_REQUIRE(atf::utils::grep_file("test.c", "stdout")); ATF_REQUIRE(atf::utils::grep_file("foo bar", "test.p")); ATF_TEST_CASE_USE(h_build_cpp_fail); - run_h_tc< ATF_TEST_CASE_NAME(h_build_cpp_fail) >(); + run_h_tc<ATF_TEST_CASE_NAME(h_build_cpp_fail)>(); ATF_REQUIRE(atf::utils::grep_file("-o test.p", "stdout")); ATF_REQUIRE(atf::utils::grep_file("test.c", "stdout")); ATF_REQUIRE(atf::utils::grep_file("test.c", "stderr")); @@ -228,12 +224,12 @@ ATF_TEST_CASE_HEAD(build_cxx_o) ATF_TEST_CASE_BODY(build_cxx_o) { ATF_TEST_CASE_USE(h_build_cxx_o_ok); - run_h_tc< ATF_TEST_CASE_NAME(h_build_cxx_o_ok) >(); + run_h_tc<ATF_TEST_CASE_NAME(h_build_cxx_o_ok)>(); ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout")); ATF_REQUIRE(atf::utils::grep_file("-c test.cpp", "stdout")); ATF_TEST_CASE_USE(h_build_cxx_o_fail); - run_h_tc< ATF_TEST_CASE_NAME(h_build_cxx_o_fail) >(); + run_h_tc<ATF_TEST_CASE_NAME(h_build_cxx_o_fail)>(); ATF_REQUIRE(atf::utils::grep_file("-o test.o", "stdout")); ATF_REQUIRE(atf::utils::grep_file("-c test.cpp", "stdout")); ATF_REQUIRE(atf::utils::grep_file("test.cpp", "stderr")); @@ -243,17 +239,18 @@ ATF_TEST_CASE_BODY(build_cxx_o) ATF_TEST_CASE(exec_cleanup); ATF_TEST_CASE_HEAD(exec_cleanup) { - set_md_var("descr", "Tests that exec properly cleans up the temporary " - "files it creates"); + set_md_var( + "descr", + "Tests that exec properly cleans up the temporary files it creates"); } ATF_TEST_CASE_BODY(exec_cleanup) { - std::unique_ptr< atf::fs::path > out; - std::unique_ptr< atf::fs::path > err; + std::unique_ptr<atf::fs::path> out; + std::unique_ptr<atf::fs::path> err; { - std::unique_ptr< atf::check::check_result > r = - do_exec(this, "exit-success"); + std::unique_ptr<atf::check::check_result> r = do_exec(this, + "exit-success"); out.reset(new atf::fs::path(r->stdout_path())); err.reset(new atf::fs::path(r->stderr_path())); ATF_REQUIRE(atf::fs::exists(*out.get())); @@ -266,68 +263,70 @@ ATF_TEST_CASE_BODY(exec_cleanup) ATF_TEST_CASE(exec_exitstatus); ATF_TEST_CASE_HEAD(exec_exitstatus) { - set_md_var("descr", "Tests that exec properly captures the exit " - "status of the executed command"); + set_md_var("descr", + "Tests that exec properly captures the exit status of the " + "executed command"); } ATF_TEST_CASE_BODY(exec_exitstatus) { { - std::unique_ptr< atf::check::check_result > r = - do_exec(this, "exit-success"); + std::unique_ptr<atf::check::check_result> r = do_exec(this, + "exit-success"); ATF_REQUIRE(r->exited()); ATF_REQUIRE(!r->signaled()); ATF_REQUIRE_EQ(r->exitcode(), EXIT_SUCCESS); } { - std::unique_ptr< atf::check::check_result > r = - do_exec(this, "exit-failure"); + std::unique_ptr<atf::check::check_result> r = do_exec(this, + "exit-failure"); ATF_REQUIRE(r->exited()); ATF_REQUIRE(!r->signaled()); ATF_REQUIRE_EQ(r->exitcode(), EXIT_FAILURE); } { - std::unique_ptr< atf::check::check_result > r = - do_exec(this, "exit-signal"); + std::unique_ptr<atf::check::check_result> r = do_exec(this, + "exit-signal"); ATF_REQUIRE(!r->exited()); ATF_REQUIRE(r->signaled()); ATF_REQUIRE_EQ(r->termsig(), SIGKILL); } } -static -void -check_lines(const std::string& path, const char* outname, - const char* resname) +static void +check_lines(const std::string& path, const char* outname, const char* resname) { std::ifstream f(path.c_str()); ATF_REQUIRE(f); std::string line; std::getline(f, line); - ATF_REQUIRE_EQ(line, std::string("Line 1 to ") + outname + " for " + - resname); + ATF_REQUIRE_EQ(line, + std::string("Line 1 to ") + outname + " for " + resname); std::getline(f, line); - ATF_REQUIRE_EQ(line, std::string("Line 2 to ") + outname + " for " + - resname); + ATF_REQUIRE_EQ(line, + std::string("Line 2 to ") + outname + " for " + resname); } ATF_TEST_CASE(exec_stdout_stderr); ATF_TEST_CASE_HEAD(exec_stdout_stderr) { - set_md_var("descr", "Tests that exec properly captures the stdout " + set_md_var("descr", + "Tests that exec properly captures the stdout " "and stderr streams of the child process"); } ATF_TEST_CASE_BODY(exec_stdout_stderr) { - std::unique_ptr< atf::check::check_result > r1 = - do_exec(this, "stdout-stderr", "result1"); + std::unique_ptr<atf::check::check_result> r1 = do_exec(this, + "stdout-stderr", + "result1"); ATF_REQUIRE(r1->exited()); ATF_REQUIRE_EQ(r1->exitcode(), EXIT_SUCCESS); - std::unique_ptr< atf::check::check_result > r2 = - do_exec(this, "stdout-stderr", "result2"); + std::unique_ptr<atf::check::check_result> r2 = do_exec(this, + "stdout-stderr", + "result2"); ATF_REQUIRE(r2->exited()); ATF_REQUIRE_EQ(r2->exitcode(), EXIT_SUCCESS); @@ -363,16 +362,16 @@ ATF_TEST_CASE_BODY(exec_stdout_stderr) ATF_TEST_CASE(exec_unknown); ATF_TEST_CASE_HEAD(exec_unknown) { - set_md_var("descr", "Tests that running a non-existing binary " - "is handled correctly"); + set_md_var("descr", + "Tests that running a non-existing binary is handled correctly"); } ATF_TEST_CASE_BODY(exec_unknown) { - std::vector< std::string > argv; + std::vector<std::string> argv; argv.push_back("/foo/bar/non-existent"); atf::process::argv_array argva(argv); - std::unique_ptr< atf::check::check_result > r = atf::check::exec(argva); + std::unique_ptr<atf::check::check_result> r = atf::check::exec(argva); ATF_REQUIRE(r->exited()); ATF_REQUIRE_EQ(r->exitcode(), 127); } diff --git a/contrib/atf/atf-c++/detail/application.cpp b/contrib/atf/atf-c++/detail/application.cpp index 3eeb8f966cf9..a0e62b176a1e 100644 --- a/contrib/atf/atf-c++/detail/application.cpp +++ b/contrib/atf/atf-c++/detail/application.cpp @@ -46,12 +46,6 @@ extern "C" { #include "atf-c++/detail/sanity.hpp" -#if !defined(HAVE_VSNPRINTF_IN_STD) -namespace std { -using ::vsnprintf; -} -#endif // !defined(HAVE_VSNPRINTF_IN_STD) - namespace impl = atf::application; #define IMPL_NAME "atf::application" @@ -59,8 +53,7 @@ namespace impl = atf::application; // The "usage_error" class. // ------------------------------------------------------------------------ -impl::usage_error::usage_error(const char *fmt, ...) - throw() : +impl::usage_error::usage_error(const char* fmt, ...) throw() : std::runtime_error("usage_error; message unformatted") { va_list ap; @@ -70,14 +63,12 @@ impl::usage_error::usage_error(const char *fmt, ...) va_end(ap); } -impl::usage_error::~usage_error(void) - throw() +impl::usage_error::~usage_error(void) throw() { } const char* -impl::usage_error::what(void) - const throw() +impl::usage_error::what(void) const throw() { return m_text; } @@ -86,9 +77,7 @@ impl::usage_error::what(void) // The "application" class. // ------------------------------------------------------------------------ -impl::option::option(char ch, - const std::string& a, - const std::string& desc) : +impl::option::option(char ch, const std::string& a, const std::string& desc) : m_character(ch), m_argument(a), m_description(desc) @@ -96,14 +85,12 @@ impl::option::option(char ch, } bool -impl::option::operator<(const impl::option& o) - const +impl::option::operator<(const impl::option& o) const { return m_character < o.m_character; } -impl::app::app(const std::string& description, - const std::string& manpage) : +impl::app::app(const std::string& description, const std::string& manpage) : m_argc(-1), m_argv(NULL), m_prog_name(NULL), @@ -129,15 +116,13 @@ impl::app::options(void) } std::string -impl::app::specific_args(void) - const +impl::app::specific_args(void) const { return ""; } impl::app::options_set -impl::app::specific_options(void) - const +impl::app::specific_options(void) const { return options_set(); } @@ -175,15 +160,14 @@ impl::app::process_options(void) ::opterr = 0; while ((ch = ::getopt(m_argc, m_argv, optstr.c_str())) != -1) { switch (ch) { - case ':': - throw usage_error("Option -%c requires an argument.", - ::optopt); + case ':': + throw usage_error("Option -%c requires an argument.", ::optopt); - case '?': - throw usage_error("Unknown option -%c.", ::optopt); + case '?': + throw usage_error("Unknown option -%c.", ::optopt); - default: - process_option(ch, ::optarg); + default: + process_option(ch, ::optarg); } } m_argc -= ::optind; @@ -209,11 +193,10 @@ impl::app::run(int argc, char* const* argv) auto m_prog_filename = std::filesystem::path(m_argv[0]).filename(); m_prog_name = m_prog_filename.c_str(); - const std::string bug = - std::string("This is probably a bug in ") + m_prog_name + - " or one of the libraries it uses. Please report this problem to " - PACKAGE_BUGREPORT " and provide as many details as possible " - "describing how you got to this condition."; + const std::string bug = std::string("This is probably a bug in ") + + m_prog_name + " or one of the libraries it uses. " + + "Please report this problem to " + PACKAGE_BUGREPORT + + ", providing as many relevant details as possible."; int errcode; try { @@ -221,15 +204,15 @@ impl::app::run(int argc, char* const* argv) errcode = main(); } catch (const usage_error& e) { std::cerr << m_prog_name << ": ERROR: " << e.what() << "\n"; - std::cerr << m_prog_name << ": See " << m_manpage << " for usage " - "details.\n"; + std::cerr << m_prog_name << ": See " << m_manpage + << " for usage details.\n"; errcode = EXIT_FAILURE; } catch (const std::runtime_error& e) { std::cerr << m_prog_name << ": ERROR: " << e.what() << "\n"; errcode = EXIT_FAILURE; } catch (const std::exception& e) { - std::cerr << m_prog_name << ": ERROR: Caught unexpected error: " - << e.what() << "\n"; + std::cerr << m_prog_name + << ": ERROR: Caught unexpected error: " << e.what() << "\n"; errcode = EXIT_FAILURE; } catch (...) { std::cerr << m_prog_name << ": ERROR: Caught unknown error\n"; diff --git a/contrib/atf/atf-c++/detail/application.hpp b/contrib/atf/atf-c++/detail/application.hpp index ad068467ac3a..b4efb3aeabf9 100644 --- a/contrib/atf/atf-c++/detail/application.hpp +++ b/contrib/atf/atf-c++/detail/application.hpp @@ -76,7 +76,7 @@ class app { bool inited(void); protected: - typedef std::set< option > options_set; + typedef std::set<option> options_set; int m_argc; char* const* m_argv; diff --git a/contrib/atf/atf-c++/detail/application_test.cpp b/contrib/atf/atf-c++/detail/application_test.cpp index 28b7a2f72fa7..ad6a5407249a 100644 --- a/contrib/atf/atf-c++/detail/application_test.cpp +++ b/contrib/atf/atf-c++/detail/application_test.cpp @@ -29,11 +29,13 @@ extern "C" { #include <unistd.h> } -#include <atf-c++.hpp> +#include "atf-c++.hpp" class getopt_app : public atf::application::app { public: - getopt_app(void) : app("description", "manpage") {} + getopt_app(void) : app("description", "manpage") + { + } int main(void) { @@ -45,7 +47,7 @@ public: char arg2[] = "-Z"; char arg3[] = "-s"; char arg4[] = "foo"; - char *const argv[] = { arg1, arg2, arg3, arg4, NULL }; + char* const argv[] = { arg1, arg2, arg3, arg4, NULL }; int ch; bool zflag; @@ -80,7 +82,7 @@ ATF_TEST_CASE_BODY(getopt) { int argc = 1; char arg1[] = "progname"; - char *const argv[] = { arg1, NULL }; + char* const argv[] = { arg1, NULL }; ATF_REQUIRE_EQ(0, getopt_app().run(argc, argv)); } diff --git a/contrib/atf/atf-c++/detail/env_test.cpp b/contrib/atf/atf-c++/detail/env_test.cpp index 91616f38f044..22196ee98bd4 100644 --- a/contrib/atf/atf-c++/detail/env_test.cpp +++ b/contrib/atf/atf-c++/detail/env_test.cpp @@ -23,10 +23,9 @@ // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "atf-c++.hpp" #include "atf-c++/detail/env.hpp" -#include <atf-c++.hpp> - // ------------------------------------------------------------------------ // Test cases for the free functions. // ------------------------------------------------------------------------ diff --git a/contrib/atf/atf-c++/detail/exceptions.cpp b/contrib/atf/atf-c++/detail/exceptions.cpp index a5b74a370e4a..ac2b9ca2749e 100644 --- a/contrib/atf/atf-c++/detail/exceptions.cpp +++ b/contrib/atf/atf-c++/detail/exceptions.cpp @@ -45,30 +45,24 @@ extern "C" { // ------------------------------------------------------------------------ atf::system_error::system_error(const std::string& who, - const std::string& message, - int sys_err) : + const std::string& message, int sys_err) : std::runtime_error(who + ": " + message), m_sys_err(sys_err) { } -atf::system_error::~system_error(void) - throw() +atf::system_error::~system_error(void) throw() { } int -atf::system_error::code(void) - const - throw() +atf::system_error::code(void) const throw() { return m_sys_err; } const char* -atf::system_error::what(void) - const - throw() +atf::system_error::what(void) const throw() { try { if (m_message.length() == 0) { @@ -86,8 +80,7 @@ atf::system_error::what(void) // Free functions. // ------------------------------------------------------------------------ -static -void +static void throw_libc_error(atf_error_t err) { PRE(atf_error_is(err, "libc")); @@ -98,8 +91,7 @@ throw_libc_error(atf_error_t err) *** 16120 LINES SKIPPED ***
