X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=t%2Fmake-dryrun.tap;h=0dbe3bb89b2e57f6cd1c1d0a986596a152648f71;hb=a7c00e1935726a32dca6871dd0f1b7eda28d0a5b;hp=adf2f044103deaeed761f1ac44f4284be54c7a1f;hpb=1efb88cadad61a031d1c297310bc2634562f2e87;p=platform%2Fupstream%2Fautomake.git diff --git a/t/make-dryrun.tap b/t/make-dryrun.tap old mode 100755 new mode 100644 index adf2f04..0dbe3bb --- a/t/make-dryrun.tap +++ b/t/make-dryrun.tap @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2012 Free Software Foundation, Inc. +# Copyright (C) 2012-2013 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,31 +18,70 @@ . test-init.sh -plan_ 14 +plan_ 60 -if echo "all: ; @+printf %sbb%s aa cc" | $MAKE -n -f - | grep aabbcc; then +if echo "all: ; +@printf %sbb%s aa cc" | $MAKE -n -f - | grep aabbcc; then make_plus_silence () { return 0; } else make_plus_silence () { return 1; } fi -mkdir sub +mkdir none # Also used later. +if echo nil: | $MAKE -I none -f -; then + make_supports_option_I () { return 0; } +else + make_supports_option_I () { return 1; } +fi echo AC_OUTPUT >> configure.ac cat > Makefile.am <<'END' all: : Dummy, nothing to do. -foo: - $(MAKE) all -notdry: - @echo ":: $$MAKEFLAGS ::"; : For debugging. - $(am__make_dryrun) && exit 1; exit 0 +run: + @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging. + $(am__make_dryrun) && exit 1; echo ok > from-run dry: - +@echo ":: $$MAKEFLAGS ::"; : For debugging. - +$(am__make_dryrun) || exit 1; echo ok > from-dry-mode + +@echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging. + +$(am__make_dryrun) || exit 1; echo ok > from-dry END +check_make () +{ + msg= mode= condition=: directive= reason= skip_reason= + case $1 in + --dry) mode=dry;; + --run) mode=run;; + *) fatal_ "check_run: invalid usage";; + esac + shift + while test $# -gt 0; do + case $1 in + -C) condition=$2 skip_reason=$3; shift; shift;; + -M) msg=$2; shift;; + --) shift; break;; + *) break;; + esac + shift + done + for opts in '' '-s' '-s -r'; do + r=ok + pmsg=${mode}${msg:+" [$msg]"}${opts:+" ($opts)"} + if $condition; then + $MAKE $opts "$mode" ${1+"$@"} || r='not ok' + test -f from-$mode || r='not ok' + test ! -e bad || r='not ok' + rm -f bad from-* || fatal_ "cleaning up" + else + directive=SKIP reason=$skip_reason + fi + result_ "$r" -D "$directive" -r "$reason" "$pmsg" + done + unset r msg pmsg opts mode condition directive reason skip_reason +} + +# ---------------------------------------------------------------------- + $ACLOCAL || fatal_ "aclocal failed" $AUTOCONF || fatal_ "autoconf failed" $AUTOMAKE || fatal_ "automake failed" @@ -50,48 +89,40 @@ $AUTOMAKE || fatal_ "automake failed" # ---------------------------------------------------------------------- -check_no_dryrun () -{ - command_ok_ "dry-run ($cnt)" $MAKE notdry ${1+"$@"} - cnt=$(($cnt + 1)) -} -cnt=1 - -check_no_dryrun +check_make --run # Test against a known regression. This was especially heinous, since # make running in normal mode was sometimes mistaken for make running # in dry mode. -check_no_dryrun TESTS="n1.test n2.test" -check_no_dryrun TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'" -check_no_dryrun TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"' -check_no_dryrun FOOFLAGS="-n -n -knf2 n --none -n" -check_no_dryrun MYFLAGS="-n --dryrun -n --dry-run -n" +check_make --run TESTS="n1.test n2.test" +check_make --run TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'" +check_make --run TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"' +check_make --run FOOFLAGS="-n -n -knf2 n --none -n" +check_make --run MYFLAGS="-n --dryrun -n --dry-run -n" # ---------------------------------------------------------------------- -check_dryrun () -{ - r=ok directive= - case $1 in - -C) condition=$2 reason=$3; shift; shift; shift;; - *) condition=: reason=;; - esac - if $condition; then - $MAKE dry ${1+"$@"} || r='not ok' - test -f from-dry-mode || r='not ok' - rm -f from-dry-mode || fatal_ "cleaning up" - else - directive=SKIP - fi - result_ "$r" -D "$directive" -r "$reason" "not dry-run ($cnt)" - unset r directive reason - cnt=$(($cnt + 1)) -} -cnt=1 +check_make --dry -C make_plus_silence 'recipe prefix "+" unsupported' -n +check_make --dry -C using_gmake "\$MAKE is not GNU make" --dry-run -k + +# ---------------------------------------------------------------------- + +# Automake bug#13760: the "n" in "none" used to confound am__make_dryrun +# into thinking the '-n' option had been passed. + +pr='bug#13760' + +check_make --run -C make_supports_option_I "-I make option unsupported" \ + -M "$pr" -I none + +check_make --run -C using_gmake "\$MAKE is not GNU make" \ + -M "$pr" -I none --include dry-run + +check_make --dry -C make_supports_option_I "-I make option unsupported" \ + -M "$pr" -I none -n -check_dryrun -C make_plus_silence 'recipe prefix "+" unsupported' -n -check_dryrun -C using_gmake "\$MAKE is not GNU make" --dry-run -k +check_make --dry -C using_gmake "\$MAKE is not GNU make" \ + -M "$pr" --dry-run -I none --include dry-run # ---------------------------------------------------------------------- @@ -99,25 +130,17 @@ check_dryrun -C using_gmake "\$MAKE is not GNU make" --dry-run -k check_metachars () { - r=ok - $MAKE notdry ${1+"$@"} || r='not ok' - if test -f bad; then - r='not ok' - else - rm -f bad || fatal_ "cleaning up" - fi - result_ "$r" "dry-run, with shell metachars ($cnt)" - unset r - cnt=$(($cnt + 1)) + check_make --run -M "metachars" "$@" } -cnt=1 check_metachars MYFLAGS="-n \"n\" '-n' --none -n" check_metachars MYFLAGS='-knf2\ n\ \\n' check_metachars MYFLAGS="(&) | ; \" \` '" check_metachars MYFLAGS=" ' # ' " check_metachars MYFLAGS='$(foo)' +check_metachars MYFLAGS='$(foo -n)' check_metachars MYFLAGS='`touch bad`' +check_metachars MYFLAGS='`touch --dry-run bad`' # ----------------------------------------------------------------------