//
// Automated Testing Framework (atf)
//
// 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.
//
#if defined(HAVE_CONFIG_H)
#include "bconfig.h"
#endif
extern "C" {
#include <unistd.h>
}
#include <algorithm>
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <map>
#include <string>
#include "atf-c++/detail/application.hpp"
#include "atf-c++/config.hpp"
#include "atf-c++/tests.hpp"
#include "atf-c++/detail/exceptions.hpp"
#include "atf-c++/detail/parser.hpp"
#include "atf-c++/detail/process.hpp"
#include "atf-c++/detail/sanity.hpp"
#include "atffile.hpp"
#include "config.hpp"
#include "fs.hpp"
#include "requirements.hpp"
#include "test-program.hpp"
#if defined(MAXCOMLEN)
#else
#endif
static const char* m_description;
void process_option(int, const char*);
options_set specific_options(void) const;
public:
atf_run(void);
int main(void);
};
static void
sanitize_gdb_env(void)
{
try {
} catch (...) {
// Just swallow exceptions here; they cannot propagate into C, which
// is where this function is called from, and even if these exceptions
// appear they are benign.
}
}
static void
{
w.stderr_tc("Test program crashed; attempting to get stack trace");
return;
}
return;
}
if (input) {
}
w.stderr_tc("Stack trace complete");
}
"atf-run is a tool that runs tests programs and collects their "
"results.";
{
}
void
{
switch (ch) {
case 'v':
break;
default:
}
}
const
{
return "[test-program1 .. test-programN]";
}
const
{
"`var' to `value'; overrides "
"values in configuration files"));
return opts;
}
void
{
} else {
"var=value");
}
}
int
impl::atf_tps_writer& w,
{
int errcode;
else {
}
return errcode;
}
int
impl::atf_tps_writer& w)
{
{
}
bool ok = true;
}
}
const
{
using impl::read_test_case_result;
using impl::test_case_result;
if (!broken_reason.empty()) {
try {
return tcr;
} else {
}
} catch (const std::runtime_error&) {
}
}
if (s.exited()) {
try {
} catch (const std::runtime_error& e) {
"normally but failed to create the results file: " +
}
return tcr;
return tcr;
else
if (s.exitstatus() == EXIT_SUCCESS)
return tcr;
else
"error in expected_failure mode but it should not have");
"but was expected to receive a signal");
if (s.exitstatus() == EXIT_SUCCESS)
"exited successfully but reported failure");
else
return tcr;
if (s.exitstatus() == EXIT_SUCCESS)
return tcr;
else
"passed but reported an error");
if (s.exitstatus() == EXIT_SUCCESS)
return tcr;
else
"skipped but reported an error");
}
} else if (s.signaled()) {
try {
} catch (const std::runtime_error&) {
}
return tcr;
return tcr;
else
} else {
"bogus results file");
}
}
return test_case_result();
}
int
impl::atf_tps_writer& w,
{
try {
return EXIT_FAILURE;
return EXIT_FAILURE;
}
"atf-run.XXXXXX");
w.end_tp("Bogus test program: reported 0 test cases");
} else {
try {
continue;
}
} catch (const std::runtime_error& e) {
continue;
}
try {
"atf_workdir")) / "atf-run.XXXXXX");
errno);
}
}
if (has_cleanup)
// TODO: Force deletion of workdir.
} catch (...) {
throw;
}
}
w.end_tp("");
}
return errcode;
}
const
{
} else
ntps++;
}
return ntps;
}
static
void
{
}
int
{
if (m_argc >= 1) {
// TODO: Ensure that the given test names are listed in the
// Atffile. Take into account that the file can be using globs.
for (int i = 0; i < m_argc; i++)
}
// Read configuration data for this test suite.
{
}
bool ok = true;
}
}
int
{
}