diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2012-04-10 10:10:50 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-04-19 19:31:48 +0200 |
commit | fdf0a4496725d476243149cdef8549328c86f561 (patch) | |
tree | 593b356192a94042020c0d2bd219887f69698494 /tests/init.cfg | |
parent | 26996738e453d98d68e8a03f6d9733b89f7cdcd6 (diff) | |
download | coreutils-fdf0a4496725d476243149cdef8549328c86f561.tar.xz |
tests: factor out expensive "pairs" code of misc/stty
* tests/Makefile.am (TESTS): Add misc/stty-pairs.
* tests/init.cfg (stty_reversible_init_): New function.
(stty_reversible_query_): New function.
* tests/misc/stty: Factor out expensive "pairs" code into new test.
Use new stty_reversible_* functions instead of evaluating static
REV_* variables.
* tests/misc/stty-pairs: Add new test. Code added from misc/stty.
Mark this as an expensive test. Skip 'parenb' and 'cread' options,
as these tests are known to fail. Like in misc/stty, also use
the new stty_reversible_* functions.
Diffstat (limited to 'tests/init.cfg')
-rw-r--r-- | tests/init.cfg | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/init.cfg b/tests/init.cfg index 7bcd512a3..2e43c162d 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -241,6 +241,33 @@ rwx_to_mode_() echo "=$u$g$o" } +# Set the global variable stty_reversible_ to a space-separated list of the +# reversible settings from stty.c. stty_reversible_ also starts and ends +# with a space. +stty_reversible_init_() +{ + # Pad start with one space for the first option to match in query function. + stty_reversible_=' '$(perl -lne '/^ *{"(.*?)",.*\bREV\b/ and print $1' \ + $abs_top_srcdir/src/stty.c | tr '\n' ' ') + # Ensure that there are at least 62, i.e., so we're alerted if + # reformatting the source empties the list. + test 62 -le $(echo "$stty_reversible_"|wc -w) \ + || framework_failure_ "too few reversible settings" +} + +# Test whether $1 is one of stty's reversible options. +stty_reversible_query_() +{ + case $stty_reversible_ in + '') + framework_failure_ "stty_reversible_init_() not called?";; + *" $1 "*) + return 0;; + *) + return 1;; + esac +} + skip_if_() { case $1 in |