Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/atf Stop using bconfig.h in the tools code.
details: https://anonhg.NetBSD.org/src/rev/d96b9b9fab72
branches: trunk
changeset: 326671:d96b9b9fab72
user: jmmv <jmmv%NetBSD.org@localhost>
date: Tue Feb 11 17:28:20 2014 +0000
description:
Stop using bconfig.h in the tools code.
Just assume the code is being built for NetBSD for simplicity reasons.
diffstat:
external/bsd/atf/dist/tools/application.cpp | 19 +-------
external/bsd/atf/dist/tools/atf-run.cpp | 4 -
external/bsd/atf/dist/tools/atf-version.cpp | 9 +--
external/bsd/atf/dist/tools/env.cpp | 26 -----------
external/bsd/atf/dist/tools/fs.cpp | 25 -----------
external/bsd/atf/dist/tools/signals.cpp | 5 +-
external/bsd/atf/dist/tools/timers.cpp | 59 ++------------------------
external/bsd/atf/lib/tools/Makefile | 5 +-
external/bsd/atf/usr.bin/atf-config/Makefile | 3 +-
external/bsd/atf/usr.bin/atf-report/Makefile | 3 +-
external/bsd/atf/usr.bin/atf-run/Makefile | 4 +-
external/bsd/atf/usr.bin/atf-version/Makefile | 5 +-
12 files changed, 18 insertions(+), 149 deletions(-)
diffs (truncated from 455 to 300 lines):
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/application.cpp
--- a/external/bsd/atf/dist/tools/application.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/application.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-#include "bconfig.h"
-#endif
-
extern "C" {
#include <unistd.h>
}
@@ -45,11 +41,9 @@
#include "application.hpp"
#include "ui.hpp"
-#if !defined(HAVE_VSNPRINTF_IN_STD)
namespace std {
using ::vsnprintf;
}
-#endif // !defined(HAVE_VSNPRINTF_IN_STD)
namespace impl = tools::application;
#define IMPL_NAME "tools::application"
@@ -157,11 +151,7 @@
{
assert(inited());
- std::string optstr;
-#if defined(HAVE_GNU_GETOPT)
- optstr += '+'; // Turn on POSIX behavior.
-#endif
- optstr += ':';
+ std::string optstr = ":";
{
options_set opts = options();
for (options_set::const_iterator iter = opts.begin();
@@ -200,9 +190,7 @@
// Clear getopt state just in case the test wants to use it.
opterr = old_opterr;
optind = 1;
-#if defined(HAVE_OPTRESET)
optreset = 1;
-#endif
}
void
@@ -275,9 +263,8 @@
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.";
+ " Please use send-pr(1) to report this issue and provide as many"
+ " details as possible describing how you got to this condition.";
int errcode;
try {
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/atf-run.cpp
--- a/external/bsd/atf/dist/tools/atf-run.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/atf-run.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-#include "bconfig.h"
-#endif
-
extern "C" {
#include <sys/types.h>
#include <sys/param.h>
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/atf-version.cpp
--- a/external/bsd/atf/dist/tools/atf-version.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/atf-version.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-#include "bconfig.h"
-#endif
-
#include <cstdlib>
#include <iostream>
@@ -62,8 +58,9 @@
using tools::ui::format_text;
using tools::ui::format_text_with_tag;
- std::cout << PACKAGE_STRING " (" PACKAGE_TARNAME "-" PACKAGE_VERSION
- ")\n" PACKAGE_COPYRIGHT "\n\n";
+ std::cout <<
+ "Automated Testing Framework " ATF_VERSION " (atf-" ATF_VERSION ")\n"
+ "Copyright (c) 2007 The NetBSD Foundation, Inc.\n\n";
#if defined(PACKAGE_REVISION_TYPE_DIST)
std::cout << format_text("Built from a distribution file; no revision "
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/env.cpp
--- a/external/bsd/atf/dist/tools/env.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/env.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-#include "bconfig.h"
-#endif
-
extern "C" {
#include <errno.h>
#include <stdlib.h>
@@ -66,37 +62,15 @@
void
impl::set(const std::string& name, const std::string& val)
{
-#if defined(HAVE_SETENV)
if (setenv(name.c_str(), val.c_str(), 1) == -1)
throw tools::system_error(IMPL_NAME "::set",
"Cannot set environment variable '" + name +
"' to '" + val + "'",
errno);
-#elif defined(HAVE_PUTENV)
- const std::string buf = name + "=" + val;
- if (putenv(strdup(buf.c_str())) == -1)
- throw tools::system_error(IMPL_NAME "::set",
- "Cannot set environment variable '" + name +
- "' to '" + val + "'",
- errno);
-#else
-# error "Don't know how to set an environment variable."
-#endif
}
void
impl::unset(const std::string& name)
{
-#if defined(HAVE_UNSETENV)
unsetenv(name.c_str());
-#elif defined(HAVE_PUTENV)
- const std::string buf = name + "=";
-
- if (putenv(strdup(buf.c_str())) == -1)
- throw tools::system_error(IMPL_NAME "::unset",
- "Cannot unset environment variable '" +
- name + "'", errno);
-#else
-# error "Don't know how to unset an environment variable."
-#endif
}
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/fs.cpp
--- a/external/bsd/atf/dist/tools/fs.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/fs.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-#include "bconfig.h"
-#endif
-
extern "C" {
#include <sys/param.h>
#include <sys/types.h>
@@ -52,7 +48,6 @@
#include "env.hpp"
#include "exceptions.hpp"
#include "fs.hpp"
-#include "process.hpp"
#include "text.hpp"
#include "user.hpp"
@@ -257,7 +252,6 @@
const impl::path& abs_path = in_path.is_absolute() ?
in_path : in_path.to_absolute();
-#if defined(HAVE_UNMOUNT)
int retries = max_retries;
retry_unmount:
if (unmount(abs_path.c_str(), 0) == -1) {
@@ -270,21 +264,6 @@
")", "unmount(2) failed", errno);
}
}
-#else
- // We could use umount(2) instead if it was available... but
- // trying to do so under, e.g. Linux, is a nightmare because we
- // also have to update /etc/mtab to match what we did. It is
- // stools::fser to just leave the system-specific umount(8) tool deal
- // with it, at least for now.
-
- const impl::path prog("umount");
- tools::process::argv_array argv("umount", abs_path.c_str(), NULL);
-
- tools::process::status s = tools::process::exec(prog, argv,
- tools::process::stream_inherit(), tools::process::stream_inherit());
- if (!s.exited() || s.exitstatus() != EXIT_SUCCESS)
- throw std::runtime_error("Call to unmount failed");
-#endif
}
static
@@ -731,11 +710,7 @@
impl::get_current_dir(void)
{
std::auto_ptr< char > cwd;
-#if defined(HAVE_GETCWD_DYN)
cwd.reset(getcwd(NULL, 0));
-#else
- cwd.reset(getcwd(NULL, MAXPATHLEN));
-#endif
if (cwd.get() == NULL)
throw tools::system_error(IMPL_NAME "::get_current_dir()",
"getcwd() failed", errno);
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/signals.cpp
--- a/external/bsd/atf/dist/tools/signals.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/signals.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-#include "bconfig.h"
-#endif
-
extern "C" {
#include <signal.h>
#include <unistd.h>
@@ -45,6 +41,7 @@
namespace impl = tools::signals;
#define IMPL_NAME "tools::signals"
+#define LAST_SIGNO 63
const int impl::last_signo = LAST_SIGNO;
// ------------------------------------------------------------------------
diff -r 0fb72468d590 -r d96b9b9fab72 external/bsd/atf/dist/tools/timers.cpp
--- a/external/bsd/atf/dist/tools/timers.cpp Tue Feb 11 16:31:38 2014 +0000
+++ b/external/bsd/atf/dist/tools/timers.cpp Tue Feb 11 17:28:20 2014 +0000
@@ -27,10 +27,6 @@
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-#if defined(HAVE_CONFIG_H)
-# include <bconfig.h>
-#endif
-
extern "C" {
#include <sys/time.h>
}
@@ -47,15 +43,10 @@
namespace impl = tools::timers;
#define IMPL_NAME "tools::timers"
-#if !defined(HAVE_TIMER_T)
-static impl::timer* compat_handle;
-#endif
-
// ------------------------------------------------------------------------
// Auxiliary functions.
// ------------------------------------------------------------------------
-#if defined(HAVE_TIMER_T)
static
void
handler(const int signo __attribute__((__unused__)), siginfo_t* si,
@@ -65,29 +56,14 @@
timer->set_fired();
timer->timeout_callback();
}
-#else
-static
-void
-handler(const int signo __attribute__((__unused__)),
- siginfo_t* si __attribute__((__unused__)),
- void* uc __attribute__((__unused__)))
-{
- compat_handle->set_fired();
- compat_handle->timeout_callback();
-}
-#endif
// ------------------------------------------------------------------------
// The "timer" class.
// ------------------------------------------------------------------------
struct impl::timer::impl {
-#if defined(HAVE_TIMER_T)
::timer_t m_timer;
::itimerspec m_old_it;
-#else
- ::itimerval m_old_it;
-#endif
struct ::sigaction m_old_sa;
volatile bool m_fired;
@@ -108,7 +84,6 @@
Home |
Main Index |
Thread Index |
Old Index