// Copyright (c) 2007 The NetBSD Foundation, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
//
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "atf-c++/tests.hpp"
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
extern "C" {
#include <signal.h>
#include <unistd.h>
}
#include <algorithm>
#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <map>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <vector>
extern "C" {
}
#include "atf-c++/detail/application.hpp"
#include "atf-c++/detail/auto_array.hpp"
#include "atf-c++/detail/exceptions.hpp"
#include "atf-c++/detail/sanity.hpp"
#if defined(HAVE_GNU_GETOPT)
#else
#endif
// ------------------------------------------------------------------------
// The "atf_tp_writer" class.
// ------------------------------------------------------------------------
m_is_first(true)
{
m_os << "Content-Type: application/X-atf-tp; version=\"1\"\n\n";
}
void
{
if (!m_is_first)
m_os << "\n";
}
void
{
if (m_is_first)
m_is_first = false;
}
void
{
}
// ------------------------------------------------------------------------
// Free helper functions.
// ------------------------------------------------------------------------
static void
{
// Libtool workaround: if running from within the source tree (binaries
// that are not installed yet), skip the "lt-" prefix added to files in
// the ".libs" directory to show the real (not temporary) name.
else
}
bool
{
}
// ------------------------------------------------------------------------
// The "tc" class.
// ------------------------------------------------------------------------
private:
// Non-copyable.
public:
bool m_has_cleanup;
m_ident(ident),
{
}
static void
{
}
static void
{
}
static void
{
}
};
{
}
{
}
void
{
ptr += 2;
}
if (atf_is_error(err))
}
bool
const
{
}
bool
const
{
}
const
{
}
const
{
}
const
{
}
const
{
try {
char **ptr;
} catch (...) {
throw;
}
return vars;
}
void
{
if (atf_is_error(err))
}
void
const
{
if (atf_is_error(err))
}
void
const
{
if (atf_is_error(err))
}
void
{
}
void
const
{
}
void
const
{
}
void
{
atf_tc_pass();
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
// ------------------------------------------------------------------------
// Test program main code.
// ------------------------------------------------------------------------
namespace {
static void
{
} else {
"var=value");
}
}
{
if (srcdir_arg.empty()) {
} else
throw usage_error("Cannot find the test program in the source "
if (!srcdir.is_absolute())
return srcdir;
}
static void
{
}
}
static int
{
{
}
if (key != "ident")
}
}
return EXIT_SUCCESS;
}
{
return tc;
}
}
{
} else {
if (partname == "body")
else if (partname == "cleanup")
else {
}
}
}
static int
{
"__RUNNING_INSIDE_ATF_RUN") != "internal-yes-value")
{
"of kyua(1) is unsupported\n";
"control is being applied; you may get unexpected failures; see "
"atf-test-case(4)\n";
}
case BODY:
break;
case CLEANUP:
tc->run_cleanup();
break;
default:
}
return EXIT_SUCCESS;
}
static int
{
bool lflag = false;
int ch;
int old_opterr;
old_opterr = opterr;
::opterr = 0;
switch (ch) {
case 'l':
lflag = true;
break;
case 'r':
break;
case 's':
srcdir_arg = ::optarg;
break;
case 'v':
break;
case ':':
break;
case '?':
default:
}
}
// Clear getopt state just in case the test wants to use it.
::opterr = old_opterr;
::optind = 1;
#if defined(HAVE_OPTRESET)
::optreset = 1;
#endif
int errcode;
if (lflag) {
if (argc > 0)
throw usage_error("Cannot provide test case names with -l");
} else {
if (argc == 0)
throw usage_error("Must provide a test case name");
else if (argc > 1)
throw usage_error("Cannot provide more than one test case name");
}
delete tc;
}
return errcode;
}
} // anonymous namespace
namespace atf {
namespace tests {
}
}
int
{
try {
set_program_name(argv[0]);
} catch (const usage_error& e) {
<< Program_Name << ": See atf-test-program(1) for usage details.\n";
return EXIT_FAILURE;
}
}