CVS commit: src/external/bsd/atf/dist/tools

2021-07-08 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Thu Jul  8 18:10:52 UTC 2021

Modified Files:
src/external/bsd/atf/dist/tools: atf-run.cpp

Log Message:
When running an individual test case under isolation, make the test
case count on the tp-start line of the output match the number of test
cases actually executed (one) so that the atf-run output is valid
input to atf-report.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/atf/dist/tools/atf-run.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-run.cpp
diff -u src/external/bsd/atf/dist/tools/atf-run.cpp:1.6 src/external/bsd/atf/dist/tools/atf-run.cpp:1.7
--- src/external/bsd/atf/dist/tools/atf-run.cpp:1.6	Sat Apr 10 10:32:57 2021
+++ src/external/bsd/atf/dist/tools/atf-run.cpp	Thu Jul  8 18:10:52 2021
@@ -388,7 +388,22 @@ atf_run::run_test_program(const tools::f
 tools::fs::temp_dir resdir(
 tools::fs::path(tools::config::get("atf_workdir")) / "atf-run.XX");
 
-w.start_tp(tp.str(), md.test_cases.size());
+size_t nseltcs;
+if (tc.empty()) {
+nseltcs = md.test_cases.size();
+} else {
+nseltcs = 0;
+for (std::map< std::string, vars_map >::const_iterator iter
+ = md.test_cases.begin(); iter != md.test_cases.end(); iter++) {
+const std::string& tcname = (*iter).first;
+if (tcname == tc)
+nseltcs++;
+}
+if (nseltcs == 0)
+throw std::runtime_error("No such test case");
+}
+
+w.start_tp(tp.str(), nseltcs);
 if (md.test_cases.empty()) {
 w.end_tp("Bogus test program: reported 0 test cases");
 errcode = EXIT_FAILURE;



CVS commit: src/external/bsd/atf/dist/tools

2021-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 28 16:35:37 UTC 2021

Modified Files:
src/external/bsd/atf/dist/tools: fs.cpp fs.hpp test-program.cpp

Log Message:
If we are running the test as an unprivileged user, hand ownership of the
test directory to that user.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/tools/fs.cpp
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/fs.hpp
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/test-program.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/fs.cpp
diff -u src/external/bsd/atf/dist/tools/fs.cpp:1.4 src/external/bsd/atf/dist/tools/fs.cpp:1.5
--- src/external/bsd/atf/dist/tools/fs.cpp:1.4	Sat Nov 11 09:16:06 2017
+++ src/external/bsd/atf/dist/tools/fs.cpp	Sun Mar 28 12:35:37 2021
@@ -683,6 +683,17 @@ impl::rmdir(const path& p)
 }
 }
 
+void
+impl::change_ownership(const path& p, const std::pair < int, int >& user)
+{
+if (::chown(p.c_str(), user.first, user.second) == -1) {
+std::stringstream ss;
+ss << IMPL_NAME "::chown(" << p.str() << ", " << user.first << ", "
+   << user.second << ")";
+throw tools::system_error(ss.str(), "chown(2) failed", errno);
+}
+}
+
 impl::path
 impl::change_directory(const path& dir)
 {

Index: src/external/bsd/atf/dist/tools/fs.hpp
diff -u src/external/bsd/atf/dist/tools/fs.hpp:1.2 src/external/bsd/atf/dist/tools/fs.hpp:1.3
--- src/external/bsd/atf/dist/tools/fs.hpp:1.2	Mon Mar  9 16:34:52 2020
+++ src/external/bsd/atf/dist/tools/fs.hpp	Sun Mar 28 12:35:37 2021
@@ -368,6 +368,7 @@ void remove(const path&);
 void rmdir(const path&);
 
 tools::fs::path change_directory(const tools::fs::path&);
+void change_ownership(const tools::fs::path&, const std::pair< int, int >&);
 void cleanup(const tools::fs::path&);
 tools::fs::path get_current_dir(void);
 

Index: src/external/bsd/atf/dist/tools/test-program.cpp
diff -u src/external/bsd/atf/dist/tools/test-program.cpp:1.3 src/external/bsd/atf/dist/tools/test-program.cpp:1.4
--- src/external/bsd/atf/dist/tools/test-program.cpp:1.3	Wed Dec 30 17:23:38 2015
+++ src/external/bsd/atf/dist/tools/test-program.cpp	Sun Mar 28 12:35:37 2021
@@ -304,8 +304,10 @@ run_test_case_child(void* raw_params)
 
 const std::pair< int, int > user = tools::get_required_user(
 params->metadata, params->config);
-if (user.first != -1 && user.second != -1)
+if (user.first != -1 && user.second != -1) {
+tools::fs::change_ownership(params->workdir, user);
 tools::user::drop_privileges(user);
+}
 
 // The input 'tp' parameter may be relative and become invalid once
 // we change the current working directory.



CVS commit: src/external/bsd/atf/dist/tools

2021-04-10 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sat Apr 10 10:32:57 UTC 2021

Modified Files:
src/external/bsd/atf/dist/tools: atf-run.1 atf-run.cpp

Log Message:
Add support for running individual test cases under isolation.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/tools/atf-run.1
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/atf/dist/tools/atf-run.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-run.1
diff -u src/external/bsd/atf/dist/tools/atf-run.1:1.4 src/external/bsd/atf/dist/tools/atf-run.1:1.5
--- src/external/bsd/atf/dist/tools/atf-run.1:1.4	Sat Feb  8 19:13:44 2014
+++ src/external/bsd/atf/dist/tools/atf-run.1	Sat Apr 10 10:32:57 2021
@@ -26,23 +26,22 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 1, 2010
+.Dd April 10, 2021
 .Dt ATF-RUN 1
 .Os
 .Sh NAME
 .Nm atf-run
-.Nd executes a collection of test programs
+.Nd executes a collection of tests
 .Sh SYNOPSIS
 .Nm
 .Op Fl v Ar var1=value1 Op .. Fl v Ar varN=valueN
-.Op Ar test_program1 Op Ar .. test_programN
+.Op Ar test1 Op Ar .. testN
 .Nm
 .Fl h
 .Sh DESCRIPTION
 .Nm
-executes a collection of test programs or, in other words, a complete
-test suite.
-The results of each test program are collected by the tool, and are then
+executes a collection of test cases, test programs, or a complete test suite.
+The results of each test are collected by the tool, and are then
 multiplexed into a single machine-parseable report; see
 .Xr atf-formats 5
 for more details.
@@ -70,8 +69,14 @@ In the first synopsis form,
 parses the
 .Pa Atffile
 in the current directory and runs all the test programs specified in it.
-If any test program names are given as part of the command line, those are
-the ones executed instead of the complete list.
+If any
+.Ar test
+arguments are given as part of the command line, those tests are
+executed instead of the complete list.  Each
+.Ar test
+argument can be either the name of a test program, or a string of the form
+.Ar test_program:test_case
+to execute a single test case.
 .Pp
 In the second synopsis form,
 .Nm

Index: src/external/bsd/atf/dist/tools/atf-run.cpp
diff -u src/external/bsd/atf/dist/tools/atf-run.cpp:1.5 src/external/bsd/atf/dist/tools/atf-run.cpp:1.6
--- src/external/bsd/atf/dist/tools/atf-run.cpp:1.5	Tue Feb 11 18:13:45 2014
+++ src/external/bsd/atf/dist/tools/atf-run.cpp	Sat Apr 10 10:32:57 2021
@@ -81,11 +81,13 @@ class atf_run : public tools::applicatio
 
 size_t count_tps(std::vector< std::string >) const;
 
-int run_test(const tools::fs::path&, tools::test_program::atf_tps_writer&,
+int run_test(const tools::fs::path&, const std::string &,
+ tools::test_program::atf_tps_writer&,
  const vars_map&);
 int run_test_directory(const tools::fs::path&,
tools::test_program::atf_tps_writer&);
 int run_test_program(const tools::fs::path&,
+ const std::string tc,
  tools::test_program::atf_tps_writer&,
  const vars_map&);
 
@@ -179,7 +181,7 @@ std::string
 atf_run::specific_args(void)
 const
 {
-return "[test-program1 .. test-programN]";
+return "[test1 .. testN]";
 }
 
 atf_run::options_set
@@ -214,6 +216,7 @@ atf_run::parse_vflag(const std::string& 
 
 int
 atf_run::run_test(const tools::fs::path& tp,
+  const std::string &tc,
   tools::test_program::atf_tps_writer& w,
   const vars_map& config)
 {
@@ -226,7 +229,7 @@ atf_run::run_test(const tools::fs::path&
 const vars_map effective_config =
 tools::config_file::merge_configs(config, m_cmdline_vars);
 
-errcode = run_test_program(tp, w, effective_config);
+errcode = run_test_program(tp, tc, w, effective_config);
 }
 return errcode;
 }
@@ -247,7 +250,7 @@ atf_run::run_test_directory(const tools:
 bool ok = true;
 for (std::vector< std::string >::const_iterator iter = af.tps().begin();
  iter != af.tps().end(); iter++) {
-const bool result = run_test(tp / *iter, w,
+const bool result = run_test(tp / *iter, "", w,
 tools::config_file::merge_configs(af.conf(), test_suite_vars));
 ok &= (result == EXIT_SUCCESS);
 }
@@ -362,6 +365,7 @@ atf_run::get_test_case_result(const std:
 
 int
 atf_run::run_test_program(const tools::fs::path& tp,
+  const std::string tc,
   tools::test_program::atf_tps_writer& w,
   const vars_map& config)
 {
@@ -394,6 +398,9 @@ atf_run::run_test_program(const tools::f
 const std::string& tcname = (*iter).first;
 const vars_map& tcmd = (*iter).second;
 
+   

CVS commit: src/external/bsd/atf/dist/tools

2010-04-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  7 07:32:48 UTC 2010

Modified Files:
src/external/bsd/atf/dist/tools: atf-format.1

Log Message:
Fix typo, reported by Ryo HAYASAKA in PR 43134.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/tools/atf-format.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-format.1
diff -u src/external/bsd/atf/dist/tools/atf-format.1:1.1.1.1 src/external/bsd/atf/dist/tools/atf-format.1:1.2
--- src/external/bsd/atf/dist/tools/atf-format.1:1.1.1.1	Mon Jan 19 07:11:52 2009
+++ src/external/bsd/atf/dist/tools/atf-format.1	Wed Apr  7 07:32:48 2010
@@ -76,7 +76,7 @@
 .It Fl h
 Shows a short summary of all available options and their purpose.
 .It Fl l Ar length
-Specifies the length in characters of te tag.
+Specifies the length in characters of the tag.
 Useful if the tag is shorter than the desired length, which happens when
 formatting two-column tables.
 .It Fl r



CVS commit: src/external/bsd/atf/dist/tools

2010-04-07 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr  8 06:58:27 UTC 2010

Modified Files:
src/external/bsd/atf/dist/tools: atf-report.1

Log Message:
Fix typo reported by Ryo HAYASAKA in PR 43136.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/tools/atf-report.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-report.1
diff -u src/external/bsd/atf/dist/tools/atf-report.1:1.1.1.1 src/external/bsd/atf/dist/tools/atf-report.1:1.2
--- src/external/bsd/atf/dist/tools/atf-report.1:1.1.1.1	Mon Jan 19 07:11:52 2009
+++ src/external/bsd/atf/dist/tools/atf-report.1	Thu Apr  8 06:58:26 2010
@@ -63,7 +63,7 @@
 .Fl o
 options are provided (more than one are allowed), they specify the complete
 list of reports to generate.
-They are all generated simulatneously, and for obvious reasons, two reports
+They are all generated simultaneously, and for obvious reasons, two reports
 cannot be written to the same file.
 Note that the default output is suppressed when
 .Fl o



CVS commit: src/external/bsd/atf/dist/tools

2009-12-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Dec 23 09:54:22 UTC 2009

Modified Files:
src/external/bsd/atf/dist/tools: atf-check.1 atf-run.1

Log Message:
Make HTML-ready.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/tools/atf-check.1 \
src/external/bsd/atf/dist/tools/atf-run.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-check.1
diff -u src/external/bsd/atf/dist/tools/atf-check.1:1.1.1.1 src/external/bsd/atf/dist/tools/atf-check.1:1.2
--- src/external/bsd/atf/dist/tools/atf-check.1:1.1.1.1	Mon Jan 19 07:11:52 2009
+++ src/external/bsd/atf/dist/tools/atf-check.1	Wed Dec 23 09:54:22 2009
@@ -68,27 +68,27 @@
 .It Fl s Ar qual:value
 Analyzes exit code.
 Must be one of:
-.Bl -tag -width eq: -compact
+.Bl -tag -width eq:XvalueX -compact
 .It Ar ignore
 ignores exit status
-.It Ar eq:
+.It Ar eq: Ns Aq value
 checks that exit status is equal to value
-.It Ar ne:
+.It Ar ne: Ns Aq value
 checks that exit status is other than value
 .El
 .It Fl o Ar action:arg
 Analyzes standard output.
 Must be one of:
-.Bl -tag -width inline: -compact
+.Bl -tag -width inline:XvalueX -compact
 .It Ar empty
 checks that stdout is empty
 .It Ar ignore
 ignores stdout
-.It Ar file:
+.It Ar file: Ns Aq path
 compares stdout with given file
-.It Ar inline:
+.It Ar inline: Ns Aq value
 compares stdout with inline value
-.It Ar save:
+.It Ar save: Ns Aq path
 saves stdout to given file
 .El
 .It Fl e Ar action:arg
@@ -106,9 +106,9 @@
 atf-check -s ne:0 'false' || atf_fail
 
 # Checking stdout/stderr
-echo foobar >expout
+echo foobar \*[Gt]expout
 atf-check -o file:expout -e inline:"xx\\tyy\\n" \\
-'echo foobar ; printf "xx\\tyy\\n" >&2' || atf_fail
+'echo foobar ; printf "xx\\tyy\\n" \*[Gt]\*[Aq]2' || atf_fail
 .Ed
 .Sh SEE ALSO
 .Xr atf 7
Index: src/external/bsd/atf/dist/tools/atf-run.1
diff -u src/external/bsd/atf/dist/tools/atf-run.1:1.1.1.1 src/external/bsd/atf/dist/tools/atf-run.1:1.2
--- src/external/bsd/atf/dist/tools/atf-run.1:1.1.1.1	Mon Jan 19 07:11:52 2009
+++ src/external/bsd/atf/dist/tools/atf-run.1	Wed Dec 23 09:54:22 2009
@@ -108,7 +108,7 @@
 Configuration variables defined in the system-wide test-suite-specific
 configuration file.
 This lives in
-.Pa ${ATF_CONFDIR}/.conf .
+.Pa ${ATF_CONFDIR}/\*[Lt]test-suite\*[Gt].conf .
 .It
 Configuration variables defined in the user-specific configuration file
 shared among all test suites.
@@ -118,7 +118,7 @@
 Configuration variables defined in the user-specific test-suite-specific
 configuration file.
 This lives in
-.Pa ${HOME}/.atf/.conf .
+.Pa ${HOME}/.atf/\*[Lt]test-suite\*[Gt].conf .
 .It
 Configuration variables provided as part of the command line through the
 .Fl v
@@ -171,7 +171,7 @@
 .El
 .Pp
 All hooks are accompanied by a function named
-.Sq default_
+.Sq default_\*[Lt]hook_name\*[Gt]
 that can be executed by them to invoke the default behavior built into
 .Nm .
 For example, in order to extend the default



CVS commit: src/external/bsd/atf/dist/tools

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:23:38 UTC 2015

Modified Files:
src/external/bsd/atf/dist/tools: process.cpp process.hpp
test-program.cpp

Log Message:
Print symbolically why the process exited.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/process.cpp
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/tools/process.hpp
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/test-program.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/process.cpp
diff -u src/external/bsd/atf/dist/tools/process.cpp:1.3 src/external/bsd/atf/dist/tools/process.cpp:1.4
--- src/external/bsd/atf/dist/tools/process.cpp:1.3	Tue Feb 11 13:13:45 2014
+++ src/external/bsd/atf/dist/tools/process.cpp	Wed Dec 30 17:23:38 2015
@@ -360,6 +360,25 @@ impl::status::~status(void)
 {
 }
 
+std::string
+impl::status::str(void)
+ const
+{
+int mutable_status = m_status;
+std::stringstream rv;
+if (WIFEXITED(mutable_status))
+	rv << "exit("  << WEXITSTATUS(mutable_status);
+else if (WIFSTOPPED(mutable_status))
+	rv << "stopped("  << WSTOPSIG(mutable_status);
+else if (WIFSIGNALED(mutable_status))
+	rv << "terminated("  << WTERMSIG(mutable_status);
+if (WCOREDUMP(mutable_status))
+	rv << "/core)";
+else
+	rv << ")";
+return rv.str();
+}
+
 bool
 impl::status::exited(void)
 const

Index: src/external/bsd/atf/dist/tools/process.hpp
diff -u src/external/bsd/atf/dist/tools/process.hpp:1.1.1.1 src/external/bsd/atf/dist/tools/process.hpp:1.2
--- src/external/bsd/atf/dist/tools/process.hpp:1.1.1.1	Sat Feb  8 14:11:33 2014
+++ src/external/bsd/atf/dist/tools/process.hpp	Wed Dec 30 17:23:38 2015
@@ -207,6 +207,8 @@ class status {
 public:
 ~status(void);
 
+std::string str(void) const;
+
 bool exited(void) const;
 int exitstatus(void) const;
 

Index: src/external/bsd/atf/dist/tools/test-program.cpp
diff -u src/external/bsd/atf/dist/tools/test-program.cpp:1.2 src/external/bsd/atf/dist/tools/test-program.cpp:1.3
--- src/external/bsd/atf/dist/tools/test-program.cpp:1.2	Tue Feb 11 11:31:38 2014
+++ src/external/bsd/atf/dist/tools/test-program.cpp	Wed Dec 30 17:23:38 2015
@@ -664,7 +664,7 @@ impl::get_metadata(const tools::fs::path
 const tools::process::status status = child.wait();
 if (!status.exited() || status.exitstatus() != EXIT_SUCCESS)
 throw tools::parser::format_error("Test program returned failure "
-"exit status for test case list");
+	"exit status " + status.str() + " for test case list");
 
 return metadata(parser.get_tcs());
 }



CVS commit: src/external/bsd/atf/dist/tools

2014-02-11 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Feb 11 18:13:45 UTC 2014

Modified Files:
src/external/bsd/atf/dist/tools: atf-run.cpp fs.cpp process.cpp
requirements.cpp requirements_test.cpp

Log Message:
Remove portability-related guards from the atf tools.

Just assume we are building for NetBSD given that the tools code is now
owned by the NetBSD tree.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/tools/atf-run.cpp
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/fs.cpp \
src/external/bsd/atf/dist/tools/process.cpp \
src/external/bsd/atf/dist/tools/requirements.cpp
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/bsd/atf/dist/tools/requirements_test.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-run.cpp
diff -u src/external/bsd/atf/dist/tools/atf-run.cpp:1.4 src/external/bsd/atf/dist/tools/atf-run.cpp:1.5
--- src/external/bsd/atf/dist/tools/atf-run.cpp:1.4	Tue Feb 11 17:28:20 2014
+++ src/external/bsd/atf/dist/tools/atf-run.cpp	Tue Feb 11 18:13:45 2014
@@ -64,12 +64,6 @@ typedef std::map< std::string, std::stri
 
 } // anonymous namespace
 
-#if defined(MAXCOMLEN)
-static const std::string::size_type max_core_name_length = MAXCOMLEN;
-#else
-static const std::string::size_type max_core_name_length = std::string::npos;
-#endif
-
 class atf_run : public tools::application::app {
 static const char* m_description;
 
@@ -127,7 +121,7 @@ dump_stacktrace(const tools::fs::path& t
 w.stderr_tc("Test program crashed; attempting to get stack trace");
 
 const tools::fs::path corename = workdir /
-(tp.leaf_name().substr(0, max_core_name_length) + ".core");
+(tp.leaf_name().substr(0, MAXCOMLEN) + ".core");
 if (!tools::fs::exists(corename)) {
 w.stderr_tc("Expected file " + corename.str() + " not found");
 return;

Index: src/external/bsd/atf/dist/tools/fs.cpp
diff -u src/external/bsd/atf/dist/tools/fs.cpp:1.2 src/external/bsd/atf/dist/tools/fs.cpp:1.3
--- src/external/bsd/atf/dist/tools/fs.cpp:1.2	Tue Feb 11 17:28:20 2014
+++ src/external/bsd/atf/dist/tools/fs.cpp	Tue Feb 11 18:13:45 2014
@@ -434,9 +434,7 @@ impl::file_info::file_info(const path& p
 case S_IFLNK:  m_type = lnk_type;  break;
 case S_IFREG:  m_type = reg_type;  break;
 case S_IFSOCK: m_type = sock_type; break;
-#if defined(S_IFWHT)
 case S_IFWHT:  m_type = wht_type;  break;
-#endif
 default:
 throw system_error(IMPL_NAME "::file_info", "Unknown file type "
"error", EINVAL);
Index: src/external/bsd/atf/dist/tools/process.cpp
diff -u src/external/bsd/atf/dist/tools/process.cpp:1.2 src/external/bsd/atf/dist/tools/process.cpp:1.3
--- src/external/bsd/atf/dist/tools/process.cpp:1.2	Tue Feb 11 16:31:38 2014
+++ src/external/bsd/atf/dist/tools/process.cpp	Tue Feb 11 18:13:45 2014
@@ -399,12 +399,8 @@ impl::status::coredump(void)
 const
 {
 assert(signaled());
-#if defined(WCOREDUMP)
 int mutable_status = m_status;
 return WCOREDUMP(mutable_status);
-#else
-return false;
-#endif
 }
 
 // 
Index: src/external/bsd/atf/dist/tools/requirements.cpp
diff -u src/external/bsd/atf/dist/tools/requirements.cpp:1.2 src/external/bsd/atf/dist/tools/requirements.cpp:1.3
--- src/external/bsd/atf/dist/tools/requirements.cpp:1.2	Tue Feb 11 16:31:38 2014
+++ src/external/bsd/atf/dist/tools/requirements.cpp	Tue Feb 11 18:13:45 2014
@@ -145,14 +145,15 @@ check_machine(const std::string& machine
 return "Requires one of the '" + machines + "' machine types";
 }
 
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
 static
 std::string
-check_memory_sysctl(const int64_t needed, const char* sysctl_variable)
+check_memory(const std::string& raw_memory)
 {
+const int64_t needed = tools::text::to_bytes(raw_memory);
+
 int64_t available;
 std::size_t available_length = sizeof(available);
-if (::sysctlbyname(sysctl_variable, &available, &available_length,
+if (::sysctlbyname("hw.usermem64", &available, &available_length,
NULL, 0) == -1) {
 const char* e = std::strerror(errno);
 return "Failed to get sysctl(hw.usermem64) value: " + std::string(e);
@@ -164,55 +165,6 @@ check_memory_sysctl(const int64_t needed
 } else
 return "";
 }
-#   if defined(__APPLE__)
-static
-std::string
-check_memory_darwin(const int64_t needed)
-{
-return check_memory_sysctl(needed, "hw.usermem");
-}
-#   elif defined(__FreeBSD__)
-static
-std::string
-check_memory_freebsd(const int64_t needed)
-{
-return check_memory_sysctl(needed, "hw.usermem");
-}
-#   elif defined(__NetBSD__)
-static
-std::string
-check_memory_netbsd(const int64_t needed)
-{
-return check_memory_sysctl(needed, "hw.usermem

CVS commit: src/external/bsd/atf/dist/tools

2017-11-11 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Nov 11 14:16:06 UTC 2017

Modified Files:
src/external/bsd/atf/dist/tools: fs.cpp

Log Message:
don't use auto_ptr with memory allocated by C code
silences alloc-dealloc-mismatch warnings from asan

from joerg


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/fs.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/fs.cpp
diff -u src/external/bsd/atf/dist/tools/fs.cpp:1.3 src/external/bsd/atf/dist/tools/fs.cpp:1.4
--- src/external/bsd/atf/dist/tools/fs.cpp:1.3	Tue Feb 11 18:13:45 2014
+++ src/external/bsd/atf/dist/tools/fs.cpp	Sat Nov 11 14:16:06 2017
@@ -707,11 +707,17 @@ impl::cleanup(const path& p)
 impl::path
 impl::get_current_dir(void)
 {
-std::auto_ptr< char > cwd;
-cwd.reset(getcwd(NULL, 0));
-if (cwd.get() == NULL)
+char *cwd = getcwd(NULL, 0);
+if (cwd == NULL)
 throw tools::system_error(IMPL_NAME "::get_current_dir()",
 "getcwd() failed", errno);
 
-return path(cwd.get());
+try {
+impl::path p(cwd);
+free(cwd);
+return p;
+} catch(...) {
+free(cwd);
+throw;
+}
 }



CVS commit: src/external/bsd/atf/dist/tools

2020-03-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 31 01:02:18 UTC 2020

Modified Files:
src/external/bsd/atf/dist/tools: env.cpp

Log Message:
Allow env - atf-run to work by setting a default minimal path.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/atf/dist/tools/env.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/env.cpp
diff -u src/external/bsd/atf/dist/tools/env.cpp:1.2 src/external/bsd/atf/dist/tools/env.cpp:1.3
--- src/external/bsd/atf/dist/tools/env.cpp:1.2	Tue Feb 11 12:28:20 2014
+++ src/external/bsd/atf/dist/tools/env.cpp	Mon Mar 30 21:02:18 2020
@@ -48,9 +48,16 @@ namespace impl = tools::env;
 std::string
 impl::get(const std::string& name)
 {
-const char* val = getenv(name.c_str());
-assert(val != NULL);
-return val;
+const char *n =name.c_str();
+const char* val = getenv(n);
+if (val != NULL)
+	return val;
+if (strcmp(n, "PATH") == 0)
+	return "/bin:/usr/bin";
+	
+throw tools::system_error(IMPL_NAME "::set",
+			"Cannot get environment variable '" + name +
+			"'", errno);
 }
 
 bool



CVS commit: src/external/bsd/atf/dist/tools

2020-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 23 16:05:16 UTC 2020

Modified Files:
src/external/bsd/atf/dist/tools: env.cpp

Log Message:
Add the system binary paths too since tests use them.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/env.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/env.cpp
diff -u src/external/bsd/atf/dist/tools/env.cpp:1.3 src/external/bsd/atf/dist/tools/env.cpp:1.4
--- src/external/bsd/atf/dist/tools/env.cpp:1.3	Mon Mar 30 21:02:18 2020
+++ src/external/bsd/atf/dist/tools/env.cpp	Thu Apr 23 12:05:15 2020
@@ -53,7 +53,7 @@ impl::get(const std::string& name)
 if (val != NULL)
 	return val;
 if (strcmp(n, "PATH") == 0)
-	return "/bin:/usr/bin";
+	return "/bin:/usr/bin:/sbin:/usr/sbin";
 	
 throw tools::system_error(IMPL_NAME "::set",
 			"Cannot get environment variable '" + name +