mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
atf: Switch from std::auto_ptr<> to std::unique_ptr<>
This mirrors upstream commit f053ab687f6e27aa264f599ecbfc5ef27ad4e2d3. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D49789 (cherry picked from commit 5e6befdaca5194a8fb91b48d5f678942f22fa8f1)
This commit is contained in:
parent
64311997dd
commit
d871609f2a
10 changed files with 23 additions and 38 deletions
|
|
@ -141,7 +141,7 @@ impl::build_cxx_o(const std::string& sfile, const std::string& ofile,
|
|||
return success;
|
||||
}
|
||||
|
||||
std::auto_ptr< impl::check_result >
|
||||
std::unique_ptr< impl::check_result >
|
||||
impl::exec(const atf::process::argv_array& argva)
|
||||
{
|
||||
atf_check_result_t result;
|
||||
|
|
@ -150,5 +150,5 @@ impl::exec(const atf::process::argv_array& argva)
|
|||
if (atf_is_error(err))
|
||||
throw_atf_error(err);
|
||||
|
||||
return std::auto_ptr< impl::check_result >(new impl::check_result(&result));
|
||||
return std::unique_ptr< impl::check_result >(new impl::check_result(&result));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class check_result {
|
|||
check_result(const atf_check_result_t* result);
|
||||
|
||||
friend check_result test_constructor(const char* const*);
|
||||
friend std::auto_ptr< check_result > exec(const atf::process::argv_array&);
|
||||
friend std::unique_ptr< check_result > exec(const atf::process::argv_array&);
|
||||
|
||||
public:
|
||||
//!
|
||||
|
|
@ -120,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::auto_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);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ extern "C" {
|
|||
// ------------------------------------------------------------------------
|
||||
|
||||
static
|
||||
std::auto_ptr< atf::check::check_result >
|
||||
std::unique_ptr< atf::check::check_result >
|
||||
do_exec(const atf::tests::tc* tc, const char* helper_name)
|
||||
{
|
||||
std::vector< std::string > argv;
|
||||
|
|
@ -65,7 +65,7 @@ do_exec(const atf::tests::tc* tc, const char* helper_name)
|
|||
}
|
||||
|
||||
static
|
||||
std::auto_ptr< atf::check::check_result >
|
||||
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;
|
||||
|
|
@ -248,11 +248,11 @@ ATF_TEST_CASE_HEAD(exec_cleanup)
|
|||
}
|
||||
ATF_TEST_CASE_BODY(exec_cleanup)
|
||||
{
|
||||
std::auto_ptr< atf::fs::path > out;
|
||||
std::auto_ptr< atf::fs::path > err;
|
||||
std::unique_ptr< atf::fs::path > out;
|
||||
std::unique_ptr< atf::fs::path > err;
|
||||
|
||||
{
|
||||
std::auto_ptr< atf::check::check_result > r =
|
||||
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()));
|
||||
|
|
@ -272,7 +272,7 @@ ATF_TEST_CASE_HEAD(exec_exitstatus)
|
|||
ATF_TEST_CASE_BODY(exec_exitstatus)
|
||||
{
|
||||
{
|
||||
std::auto_ptr< atf::check::check_result > r =
|
||||
std::unique_ptr< atf::check::check_result > r =
|
||||
do_exec(this, "exit-success");
|
||||
ATF_REQUIRE(r->exited());
|
||||
ATF_REQUIRE(!r->signaled());
|
||||
|
|
@ -280,7 +280,7 @@ ATF_TEST_CASE_BODY(exec_exitstatus)
|
|||
}
|
||||
|
||||
{
|
||||
std::auto_ptr< atf::check::check_result > r =
|
||||
std::unique_ptr< atf::check::check_result > r =
|
||||
do_exec(this, "exit-failure");
|
||||
ATF_REQUIRE(r->exited());
|
||||
ATF_REQUIRE(!r->signaled());
|
||||
|
|
@ -288,7 +288,7 @@ ATF_TEST_CASE_BODY(exec_exitstatus)
|
|||
}
|
||||
|
||||
{
|
||||
std::auto_ptr< atf::check::check_result > r =
|
||||
std::unique_ptr< atf::check::check_result > r =
|
||||
do_exec(this, "exit-signal");
|
||||
ATF_REQUIRE(!r->exited());
|
||||
ATF_REQUIRE(r->signaled());
|
||||
|
|
@ -321,12 +321,12 @@ ATF_TEST_CASE_HEAD(exec_stdout_stderr)
|
|||
}
|
||||
ATF_TEST_CASE_BODY(exec_stdout_stderr)
|
||||
{
|
||||
std::auto_ptr< atf::check::check_result > r1 =
|
||||
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::auto_ptr< atf::check::check_result > r2 =
|
||||
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);
|
||||
|
|
@ -372,7 +372,7 @@ ATF_TEST_CASE_BODY(exec_unknown)
|
|||
argv.push_back("/foo/bar/non-existent");
|
||||
|
||||
atf::process::argv_array argva(argv);
|
||||
std::auto_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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,8 +196,8 @@ ATF_TEST_CASE_BODY(argv_array_assign)
|
|||
const char* const carray1[] = { "arg1", NULL };
|
||||
const char* const carray2[] = { "arg1", "arg2", NULL };
|
||||
|
||||
std::auto_ptr< argv_array > argv1(new argv_array(carray1));
|
||||
std::auto_ptr< argv_array > argv2(new argv_array(carray2));
|
||||
std::unique_ptr< argv_array > argv1(new argv_array(carray1));
|
||||
std::unique_ptr< argv_array > argv2(new argv_array(carray2));
|
||||
|
||||
*argv2 = *argv1;
|
||||
ATF_REQUIRE_EQ(argv2->size(), argv1->size());
|
||||
|
|
@ -226,8 +226,8 @@ ATF_TEST_CASE_BODY(argv_array_copy)
|
|||
|
||||
const char* const carray[] = { "arg0", NULL };
|
||||
|
||||
std::auto_ptr< argv_array > argv1(new argv_array(carray));
|
||||
std::auto_ptr< argv_array > argv2(new argv_array(*argv1));
|
||||
std::unique_ptr< argv_array > argv1(new argv_array(carray));
|
||||
std::unique_ptr< argv_array > argv2(new argv_array(*argv1));
|
||||
|
||||
ATF_REQUIRE_EQ(argv2->size(), argv1->size());
|
||||
ATF_REQUIRE(std::strcmp((*argv2)[0], (*argv1)[0]) == 0);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ struct output_check {
|
|||
};
|
||||
|
||||
class temp_file : public std::ostream {
|
||||
std::auto_ptr< atf::fs::path > m_path;
|
||||
std::unique_ptr< atf::fs::path > m_path;
|
||||
int m_fd;
|
||||
|
||||
public:
|
||||
|
|
@ -414,7 +414,7 @@ flatten_argv(char* const* argv)
|
|||
}
|
||||
|
||||
static
|
||||
std::auto_ptr< atf::check::check_result >
|
||||
std::unique_ptr< atf::check::check_result >
|
||||
execute(const char* const* argv)
|
||||
{
|
||||
// TODO: This should go to stderr... but fixing it now may be hard as test
|
||||
|
|
@ -430,7 +430,7 @@ execute(const char* const* argv)
|
|||
}
|
||||
|
||||
static
|
||||
std::auto_ptr< atf::check::check_result >
|
||||
std::unique_ptr< atf::check::check_result >
|
||||
execute_with_shell(char* const* argv)
|
||||
{
|
||||
const std::string cmd = flatten_argv(argv);
|
||||
|
|
@ -916,7 +916,7 @@ atf_check::main(void)
|
|||
m_stderr_checks.push_back(output_check(oc_empty, false, ""));
|
||||
|
||||
do {
|
||||
std::auto_ptr< atf::check::check_result > r =
|
||||
std::unique_ptr< atf::check::check_result > r =
|
||||
m_xflag ? execute_with_shell(m_argv) : execute(m_argv);
|
||||
|
||||
if ((run_status_checks(m_status_checks, *r) == false) ||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,3 @@
|
|||
CFLAGS+= -DHAVE_CONFIG_H
|
||||
|
||||
WARNS?= 3
|
||||
|
||||
# Permit use of auto_ptr for compilers defaulting to C++17 or later
|
||||
CXXSTD= c++11
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ CFLAGS+= -I.
|
|||
|
||||
CFLAGS+= -DHAVE_CONFIG_H
|
||||
|
||||
# Silence warnings about usage of deprecated std::auto_ptr
|
||||
CXXWARNFLAGS+= -Wno-deprecated-declarations
|
||||
|
||||
SRCS= application.cpp \
|
||||
build.cpp \
|
||||
check.cpp \
|
||||
|
|
|
|||
|
|
@ -38,10 +38,6 @@ MAN= atf-check.1
|
|||
CFLAGS+= -I${ATF}
|
||||
CFLAGS+= -DATF_SHELL='"/bin/sh"'
|
||||
|
||||
# Silence warnings about usage of deprecated std::auto_ptr
|
||||
CXXWARNFLAGS+= -Wno-deprecated-declarations
|
||||
CXXSTD= c++11
|
||||
|
||||
LIBADD= atf_cxx
|
||||
|
||||
HAS_TESTS=
|
||||
|
|
|
|||
|
|
@ -66,9 +66,6 @@ CFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
|
|||
CFLAGS+= -DATF_SHELL='"/bin/sh"'
|
||||
CFLAGS+= -I${ATF}
|
||||
|
||||
# Silence warnings about usage of deprecated std::auto_ptr
|
||||
CXXWARNFLAGS+= -Wno-deprecated-declarations
|
||||
|
||||
LIBADD= atf_cxx
|
||||
|
||||
FILESGROUPS= SUBR
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ LDADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
|
|||
.endif
|
||||
TEST_INTERFACE.${_T}= atf
|
||||
.endfor
|
||||
# Silence warnings about usage of deprecated std::auto_ptr
|
||||
CXXWARNFLAGS+= -Wno-deprecated-declarations
|
||||
.endif
|
||||
|
||||
.if !empty(ATF_TESTS_SH)
|
||||
|
|
|
|||
Loading…
Reference in a new issue