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.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 Index: src/external/bsd/atf/dist/tools/requirements_test.cpp diff -u src/external/bsd/atf/dist/tools/requirements_test.cpp:1.1.1.1 src/external/bsd/atf/dist/tools/requirements_test.cpp:1.2 --- src/external/bsd/atf/dist/tools/requirements_test.cpp:1.1.1.1 Sat Feb 8 19:11:33 2014 +++ src/external/bsd/atf/dist/tools/requirements_test.cpp Tue Feb 11 18:13:45 2014 @@ -241,12 +241,8 @@ ATF_TEST_CASE_WITHOUT_HEAD(require_memor 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);