head	1.5;
access;
symbols
	perseant-exfatfs-base-20261102:1.5
	perseant-exfatfs-base-20250801:1.5
	perseant-exfatfs-base-20240630:1.5
	perseant-exfatfs:1.5.0.18
	perseant-exfatfs-base:1.5
	cjep_sun2x:1.5.0.16
	cjep_sun2x-base:1.5
	cjep_staticlib_x-base1:1.5
	cjep_staticlib_x:1.5.0.14
	cjep_staticlib_x-base:1.5
	phil-wifi-20200421:1.5
	phil-wifi-20200411:1.5
	phil-wifi-20200406:1.5
	pgoyette-compat-merge-20190127:1.5
	pgoyette-compat-20190127:1.5
	pgoyette-compat-20190118:1.5
	pgoyette-compat-1226:1.5
	pgoyette-compat-1126:1.5
	pgoyette-compat-1020:1.5
	pgoyette-compat-0930:1.5
	pgoyette-compat-0906:1.5
	pgoyette-compat-0728:1.5
	pgoyette-compat-0625:1.5
	pgoyette-compat-0521:1.5
	pgoyette-compat-0502:1.5
	pgoyette-compat-0422:1.5
	pgoyette-compat-0415:1.5
	pgoyette-compat-0407:1.5
	pgoyette-compat-0330:1.5
	pgoyette-compat-0322:1.5
	pgoyette-compat-0315:1.5
	pgoyette-compat:1.5.0.12
	pgoyette-compat-base:1.5
	perseant-stdc-iso10646:1.5.0.10
	perseant-stdc-iso10646-base:1.5
	prg-localcount2-base3:1.5
	prg-localcount2-base2:1.5
	prg-localcount2-base1:1.5
	prg-localcount2:1.5.0.8
	prg-localcount2-base:1.5
	pgoyette-localcount-20170426:1.5
	bouyer-socketcan-base1:1.5
	pgoyette-localcount-20170320:1.5
	bouyer-socketcan:1.5.0.6
	bouyer-socketcan-base:1.5
	pgoyette-localcount-20170107:1.5
	pgoyette-localcount-20161104:1.5
	localcount-20160914:1.5
	pgoyette-localcount-20160806:1.5
	pgoyette-localcount-20160726:1.5
	pgoyette-localcount:1.5.0.4
	pgoyette-localcount-base:1.5
	netbsd-6-0-6-RELEASE:1.4
	netbsd-6-1-5-RELEASE:1.4
	yamt-pagecache-base9:1.5
	yamt-pagecache-tag8:1.4
	netbsd-6-1-4-RELEASE:1.4
	netbsd-6-0-5-RELEASE:1.4
	tls-earlyentropy:1.5.0.2
	tls-earlyentropy-base:1.5
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.5
	riastradh-drm2-base3:1.5
	netbsd-6-1-3-RELEASE:1.4
	netbsd-6-0-4-RELEASE:1.4
	netbsd-6-1-2-RELEASE:1.4
	netbsd-6-0-3-RELEASE:1.4
	netbsd-6-1-1-RELEASE:1.4
	riastradh-drm2-base2:1.4
	riastradh-drm2-base1:1.4
	riastradh-drm2:1.4.0.16
	riastradh-drm2-base:1.4
	netbsd-6-1:1.4.0.22
	netbsd-6-0-2-RELEASE:1.4
	netbsd-6-1-RELEASE:1.4
	khorben-n900:1.4.0.20
	netbsd-6-1-RC4:1.4
	netbsd-6-1-RC3:1.4
	agc-symver:1.4.0.18
	agc-symver-base:1.4
	netbsd-6-1-RC2:1.4
	netbsd-6-1-RC1:1.4
	atf-0-17:1.1.1.3
	yamt-pagecache-base8:1.4
	netbsd-6-0-1-RELEASE:1.4
	yamt-pagecache-base7:1.4
	matt-nb6-plus-nbase:1.4
	yamt-pagecache-base6:1.4
	netbsd-6-0:1.4.0.14
	netbsd-6-0-RELEASE:1.4
	netbsd-6-0-RC2:1.4
	tls-maxphys:1.4.0.12
	tls-maxphys-base:1.5
	matt-nb6-plus:1.4.0.10
	matt-nb6-plus-base:1.4
	netbsd-6-0-RC1:1.4
	atf-0-16:1.1.1.3
	yamt-pagecache-base5:1.4
	yamt-pagecache-base4:1.4
	netbsd-6:1.4.0.8
	netbsd-6-base:1.4
	atf-0-15:1.1.1.3
	yamt-pagecache-base3:1.4
	yamt-pagecache-base2:1.4
	yamt-pagecache:1.4.0.6
	yamt-pagecache-base:1.4
	atf-0-14:1.1.1.3
	cherry-xenmp:1.4.0.4
	cherry-xenmp-base:1.4
	atf-0-13:1.1.1.3
	bouyer-quota2-nbase:1.4
	bouyer-quota2:1.4.0.2
	bouyer-quota2-base:1.4
	matt-mips64-premerge-20101231:1.4
	atf-0-12:1.1.1.3
	atf-0-11:1.1.1.3
	atf-0-10:1.1.1.2
	atf-0-9:1.1.1.1
	atf-0-8:1.1.1.1
	TNF:1.1.1;
locks; strict;
comment	@// @;


1.5
date	2014.02.08.19.13.44;	author jmmv;	state dead;
branches;
next	1.4;
commitid	V1QGpoY6GYJZzkox;

1.4
date	2010.10.20.09.17.24;	author jmmv;	state Exp;
branches
	1.4.6.1
	1.4.12.1;
next	1.3;

1.3
date	2010.07.03.08.11.26;	author jmmv;	state Exp;
branches;
next	1.2;

1.2
date	2010.06.10.15.27.02;	author jmmv;	state Exp;
branches;
next	1.1;

1.1
date	2010.05.08.08.05.23;	author jmmv;	state Exp;
branches
	1.1.1.1;
next	;

1.4.6.1
date	2014.05.22.15.40.12;	author yamt;	state dead;
branches;
next	;
commitid	TzMwNuE6CLSD5yBx;

1.4.12.1
date	2014.08.19.23.45.53;	author tls;	state dead;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.1
date	2010.05.08.08.05.23;	author jmmv;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2010.07.03.08.04.53;	author jmmv;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2010.10.20.09.14.23;	author jmmv;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Merge atf-0.19.
@
text
@//
// Automated Testing Framework (atf)
//
// Copyright (c) 2010 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
//    documentation and/or other materials provided with the distribution.
//
// 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 <map>

#include "atf-c++/tests.hpp"

#include "atf-c++/detail/fs.hpp"
#include "atf-c++/detail/process.hpp"

namespace atf {
namespace atf_run {

struct test_case_result {
    std::string m_state;
    int m_value;
    std::string m_reason;

public:
    test_case_result(void) :
        m_state("UNINITIALIZED"),
        m_value(-1),
        m_reason("")
    {
    }

    test_case_result(const std::string& p_state, const int p_value,
                     const std::string& p_reason) :
        m_state(p_state),
        m_value(p_value),
        m_reason(p_reason)
    {
    }

    const std::string&
    state(void) const
    {
        return m_state;
    }

    int
    value(void) const
    {
        return m_value;
    }

    const std::string&
    reason(void) const
    {
        return m_reason;
    }
};

namespace detail {

class atf_tp_reader {
    std::istream& m_is;

    void validate_and_insert(const std::string&, const std::string&,
                             const size_t,
                             std::map< std::string, std::string >&);

protected:
    virtual void got_tc(const std::string&,
                        const std::map< std::string, std::string >&);
    virtual void got_eof(void);

public:
    atf_tp_reader(std::istream&);
    virtual ~atf_tp_reader(void);

    void read(void);
};

test_case_result parse_test_case_result(const std::string&);

} // namespace detail

class atf_tps_writer {
    std::ostream& m_os;

    std::string m_tpname, m_tcname;

public:
    atf_tps_writer(std::ostream&);

    void info(const std::string&, const std::string&);
    void ntps(size_t);

    void start_tp(const std::string&, size_t);
    void end_tp(const std::string&);

    void start_tc(const std::string&);
    void stdout_tc(const std::string&);
    void stderr_tc(const std::string&);
    void end_tc(const std::string&, const std::string&);
};

typedef std::map< std::string, atf::tests::vars_map > test_cases_map;

struct metadata {
    test_cases_map test_cases;

    metadata(void)
    {
    }

    metadata(const test_cases_map& p_test_cases) :
        test_cases(p_test_cases)
    {
    }
};

class atf_tps_writer;

metadata get_metadata(const atf::fs::path&, const atf::tests::vars_map&);
test_case_result read_test_case_result(const atf::fs::path&);
std::pair< std::string, atf::process::status > run_test_case(
    const atf::fs::path&, const std::string&, const std::string&,
    const atf::tests::vars_map&, const atf::tests::vars_map&,
    const atf::fs::path&, const atf::fs::path&, atf_tps_writer&);

} // namespace atf_run
} // namespace atf
@


1.4
log
@Resolve import conflicts.
@
text
@@


1.4.12.1
log
@Rebase to HEAD as of a few days ago.
@
text
@@


1.4.6.1
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@@


1.3
log
@Fix merge conflicts for atf 0.10.
@
text
@d32 4
a35 3
#include <atf-c++/fs.hpp>
#include <atf-c++/process.hpp>
#include <atf-c++/tests.hpp>
@


1.2
log
@Pull up revision 2f7a426c0f4149d59a7f3717ebedd6c55998e8bc from upstream:

----------
Fix detection of crashed test cases

Prevent cross-test-case contamination that occured when a first test case
passed and the second crashed.  The second could pick up the result of the
first test case and not be reported as failed.

Similarly, change the way timed out test cases are reported back to the
caller.  The creation of a temporary results file was just a really stupid
way of passing information around and introduced false positives if the
test case creates a results file before timing out.

Fixes ticket #35.
----------

Problem originally reported by pooka@@.
@
text
@a31 1
#include <atf-c++/formats.hpp>
d39 85
d139 2
d142 5
a146 4
std::pair< std::string, atf::process::status > run_test_case(const atf::fs::path&,
    const std::string&, const std::string&, const atf::tests::vars_map&,
    const atf::tests::vars_map&, const atf::fs::path&, const atf::fs::path&,
    atf::formats::atf_tps_writer&);
@


1.1
log
@Initial revision
@
text
@d56 4
a59 8
atf::process::status run_test_case(const atf::fs::path&,
                                   const std::string&,
                                   const std::string&,
                                   const atf::tests::vars_map&,
                                   const atf::tests::vars_map&,
                                   const atf::fs::path&,
                                   const atf::fs::path&,
                                   atf::formats::atf_tps_writer&);
@


1.1.1.1
log
@Import atf 0.8.  Changes in this release:

* Test programs no longer run several test cases in a row. The execution
  of a test program now requires a test case name, and that single test
  case is executed. To execute several test cases, use the atf-run
  utility as usual.

* Test programs no longer fork a subprocess to isolate the execution of
  test cases. They run the test case code in-process, and a crash of the
  test case will result in a crash of the test program. This is to ease
  debugging of faulty test cases.

* Test programs no longer isolate their test cases. This means that they
  will not create temporary directories nor sanitize the environment any
  more. Yes: running a test case that depends on system state by hand
  will most likely yield different results depending on where (machine,
  directory, user environment, etc.) it is run. Isolation has been moved
  to atf-run.

* Test programs no longer print a cryptic format (application/X-atf-tcs)
  on a special file channel. They can now print whatever they want on
  the screen. Because test programs can now only run one test case every
  time, providing controlled output is not necessary any more.

* Test programs no longer write their status into a special file
  descriptor. Instead, they create a file with the results, which is
  later parsed by atf-run. This changes the semantics of the -r flag.

* atf-run has been adjusted to perform the test case isolation. As a
  result, there is now a single canonical place that implements the
  isolation of test caes. In previous releases, the three language
  bindings (C, C++ and shell) had to be kept in sync with each other
  (read: not a nice thing to do at all). As a side effect of this
  change, writing bindings for other languages will be much, much easier
  from now on.

* atf-run forks test programs on a test case basis, instead of on a test
  program basis as it did before. This is to provide the test case
  isolation that was before implemented by the test programs themselves.

* Removed the atf-exec tool. This was used to implement test case
  isolation in atf-sh, but it is now unnecessary.

* It is now optional to define the descr meta-data property. It has been
  proven to be mostly useless, because test cases often carry a
  descriptive name of their own.
@
text
@@


1.1.1.2
log
@Import atf 0.10:

Miscellaneous features

* Added expected failures support to test cases and atf-run.  These
  include, for example, expected clean exits, expected reception of fatal
  signals, expected timeouts and expected errors in condition checks.
  These statuses can be used to denote test cases that are known to fail
  due to a bug in the code they are testing.  atf-report reports these
  tests separately but they do not count towards the failed test cases
  amount.

* Added the ATF_CHECK_ERRNO and ATF_REQUIRE_ERRNO to the C library to
  allow easy checking of call failures that update errno.

* Added the has.cleanup meta-data property to test caes that specifies
  whether the test case has a cleanup routine or not; its value is
  automatically set.  This property is read by atf-run to know if it has to
  run the cleanup routine; skipping this run for every test case
  significantly speeds up the run time of test suites.

* Reversed the order of the ATF_CHECK_THROW macro in the C++ binding to
  take the expected exception as the first argument and the statement to
  execute as the second argument.

Changes in atf-check

* Changed atf-check to support negating the status and output checks by
  prefixing them with not- and added support to specify multiple checkers
  for stdout and stderr, not only one.

* Added the match output checker to atf-check to look for regular
  expressions in the stdout and stderr of commands.

* Modified the exit checks in atf-check to support checking for the
  reception of signals.

Code simplifications and cleanups

* Removed usage messages from test programs to simplify the
  implementation of every binding by a significant amount.  They just now
  refer the user to the appropriate manual page and do not attempt to wrap
  lines on terminal boundaries.  Test programs are not supposed to be run
  by users directly so this minor interface regression is not important.

* Removed the atf-format internal utility, which is unused after the
  change documented above.

* Removed the atf-cleanup internal utility.  It has been unused since the
  test case isolation was moved to atf-run in 0.8

* Splitted the Makefile.am into smaller files for easier maintenance and
  dropped the use of M4.  Only affects users building from the repository
  sources.

* Intermixed tests with the source files in the source tree to provide
  them more visibility and easier access.  The tests directory is gone from
  the source tree and tests are now suffixed by _test, not prefixed by t_.

* Simplifications to the atf-c library: removed the io, tcr and ui
  modules as they had become unnecessary after all simplifications
  introduced since the 0.8 release.

* Removed the application/X-atf-tcr format introduced in 0.8 release.
  Tests now print a much simplified format that is easy to parse and nicer
  to read by end users.  As a side effect, the default for test cases is
  now to print their results to stdout unless otherwise stated by providing
  the -r flag.

* Removed XML distribution documents and replaced them with plain-text
  documents.  They provided little value and introduced a lot of complexity
  to the build system.

* Simplified the output of atf-version by not attempting to print a
  revision number when building form a distfile.  Makes the build system
  easier to maintain.
@
text
@d32 1
a39 85
struct test_case_result {
    std::string m_state;
    int m_value;
    std::string m_reason;

public:
    test_case_result(void) :
        m_state("UNINITIALIZED"),
        m_value(-1),
        m_reason("")
    {
    }

    test_case_result(const std::string& p_state, const int p_value,
                     const std::string& p_reason) :
        m_state(p_state),
        m_value(p_value),
        m_reason(p_reason)
    {
    }

    const std::string&
    state(void) const
    {
        return m_state;
    }

    int
    value(void) const
    {
        return m_value;
    }

    const std::string&
    reason(void) const
    {
        return m_reason;
    }
};

namespace detail {

class atf_tp_reader {
    std::istream& m_is;

    void validate_and_insert(const std::string&, const std::string&,
                             const size_t,
                             std::map< std::string, std::string >&);

protected:
    virtual void got_tc(const std::string&,
                        const std::map< std::string, std::string >&);
    virtual void got_eof(void);

public:
    atf_tp_reader(std::istream&);
    virtual ~atf_tp_reader(void);

    void read(void);
};

test_case_result parse_test_case_result(const std::string&);

} // namespace detail

class atf_tps_writer {
    std::ostream& m_os;

    std::string m_tpname, m_tcname;

public:
    atf_tps_writer(std::ostream&);

    void info(const std::string&, const std::string&);
    void ntps(size_t);

    void start_tp(const std::string&, size_t);
    void end_tp(const std::string&);

    void start_tc(const std::string&);
    void stdout_tc(const std::string&);
    void stderr_tc(const std::string&);
    void end_tc(const std::string&, const std::string&);
};

a54 2
class atf_tps_writer;

d56 8
a63 5
test_case_result read_test_case_result(const atf::fs::path&);
std::pair< std::string, atf::process::status > run_test_case(
    const atf::fs::path&, const std::string&, const std::string&,
    const atf::tests::vars_map&, const atf::tests::vars_map&,
    const atf::fs::path&, const atf::fs::path&, atf_tps_writer&);
@


1.1.1.3
log
@Import atf-0.11:

Experimental version released on October 20th, 2010.

* The ATF_CHECK* macros in atf-c++ were renamed to ATF_REQUIRE* to match
  their counterparts in atf-c.

* Clearly separated the modules in atf-c that are supposed to be public
  from those that are implementation details.  The header files for the
  internal modules are not installed any more.

* Made the atf-check tool private.  It is only required by atf-sh and being
  public has the danger of causing confusion.  Also, making it private
  simplifies the public API of atf.

* Changed atf-sh to enable per-command error checking (set -e) by default.
  This catches many cases in which a test case is broken but it is not
  reported as such because execution continues.

* Fixed the XSTL and CSS stylesheets to support expected failures.
@
text
@d32 3
a34 4
#include "atf-c++/tests.hpp"

#include "atf-c++/detail/fs.hpp"
#include "atf-c++/detail/process.hpp"
@


