head	1.2;
access;
symbols
	perseant-exfatfs-base-20261102:1.2
	perseant-exfatfs-base-20250801:1.2
	perseant-exfatfs-base-20240630:1.2
	perseant-exfatfs:1.2.0.18
	perseant-exfatfs-base:1.2
	cjep_sun2x:1.2.0.16
	cjep_sun2x-base:1.2
	cjep_staticlib_x-base1:1.2
	cjep_staticlib_x:1.2.0.14
	cjep_staticlib_x-base:1.2
	phil-wifi-20200421:1.2
	phil-wifi-20200411:1.2
	phil-wifi-20200406:1.2
	pgoyette-compat-merge-20190127:1.2
	pgoyette-compat-20190127:1.2
	pgoyette-compat-20190118:1.2
	pgoyette-compat-1226:1.2
	pgoyette-compat-1126:1.2
	pgoyette-compat-1020:1.2
	pgoyette-compat-0930:1.2
	pgoyette-compat-0906:1.2
	pgoyette-compat-0728:1.2
	pgoyette-compat-0625:1.2
	pgoyette-compat-0521:1.2
	pgoyette-compat-0502:1.2
	pgoyette-compat-0422:1.2
	pgoyette-compat-0415:1.2
	pgoyette-compat-0407:1.2
	pgoyette-compat-0330:1.2
	pgoyette-compat-0322:1.2
	pgoyette-compat-0315:1.2
	pgoyette-compat:1.2.0.12
	pgoyette-compat-base:1.2
	perseant-stdc-iso10646:1.2.0.10
	perseant-stdc-iso10646-base:1.2
	prg-localcount2-base3:1.2
	prg-localcount2-base2:1.2
	prg-localcount2-base1:1.2
	prg-localcount2:1.2.0.8
	prg-localcount2-base:1.2
	pgoyette-localcount-20170426:1.2
	bouyer-socketcan-base1:1.2
	pgoyette-localcount-20170320:1.2
	bouyer-socketcan:1.2.0.6
	bouyer-socketcan-base:1.2
	pgoyette-localcount-20170107:1.2
	pgoyette-localcount-20161104:1.2
	localcount-20160914:1.2
	pgoyette-localcount-20160806:1.2
	pgoyette-localcount-20160726:1.2
	pgoyette-localcount:1.2.0.4
	pgoyette-localcount-base:1.2
	netbsd-6-0-6-RELEASE:1.1.1.5
	netbsd-6-1-5-RELEASE:1.1.1.5
	yamt-pagecache-base9:1.2
	yamt-pagecache-tag8:1.1.1.4.2.1
	netbsd-6-1-4-RELEASE:1.1.1.5
	netbsd-6-0-5-RELEASE:1.1.1.5
	tls-earlyentropy:1.2.0.2
	tls-earlyentropy-base:1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.2
	riastradh-drm2-base3:1.2
	netbsd-6-1-3-RELEASE:1.1.1.5
	netbsd-6-0-4-RELEASE:1.1.1.5
	netbsd-6-1-2-RELEASE:1.1.1.5
	netbsd-6-0-3-RELEASE:1.1.1.5
	netbsd-6-1-1-RELEASE:1.1.1.5
	riastradh-drm2-base2:1.1.1.5
	riastradh-drm2-base1:1.1.1.5
	riastradh-drm2:1.1.1.5.0.10
	riastradh-drm2-base:1.1.1.5
	netbsd-6-1:1.1.1.5.0.16
	netbsd-6-0-2-RELEASE:1.1.1.5
	netbsd-6-1-RELEASE:1.1.1.5
	khorben-n900:1.1.1.5.0.14
	netbsd-6-1-RC4:1.1.1.5
	netbsd-6-1-RC3:1.1.1.5
	agc-symver:1.1.1.5.0.12
	agc-symver-base:1.1.1.5
	netbsd-6-1-RC2:1.1.1.5
	netbsd-6-1-RC1:1.1.1.5
	atf-0-17:1.1.1.5
	yamt-pagecache-base8:1.1.1.5
	netbsd-6-0-1-RELEASE:1.1.1.5
	yamt-pagecache-base7:1.1.1.5
	matt-nb6-plus-nbase:1.1.1.5
	yamt-pagecache-base6:1.1.1.5
	netbsd-6-0:1.1.1.5.0.8
	netbsd-6-0-RELEASE:1.1.1.5
	netbsd-6-0-RC2:1.1.1.5
	tls-maxphys:1.1.1.5.0.6
	tls-maxphys-base:1.2
	matt-nb6-plus:1.1.1.5.0.4
	matt-nb6-plus-base:1.1.1.5
	netbsd-6-0-RC1:1.1.1.5
	atf-0-16:1.1.1.5
	yamt-pagecache-base5:1.1.1.5
	yamt-pagecache-base4:1.1.1.5
	netbsd-6:1.1.1.5.0.2
	netbsd-6-base:1.1.1.5
	atf-0-15:1.1.1.5
	yamt-pagecache-base3:1.1.1.4
	yamt-pagecache-base2:1.1.1.4
	yamt-pagecache:1.1.1.4.0.2
	yamt-pagecache-base:1.1.1.4
	atf-0-14:1.1.1.4
	cherry-xenmp:1.1.1.3.0.4
	cherry-xenmp-base:1.1.1.3
	atf-0-13:1.1.1.3
	bouyer-quota2-nbase:1.1.1.3
	bouyer-quota2:1.1.1.3.0.2
	bouyer-quota2-base:1.1.1.3
	matt-mips64-premerge-20101231:1.1.1.3
	atf-0-12:1.1.1.3
	atf-0-11:1.1.1.2
	atf-0-10:1.1.1.1
	TNF:1.1.1;
locks; strict;
comment	@// @;


1.2
date	2014.02.08.19.13.44;	author jmmv;	state dead;
branches;
next	1.1;
commitid	V1QGpoY6GYJZzkox;

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

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

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

1.1.1.3
date	2010.11.07.17.43.27;	author jmmv;	state Exp;
branches
	1.1.1.3.4.1;
next	1.1.1.4;

1.1.1.4
date	2011.06.14.15.23.25;	author jmmv;	state Exp;
branches
	1.1.1.4.2.1;
next	1.1.1.5;

1.1.1.5
date	2012.01.16.22.36.51;	author jmmv;	state Exp;
branches
	1.1.1.5.6.1;
next	;

1.1.1.3.4.1
date	2011.06.23.14.18.28;	author cherry;	state Exp;
branches;
next	;

1.1.1.4.2.1
date	2012.04.17.00.03.03;	author yamt;	state Exp;
branches;
next	1.1.1.4.2.2;

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

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


desc
@@


1.2
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 "atf-c++/config.hpp"
#include "atf-c++/macros.hpp"
#include "atf-c++/user.hpp"

#include "requirements.hpp"

namespace impl = atf::atf_run;

// -------------------------------------------------------------------------
// Auxiliary functions.
// -------------------------------------------------------------------------

namespace {

const atf::tests::vars_map no_config;

void
do_check(const std::string& expected, const atf::tests::vars_map& metadata,
         const atf::tests::vars_map& config = no_config)
{
    const std::string actual = impl::check_requirements(metadata, config);
    if (actual != expected)
        ATF_FAIL("Requirements failure reason \"" + actual + "\" does not "
                 "match \"" + expected + "\"");
}

} // anonymous namespace

// -------------------------------------------------------------------------
// Tests for the require.arch metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE(require_arch_one_ok);
ATF_TEST_CASE_HEAD(require_arch_one_ok) {}
ATF_TEST_CASE_BODY(require_arch_one_ok) {
    atf::tests::vars_map metadata;
    metadata["require.arch"] = atf::config::get("atf_arch");
    do_check("", metadata);
}

ATF_TEST_CASE(require_arch_one_fail);
ATF_TEST_CASE_HEAD(require_arch_one_fail) {}
ATF_TEST_CASE_BODY(require_arch_one_fail) {
    atf::tests::vars_map metadata;
    metadata["require.arch"] = "__fake_arch__";
    do_check("Requires the '__fake_arch__' architecture", metadata);
}

ATF_TEST_CASE(require_arch_many_ok);
ATF_TEST_CASE_HEAD(require_arch_many_ok) {}
ATF_TEST_CASE_BODY(require_arch_many_ok) {
    atf::tests::vars_map metadata;
    metadata["require.arch"] = "__foo__ " + atf::config::get("atf_arch") +
        " __bar__";
    do_check("", metadata);
}

ATF_TEST_CASE(require_arch_many_fail);
ATF_TEST_CASE_HEAD(require_arch_many_fail) {}
ATF_TEST_CASE_BODY(require_arch_many_fail) {
    atf::tests::vars_map metadata;
    metadata["require.arch"] = "__foo__ __bar__ __baz__";
    do_check("Requires one of the '__foo__ __bar__ __baz__' architectures",
             metadata);
}

// -------------------------------------------------------------------------
// Tests for the require.config metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE(require_config_one_ok);
ATF_TEST_CASE_HEAD(require_config_one_ok) {}
ATF_TEST_CASE_BODY(require_config_one_ok) {
    atf::tests::vars_map metadata, config;
    metadata["require.config"] = "var1";
    config["var1"] = "some-value";
    do_check("", metadata, config);
}

ATF_TEST_CASE(require_config_one_fail);
ATF_TEST_CASE_HEAD(require_config_one_fail) {}
ATF_TEST_CASE_BODY(require_config_one_fail) {
    atf::tests::vars_map metadata, config;
    metadata["require.config"] = "var1";
    do_check("Required configuration variable 'var1' not defined", metadata,
             config);
}

ATF_TEST_CASE(require_config_many_ok);
ATF_TEST_CASE_HEAD(require_config_many_ok) {}
ATF_TEST_CASE_BODY(require_config_many_ok) {
    atf::tests::vars_map metadata, config;
    metadata["require.config"] = "var1 var2 var3";
    config["var1"] = "first-value";
    config["var2"] = "second-value";
    config["var3"] = "third-value";
    do_check("", metadata, config);
}

ATF_TEST_CASE(require_config_many_fail);
ATF_TEST_CASE_HEAD(require_config_many_fail) {}
ATF_TEST_CASE_BODY(require_config_many_fail) {
    atf::tests::vars_map metadata, config;
    metadata["require.config"] = "var1 var2 var3";
    config["var1"] = "first-value";
    config["var3"] = "third-value";
    do_check("Required configuration variable 'var2' not defined", metadata,
             config);
}

// -------------------------------------------------------------------------
// Tests for the require.machine metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE(require_machine_one_ok);
ATF_TEST_CASE_HEAD(require_machine_one_ok) {}
ATF_TEST_CASE_BODY(require_machine_one_ok) {
    atf::tests::vars_map metadata;
    metadata["require.machine"] = atf::config::get("atf_machine");
    do_check("", metadata);
}

ATF_TEST_CASE(require_machine_one_fail);
ATF_TEST_CASE_HEAD(require_machine_one_fail) {}
ATF_TEST_CASE_BODY(require_machine_one_fail) {
    atf::tests::vars_map metadata;
    metadata["require.machine"] = "__fake_machine__";
    do_check("Requires the '__fake_machine__' machine type", metadata);
}

ATF_TEST_CASE(require_machine_many_ok);
ATF_TEST_CASE_HEAD(require_machine_many_ok) {}
ATF_TEST_CASE_BODY(require_machine_many_ok) {
    atf::tests::vars_map metadata;
    metadata["require.machine"] = "__foo__ " + atf::config::get("atf_machine") +
        " __bar__";
    do_check("", metadata);
}

ATF_TEST_CASE(require_machine_many_fail);
ATF_TEST_CASE_HEAD(require_machine_many_fail) {}
ATF_TEST_CASE_BODY(require_machine_many_fail) {
    atf::tests::vars_map metadata;
    metadata["require.machine"] = "__foo__ __bar__ __baz__";
    do_check("Requires one of the '__foo__ __bar__ __baz__' machine types",
             metadata);
}

// -------------------------------------------------------------------------
// Tests for the require.progs metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE(require_progs_one_ok);
ATF_TEST_CASE_HEAD(require_progs_one_ok) {}
ATF_TEST_CASE_BODY(require_progs_one_ok) {
    atf::tests::vars_map metadata;
    metadata["require.progs"] = "cp";
    do_check("", metadata);
}

ATF_TEST_CASE(require_progs_one_missing);
ATF_TEST_CASE_HEAD(require_progs_one_missing) {}
ATF_TEST_CASE_BODY(require_progs_one_missing) {
    atf::tests::vars_map metadata;
    metadata["require.progs"] = "cp __non-existent__";
    do_check("Required program '__non-existent__' not found in the PATH",
             metadata);
}

ATF_TEST_CASE(require_progs_one_fail);
ATF_TEST_CASE_HEAD(require_progs_one_fail) {}
ATF_TEST_CASE_BODY(require_progs_one_fail) {
    atf::tests::vars_map metadata;
    metadata["require.progs"] = "bin/cp";
    ATF_CHECK_THROW(std::runtime_error,
                    impl::check_requirements(metadata, no_config));
}

ATF_TEST_CASE(require_progs_many_ok);
ATF_TEST_CASE_HEAD(require_progs_many_ok) {}
ATF_TEST_CASE_BODY(require_progs_many_ok) {
    atf::tests::vars_map metadata;
    metadata["require.progs"] = "cp ls mv";
    do_check("", metadata);
}

ATF_TEST_CASE(require_progs_many_missing);
ATF_TEST_CASE_HEAD(require_progs_many_missing) {}
ATF_TEST_CASE_BODY(require_progs_many_missing) {
    atf::tests::vars_map metadata;
    metadata["require.progs"] = "mv ls __foo__ cp";
    do_check("Required program '__foo__' not found in the PATH", metadata);
}

ATF_TEST_CASE(require_progs_many_fail);
ATF_TEST_CASE_HEAD(require_progs_many_fail) {}
ATF_TEST_CASE_BODY(require_progs_many_fail) {
    atf::tests::vars_map metadata;
    metadata["require.progs"] = "ls cp ../bin/cp";
    ATF_CHECK_THROW(std::runtime_error,
                    impl::check_requirements(metadata, no_config));
}

// -------------------------------------------------------------------------
// Tests for the require.user metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE(require_user_root);
ATF_TEST_CASE_HEAD(require_user_root) {}
ATF_TEST_CASE_BODY(require_user_root) {
    atf::tests::vars_map metadata;
    metadata["require.user"] = "root";
    if (atf::user::is_root())
        do_check("", metadata);
    else
        do_check("Requires root privileges", metadata);
}

ATF_TEST_CASE(require_user_unprivileged);
ATF_TEST_CASE_HEAD(require_user_unprivileged) {}
ATF_TEST_CASE_BODY(require_user_unprivileged) {
    atf::tests::vars_map metadata;
    metadata["require.user"] = "unprivileged";
    if (atf::user::is_root())
        do_check("Requires an unprivileged user", metadata);
    else
        do_check("", metadata);
}

ATF_TEST_CASE(require_user_fail);
ATF_TEST_CASE_HEAD(require_user_fail) {}
ATF_TEST_CASE_BODY(require_user_fail) {
    atf::tests::vars_map metadata;
    metadata["require.user"] = "nobody";
    ATF_CHECK_THROW(std::runtime_error,
                    impl::check_requirements(metadata, no_config));
}

// -------------------------------------------------------------------------
// Main.
// -------------------------------------------------------------------------

ATF_INIT_TEST_CASES(tcs)
{
    // Add test cases for require.arch.
    ATF_ADD_TEST_CASE(tcs, require_arch_one_ok);
    ATF_ADD_TEST_CASE(tcs, require_arch_one_fail);
    ATF_ADD_TEST_CASE(tcs, require_arch_many_ok);
    ATF_ADD_TEST_CASE(tcs, require_arch_many_fail);

    // Add test cases for require.config.
    ATF_ADD_TEST_CASE(tcs, require_config_one_ok);
    ATF_ADD_TEST_CASE(tcs, require_config_one_fail);
    ATF_ADD_TEST_CASE(tcs, require_config_many_ok);
    ATF_ADD_TEST_CASE(tcs, require_config_many_fail);

    // Add test cases for require.machine.
    ATF_ADD_TEST_CASE(tcs, require_machine_one_ok);
    ATF_ADD_TEST_CASE(tcs, require_machine_one_fail);
    ATF_ADD_TEST_CASE(tcs, require_machine_many_ok);
    ATF_ADD_TEST_CASE(tcs, require_machine_many_fail);

    // Add test cases for require.progs.
    ATF_ADD_TEST_CASE(tcs, require_progs_one_ok);
    ATF_ADD_TEST_CASE(tcs, require_progs_one_missing);
    ATF_ADD_TEST_CASE(tcs, require_progs_one_fail);
    ATF_ADD_TEST_CASE(tcs, require_progs_many_ok);
    ATF_ADD_TEST_CASE(tcs, require_progs_many_missing);
    ATF_ADD_TEST_CASE(tcs, require_progs_many_fail);

    // Add test cases for require.user.
    ATF_ADD_TEST_CASE(tcs, require_user_root);
    ATF_ADD_TEST_CASE(tcs, require_user_unprivileged);
    ATF_ADD_TEST_CASE(tcs, require_user_fail);
}
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
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
@@


1.1.1.2
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 1
a34 1
#include "user.hpp"
d204 1
a204 1
    ATF_REQUIRE_THROW(std::runtime_error,
d229 1
a229 1
    ATF_REQUIRE_THROW(std::runtime_error,
d242 1
a242 1
    if (atf::atf_run::is_root())
d253 1
a253 1
    if (atf::atf_run::is_root())
d264 1
a264 1
    ATF_REQUIRE_THROW(std::runtime_error,
@


1.1.1.3
log
@Import atf 0.12:

Experimental version released on November 7th, 2010.

* Added the ATF_REQUIRE_THROW_RE to atf-c++, which is the same as
  ATF_REQUIRE_THROW but allows checking for the validity of the exception's
  error message by means of a regular expression.

* Added the ATF_REQUIRE_MATCH to atf-c++, which allows checking for a
  regular expression match in a string.

* Changed the default timeout for test cases from 5 minutes to 30 seconds.
  30 seconds is long enough for virtually all tests to complete, and 5
  minutes is a way too long pause in a test suite where a single test case
  stalls.

* Deprecated the use.fs property.  While this seemed like a good idea in
  the first place to impose more control on what test cases can do, it
  turns out to be bad.  First, use.fs=false prevents bogus test cases
  from dumping core so after-the-fact debugging is harder.  Second,
  supporting use.fs adds a lot of unnecessary complexity.  atf-run will
  now ignore any value provided to use.fs and will allow test cases to
  freely access the file system if they wish to.

* Added the atf_tc_get_config_var_as_{bool,long}{,_wd} functions to the atf-c
  library.  The 'text' module became private in 0.11 but was being used
  externally to simplify the parsing of configuration variables.

* Made atf-run recognize the 'unprivileged-user' configuration variable
  and automatically drop root privileges when a test case sets
  require.user=unprivileged.  Note that this is, by no means, done for
  security purposes; this is just for user convenience; tests should, in
  general, not be blindly run as root in the first place.
@
text
@d254 1
a254 2
        do_check("Requires an unprivileged user and the 'unprivileged-user' "
                 "configuration variable is not set", metadata);
@


1.1.1.3.4.1
log
@Catchup with rmind-uvmplock merge.
@
text
@d4 1
a4 1
// Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
a140 48
// Tests for the require.files metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE_WITHOUT_HEAD(require_files_one_ok);
ATF_TEST_CASE_BODY(require_files_one_ok) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/ls";
    do_check("", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_one_missing);
ATF_TEST_CASE_BODY(require_files_one_missing) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/non-existent/foo";
    do_check("Required file '/non-existent/foo' not found", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_one_fail);
ATF_TEST_CASE_BODY(require_files_one_fail) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/cp this-is-relative";
    ATF_REQUIRE_THROW_RE(std::runtime_error, "Relative.*(this-is-relative)",
                         impl::check_requirements(metadata, no_config));
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_many_ok);
ATF_TEST_CASE_BODY(require_files_many_ok) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/ls /bin/cp";
    do_check("", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_many_missing);
ATF_TEST_CASE_BODY(require_files_many_missing) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/ls /non-existent/bar /bin/cp";
    do_check("Required file '/non-existent/bar' not found", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_many_fail);
ATF_TEST_CASE_BODY(require_files_many_fail) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/cp also-relative";
    ATF_REQUIRE_THROW_RE(std::runtime_error, "Relative.*(also-relative)",
                         impl::check_requirements(metadata, no_config));
}

// -------------------------------------------------------------------------
a286 8
    // Add test cases for require.files.
    ATF_ADD_TEST_CASE(tcs, require_files_one_ok);
    ATF_ADD_TEST_CASE(tcs, require_files_one_missing);
    ATF_ADD_TEST_CASE(tcs, require_files_one_fail);
    ATF_ADD_TEST_CASE(tcs, require_files_many_ok);
    ATF_ADD_TEST_CASE(tcs, require_files_many_missing);
    ATF_ADD_TEST_CASE(tcs, require_files_many_fail);

@


1.1.1.4
log
@Import atf-0.14:

Experimental version released on June 14th, 2011.

* Added a pkg-config file for atf-sh and an aclocal file to ease the
  detection of atf-sh from autoconf scripts.

* Made the default test case body defined by atf_sh fail.  This is to
  ensure that test cases are properly defined in test programs and helps
  in catching typos in the names of the body functions.

* PR bin/44882: Made atf-run connect the stdin of test cases to /dev/zero.
  This provides more consistent results with "normal" execution (in
  particular, when tests are executed detached from a terminal).

* Made atf-run hardcode TZ=UTC for test cases.  It used to undefine TZ, but
  that does not take into account that libc determines the current timezone
  from a configuration file.

* All test programs will now print a warning when they are not run through
  atf-run(1) stating that this is unsupported and may deliver incorrect
  results.

* Added support for the 'require.files' test-case property.  This allows
  test cases to specify installed files that must be present for the test
  case to run.
@
text
@d4 1
a4 1
// Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
a140 48
// Tests for the require.files metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE_WITHOUT_HEAD(require_files_one_ok);
ATF_TEST_CASE_BODY(require_files_one_ok) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/ls";
    do_check("", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_one_missing);
ATF_TEST_CASE_BODY(require_files_one_missing) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/non-existent/foo";
    do_check("Required file '/non-existent/foo' not found", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_one_fail);
ATF_TEST_CASE_BODY(require_files_one_fail) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/cp this-is-relative";
    ATF_REQUIRE_THROW_RE(std::runtime_error, "Relative.*(this-is-relative)",
                         impl::check_requirements(metadata, no_config));
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_many_ok);
ATF_TEST_CASE_BODY(require_files_many_ok) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/ls /bin/cp";
    do_check("", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_many_missing);
ATF_TEST_CASE_BODY(require_files_many_missing) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/ls /non-existent/bar /bin/cp";
    do_check("Required file '/non-existent/bar' not found", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_files_many_fail);
ATF_TEST_CASE_BODY(require_files_many_fail) {
    atf::tests::vars_map metadata;
    metadata["require.files"] = "/bin/cp also-relative";
    ATF_REQUIRE_THROW_RE(std::runtime_error, "Relative.*(also-relative)",
                         impl::check_requirements(metadata, no_config));
}

// -------------------------------------------------------------------------
a286 8
    // Add test cases for require.files.
    ATF_ADD_TEST_CASE(tcs, require_files_one_ok);
    ATF_ADD_TEST_CASE(tcs, require_files_one_missing);
    ATF_ADD_TEST_CASE(tcs, require_files_one_fail);
    ATF_ADD_TEST_CASE(tcs, require_files_many_ok);
    ATF_ADD_TEST_CASE(tcs, require_files_many_missing);
    ATF_ADD_TEST_CASE(tcs, require_files_many_fail);

@


1.1.1.4.2.1
log
@sync with head
@
text
@d4 1
a4 1
// Copyright (c) 2010 The NetBSD Foundation, Inc.
a30 1
#include "atf-c++/detail/text.hpp"
d51 1
a51 1
    if (!atf::text::match(actual, expected))
a226 31
// Tests for the require.memory metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE_WITHOUT_HEAD(require_memory_ok);
ATF_TEST_CASE_BODY(require_memory_ok) {
    atf::tests::vars_map metadata;
    metadata["require.memory"] = "1m";
    do_check("", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_memory_not_enough);
ATF_TEST_CASE_BODY(require_memory_not_enough) {
    atf::tests::vars_map metadata;
    metadata["require.memory"] = "128t";
#if defined(__APPLE__) || 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);
ATF_TEST_CASE_BODY(require_memory_fail) {
    atf::tests::vars_map metadata;
    metadata["require.memory"] = "foo";
    ATF_REQUIRE_THROW(std::runtime_error,
                      impl::check_requirements(metadata, no_config));
}

// -------------------------------------------------------------------------
a348 5
    // Add test cases for require.memory.
    ATF_ADD_TEST_CASE(tcs, require_memory_ok);
    ATF_ADD_TEST_CASE(tcs, require_memory_not_enough);
    ATF_ADD_TEST_CASE(tcs, require_memory_fail);

@


1.1.1.4.2.2
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.1.1.5
log
@Import atf 0.15: the major goal of this import is to reconcile any local
changes to the atf codebase with upstream code.  All local changes should
have been backported, with appropriate portability workarounds where
necessary.

This new release also includes other changes though, such as performance
improvements and bug fixes, and also a major new feature partially
implemented by pgoyette@@: the time to execute each test cases and test
program is now recorded and included in the output reports.

The import into NetBSD has been tested natively on amd64 and macppc, and
the full test suite has also been run through anita on amd64 and i386.
No regressions observed... but you never know.

From the NEWS file, the changes in this version are as follows:

Experimental version released on January 16th, 2012.

* Respect stdin in atf-check.  The previous release silenced stdin for any
  processes spawned by atf, not only test programs, which caused breakage
  in tests that pipe data through atf-check.

* Performance improvements to atf-sh.

* Enabled detection of unused parameters and variables in the code and
  fixed all warnings.

* Changed the behavior of "developer mode".  Compiler warnings are now
  enabled unconditionally regardless of whether we are in developer mode or
  not; developer mode is now only used to perform strict warning checks and
  to enable assertions.  Additionally, developer mode is now only
  automatically enabled when building from the repository, not for formal
  releases.

* Added new Autoconf M4 macros (ATF_ARG_WITH, ATF_CHECK_C and
  ATF_CHECK_CXX) to provide a consistent way of defining a --with-arg flag
  in configure scripts and detecting the presence of any of the ATF
  bindings.  Note that ATF_CHECK_SH was already introduced in 0.14, but it
  has now been modified to also honor --with-atf if instantiated.

* Added timing support to atf-run / atf-report.

* Added support for a 'require.memory' property, to specify the minimum
  amount of physical memory needed by the test case to yield valid results.

* PR bin/45690: Force an ISO-8859-1 encoding in the XML files generated by
  atf-report so that invalid data in the output of test cases does not
  mangle our report.
@
text
@d4 1
a4 1
// Copyright (c) 2010 The NetBSD Foundation, Inc.
a30 1
#include "atf-c++/detail/text.hpp"
d51 1
a51 1
    if (!atf::text::match(actual, expected))
a226 31
// Tests for the require.memory metadata property.
// -------------------------------------------------------------------------

ATF_TEST_CASE_WITHOUT_HEAD(require_memory_ok);
ATF_TEST_CASE_BODY(require_memory_ok) {
    atf::tests::vars_map metadata;
    metadata["require.memory"] = "1m";
    do_check("", metadata);
}

ATF_TEST_CASE_WITHOUT_HEAD(require_memory_not_enough);
ATF_TEST_CASE_BODY(require_memory_not_enough) {
    atf::tests::vars_map metadata;
    metadata["require.memory"] = "128t";
#if defined(__APPLE__) || 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);
ATF_TEST_CASE_BODY(require_memory_fail) {
    atf::tests::vars_map metadata;
    metadata["require.memory"] = "foo";
    ATF_REQUIRE_THROW(std::runtime_error,
                      impl::check_requirements(metadata, no_config));
}

// -------------------------------------------------------------------------
a348 5
    // Add test cases for require.memory.
    ATF_ADD_TEST_CASE(tcs, require_memory_ok);
    ATF_ADD_TEST_CASE(tcs, require_memory_not_enough);
    ATF_ADD_TEST_CASE(tcs, require_memory_fail);

@


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


