diff options
author | Junichi Uekawa <dancer@netfort.gr.jp> | 2008-08-12 04:16:17 +0900 |
---|---|---|
committer | Junichi Uekawa <dancer@netfort.gr.jp> | 2008-08-12 04:16:17 +0900 |
commit | 48de02113c3cea946598fe6be71cdcd0722793b7 (patch) | |
tree | a74f5164a1a7d4d2aa552a9a1b6629173ed5e4c3 | |
parent | b1399cc2e69ac704f836c5199c0c781458f0c353 (diff) | |
download | pbuilder-48de02113c3cea946598fe6be71cdcd0722793b7.tar pbuilder-48de02113c3cea946598fe6be71cdcd0722793b7.tar.gz |
added test things to --echo as well.
-rwxr-xr-x | pbuilder-satisfydepends-checkparams | 14 | ||||
-rwxr-xr-x | test_pbuilder-satisfydepends-checkparams | 28 | ||||
-rw-r--r-- | testlib.sh | 10 |
3 files changed, 37 insertions, 15 deletions
diff --git a/pbuilder-satisfydepends-checkparams b/pbuilder-satisfydepends-checkparams index f545828..13c7674 100755 --- a/pbuilder-satisfydepends-checkparams +++ b/pbuilder-satisfydepends-checkparams @@ -34,8 +34,8 @@ while [ -n "$1" ]; do shift; shift ;; - # --chroot option and --internal-chrootexec options conflict with each other. - # + # --chroot option and --internal-chrootexec options and --echo options somewhat conflict with each other. + --chroot) CHROOTEXEC="chroot $2 " if [ ${CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC} = maybe ]; then @@ -49,6 +49,12 @@ while [ -n "$1" ]; do CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=maybe shift; shift ;; + --echo) + CHROOTEXEC="echo $CHROOTEXEC" + CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=maybe + shift + ;; + --binary-all) BD_REGEXP='build-(depends|depends-indep)' BC_REGEXP='build-(conflicts|conflicts-indep)' @@ -59,10 +65,6 @@ while [ -n "$1" ]; do BC_REGEXP='build-conflicts' shift ;; - --echo) - CHROOTEXEC="echo $CHROOTEXEC" - shift - ;; --continue-fail) CONTINUE_FAIL="yes" shift diff --git a/test_pbuilder-satisfydepends-checkparams b/test_pbuilder-satisfydepends-checkparams index d0ef2dc..1c4d65d 100755 --- a/test_pbuilder-satisfydepends-checkparams +++ b/test_pbuilder-satisfydepends-checkparams @@ -9,16 +9,36 @@ checkbuilddep_internal() { : # do nothing function } +test_chrootexec2() { + set -- --internal-chrootexec 'chroot /tmp-hoge ' --chroot /tmp + . ./pbuilder-satisfydepends-checkparams +} +expect_fail test_chrootexec2 + test_chrootexec1() { set -- --chroot /tmp --internal-chrootexec 'chroot /tmp-hoge ' . ./pbuilder-satisfydepends-checkparams } +expect_success test_chrootexec1 -test_chrootexec2() { - set -- --internal-chrootexec 'chroot /tmp-hoge ' --chroot /tmp +test_chrootexec_echo() { + set -- --echo --chroot /tmp . ./pbuilder-satisfydepends-checkparams } +expect_fail test_chrootexec_echo + +test_chrootexec_echo2() { + set -- --chroot /tmp --echo + . ./pbuilder-satisfydepends-checkparams + echo $CHROOTEXEC +} +expect_output "echo chroot /tmp" test_chrootexec_echo2 + +test_chrootexec_expect() { + set -- --chroot /tmp --internal-chrootexec 'chroot /tmp-hoge ' + . ./pbuilder-satisfydepends-checkparams + echo $CHROOTEXEC +} +expect_output "chroot /tmp-hoge" test_chrootexec_expect -expect_success test_chrootexec1 -expect_fail test_chrootexec2 testlib_summary @@ -58,13 +58,13 @@ expect_fail() { expect_output() { # run the test in subshell - local val - val="$1"; - shift - if [ $( "$@" ) = "$1" ]; then + local val result + val="$1"; shift + result="$( ( "$@" 2>&1 ) )"|| true + if [ "${result}" = "${val}" ]; then testlib_echo "OK" "$1" else - testlib_echo "FAIL" "$1" + testlib_echo "FAIL" "$1 reason: [${result}] != [${val}]" fi } |