diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2012-08-22 15:04:04 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-08-22 15:45:01 +0200 |
commit | fadf9c525787f063e6fe84bdd5566e53a622c1ce (patch) | |
tree | b1b113b7e2603f431dba408f79f4954545c28baf /cfg.mk | |
parent | cf7e1b5b8fb53aef2a9103a32d6ad5ee0b595fa6 (diff) | |
download | coreutils-fadf9c525787f063e6fe84bdd5566e53a622c1ce.tar.xz |
tests: correct print_ver_ arguments and add a rule to enforce this
We use print_ver_ to run "PROG --version" for each program under
test. Some tests have been derived from others, while the
argument(s) to print_ver_ have not been adapted.
Add a new cfg.mk rule to prohibit this.
* cfg.mk (sc_prohibit_test_calls_print_ver_with_irrelevant_argument):
New rule, to prohibit a test script from calling print_env_ for a
program not actually used by that test.
* tests/chown/basic: s/\(print_ver_\) chgrp/\1 chown/
* tests/cp/acl: s/\(print_ver_\) mv/\1 cp/
* tests/cp/capability: s/\(print_ver_\) ls/\1 cp/
* tests/cp/cp-parents: s/(print_ver_\) mv/\1 cp/
* tests/du/bind-mount-dir-cycle: s/(print_ver_\) rm/\1 du/
* tests/misc/wc-parallel: s/(print_ver_\) md5sum/\1 wc/
Diffstat (limited to 'cfg.mk')
-rw-r--r-- | cfg.mk | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -329,6 +329,24 @@ sc_some_programs_must_avoid_exit_failure: && { echo '$(ME): do not use EXIT_FAILURE in the above' \ 1>&2; exit 1; } || : +# Ensure that tests call the print_ver_ function for programs which are +# actually used in that test. +sc_prohibit_test_calls_print_ver_with_irrelevant_argument: + @git grep -w print_ver_ tests \ + | sed 's#:print_ver_##' \ + | { fail=0; \ + while read file name; do \ + for i in $$name; do \ + case "$$i" in install) i=ginstall;; esac; \ + grep -w "$$i" $$file|grep -vw print_ver_|grep -q . \ + || { fail=1; \ + echo "*** Test: $$file, offending: $$i." 1>&2; };\ + done; \ + done; \ + test $$fail = 0 || exit 1; \ + } || { echo "$(ME): the above test(s) call print_ver_ for" \ + "program(s) they don't use" 1>&2; exit 1; } + # Exempt the contents of any usage function from the following. _continued_string_col_1 = \ s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e} |