Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/atf/dist/tools Remove portability-related guard...



details:   https://anonhg.NetBSD.org/src/rev/379104c0dafe
branches:  trunk
changeset: 326673:379104c0dafe
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Tue Feb 11 18:13:45 2014 +0000

description:
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.

diffstat:

 external/bsd/atf/dist/tools/atf-run.cpp           |   8 +--
 external/bsd/atf/dist/tools/fs.cpp                |   2 -
 external/bsd/atf/dist/tools/process.cpp           |   4 -
 external/bsd/atf/dist/tools/requirements.cpp      |  56 +---------------------
 external/bsd/atf/dist/tools/requirements_test.cpp |   4 -
 5 files changed, 5 insertions(+), 69 deletions(-)

diffs (148 lines):

diff -r 33e297eb27bb -r 379104c0dafe external/bsd/atf/dist/tools/atf-run.cpp
--- a/external/bsd/atf/dist/tools/atf-run.cpp   Tue Feb 11 18:07:30 2014 +0000
+++ b/external/bsd/atf/dist/tools/atf-run.cpp   Tue Feb 11 18:13:45 2014 +0000
@@ -64,12 +64,6 @@
 
 } // 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 @@
     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;
diff -r 33e297eb27bb -r 379104c0dafe external/bsd/atf/dist/tools/fs.cpp
--- a/external/bsd/atf/dist/tools/fs.cpp        Tue Feb 11 18:07:30 2014 +0000
+++ b/external/bsd/atf/dist/tools/fs.cpp        Tue Feb 11 18:13:45 2014 +0000
@@ -434,9 +434,7 @@
     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);
diff -r 33e297eb27bb -r 379104c0dafe external/bsd/atf/dist/tools/process.cpp
--- a/external/bsd/atf/dist/tools/process.cpp   Tue Feb 11 18:07:30 2014 +0000
+++ b/external/bsd/atf/dist/tools/process.cpp   Tue Feb 11 18:13:45 2014 +0000
@@ -399,12 +399,8 @@
     const
 {
     assert(signaled());
-#if defined(WCOREDUMP)
     int mutable_status = m_status;
     return WCOREDUMP(mutable_status);
-#else
-    return false;
-#endif
 }
 
 // ------------------------------------------------------------------------
diff -r 33e297eb27bb -r 379104c0dafe external/bsd/atf/dist/tools/requirements.cpp
--- a/external/bsd/atf/dist/tools/requirements.cpp      Tue Feb 11 18:07:30 2014 +0000
+++ b/external/bsd/atf/dist/tools/requirements.cpp      Tue Feb 11 18:13:45 2014 +0000
@@ -145,14 +145,15 @@
         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 @@
     } 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.usermem64");
-}
-#   else
-#      error "Conditional error"
-#   endif
-#else
-static
-std::string
-check_memory_unknown(const int64_t needed __attribute__((__unused__)))
-{
-    return "";
-}
-#endif
-
-static
-std::string
-check_memory(const std::string& raw_memory)
-{
-    const int64_t needed = tools::text::to_bytes(raw_memory);
-
-#if defined(__APPLE__)
-    return check_memory_darwin(needed);
-#elif defined(__FreeBSD__)
-    return check_memory_freebsd(needed);
-#elif defined(__NetBSD__)
-    return check_memory_netbsd(needed);
-#else
-    return check_memory_unknown(needed);
-#endif
-}
 
 static
 std::string
diff -r 33e297eb27bb -r 379104c0dafe external/bsd/atf/dist/tools/requirements_test.cpp
--- a/external/bsd/atf/dist/tools/requirements_test.cpp Tue Feb 11 18:07:30 2014 +0000
+++ b/external/bsd/atf/dist/tools/requirements_test.cpp Tue Feb 11 18:13:45 2014 +0000
@@ -241,12 +241,8 @@
 ATF_TEST_CASE_BODY(require_memory_not_enough) {
     vars_map metadata;
     metadata["require.memory"] = "128t";
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
     do_check("Not enough memory; needed 140737488355328, available [0-9]*",
              metadata);
-#else
-    skip("Don't know how to check for the amount of physical memory");
-#endif
 }
 
 ATF_TEST_CASE_WITHOUT_HEAD(require_memory_fail);



Home | Main Index | Thread Index | Old Index