History log of /netbsd-current/external/bsd/atf/dist/atf-sh/libatf-sh.subr
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.5 10-Sep-2020 kre

Replace a pipe into tr to normalise a var name (convert '.' or '-'
into '_' to meet sh variable name rules) into a shell string processing
loop.

On my test system, this reduces the total elapsed time for the bin/sh ATF
tests from about 109 secs to about 102 (user cpu from 24.5 to 21, sys cpu
from 34 to 30) and the usr.bin/make tests elapsed time from 42.5 to 40
secs (user from a bit over 15 to a bit over 13, and sys from 16+ to 13+).
(Recorded on an AMD64 domU).

These probably exaggerate the effect, as there are a bunch of quite small
tests, which means the ATF overhead (which this change affects) is a greater
proportion of the total test time than for some other tests where most of
the time is spent actually testing.

But I am fairly confident that there will be at least some improvement.

This could be further improved by removing the cmdsub invocation method,
and instead passing the name of a variable containing the string to
normalise (with the result returned in that same var) - but that would
mean altering all the callers as well. Some other time maybe.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.4 30-Dec-2015 christos

Work around ksh bug


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.3 10-Jan-2014 christos

Undo previous; unfortunately the cleanup routine gets called in a different
shell so it can't cleanup stuff set in the environment of the first shell.
There are 2 problems:
- calling the test routine directly does not cleanup (not using
atf-run)
- when using atf-run, the cleanup routine needs state from the
running code which can only be stored in files. This will never
allow us to run tests in parallel since we need to keep a known
place to pass state.


# 1.2 10-Jan-2014 christos

Make cleanup work as documented; note there are no tests testing that cleanup
works.


# 1.1 04-Jun-2010 jmmv

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.4 30-Dec-2015 christos

Work around ksh bug


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
# 1.3 09-Jan-2014 christos

Undo previous; unfortunately the cleanup routine gets called in a different
shell so it can't cleanup stuff set in the environment of the first shell.
There are 2 problems:
- calling the test routine directly does not cleanup (not using
atf-run)
- when using atf-run, the cleanup routine needs state from the
running code which can only be stored in files. This will never
allow us to run tests in parallel since we need to keep a known
place to pass state.


# 1.2 09-Jan-2014 christos

Make cleanup work as documented; note there are no tests testing that cleanup
works.


# 1.1 04-Jun-2010 jmmv

branches: 1.1.1;
Initial revision


# 1.3 09-Jan-2014 christos

Undo previous; unfortunately the cleanup routine gets called in a different
shell so it can't cleanup stuff set in the environment of the first shell.
There are 2 problems:
- calling the test routine directly does not cleanup (not using
atf-run)
- when using atf-run, the cleanup routine needs state from the
running code which can only be stored in files. This will never
allow us to run tests in parallel since we need to keep a known
place to pass state.


# 1.2 09-Jan-2014 christos

Make cleanup work as documented; note there are no tests testing that cleanup
works.


# 1.1 04-Jun-2010 jmmv

branches: 1.1.1;
Initial revision


# 1.1.1.5 16-Jan-2012 jmmv

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.


# 1.1.1.4 14-Jun-2011 jmmv

branches: 1.1.1.4.2;
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.


# 1.1.1.3 20-Oct-2010 jmmv

branches: 1.1.1.3.4;
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.


# 1.1.1.2 03-Jul-2010 jmmv

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.


# 1.1.1.1 04-Jun-2010 jmmv

Import atf 0.9:

* Added atf-sh, an interpreter to process test programs written using
the shell API. This is not really a shell interpreter by itself
though: it is just a wrapper around the system shell that eases the
loading of the necessary ATF libraries.

* Removed atf-compile in favour of atf-sh.

* Added the use.fs metadata property to test case, which is used to
specify which test cases require file system access. This is to
highlight dependencies on external resources more clearly and to speed
up the execution of test suites by skipping the creation of many
unnecessary work directories.

* Fixed test programs to get a sane default value for their source
directory. This means that it should not be necessary any more to pass
-s when running test programs that do not live in the current
directory.

* Defining test case headers became optional. This is trivial to achieve
in shell-based tests but a bit ugly in C and C++. In C, use the new
ATF_TC_WITHOUT_HEAD macro to define the test case, and in C++ use
ATF_TEST_CASE_WITHOUT_HEAD.


# 1.1.1.4.2.1 16-Apr-2012 yamt

sync with head


# 1.1.1.3.4.1 23-Jun-2011 cherry

Catchup with rmind-uvmplock merge.