X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Finstall.t;h=31fa2657c9492b062935afeb80370a08f66c6d1f;hb=903da5cc8edf74516b98027fb67a25eb407c2f4d;hp=00287a9ddab2886fe9a651498103020487f9c6d9;hpb=51a6d79f8a532376a9f27dbb5133bf13a5474703;p=zpackage diff --git a/t/install.t b/t/install.t index 00287a9..31fa265 100755 --- a/t/install.t +++ b/t/install.t @@ -6,7 +6,10 @@ . tap.sh -plan 53 +plan 62 + +owner=$(id -un) +group=$(id -gn) newpkg() { pkgid=$1 @@ -15,7 +18,7 @@ newpkg() { tryrun zpm newpackage -f $pkgid.zpm $pkgid if [ $? -eq 0 ]; then shift - tryrun zpm add -f $pkgid.zpm $pkgid "$@" + tryrun zpm add -u $owner -g $group -f $pkgid.zpm $pkgid "$@" return $? else skip 1 not adding files init failed @@ -94,7 +97,7 @@ newver=$(zpm pkg -f $PF itest version) okstreq "$newver" "2.0" "have updated version" rm -f test.out -tryrun zpm add -v -f $PF itest /bin/false +tryrun zpm add -f $PF itest /bin/false if [ $? -ne 0 ]; then diag h2 cat test.out | diagstdin @@ -142,10 +145,27 @@ newpkg $pkgid bin/sh okexit setup package $pkgid require rm bin/sh PF=$pkgid.zpm -zpm install -v -R. -d local.db -f $PF $pkgid | diagstdin +zpm install -R. -d local.db -f $PF $pkgid | diagstdin okexit installed $pkgid oktest -f bin/sh +# +# update a file +# +ohash=$(zpm hash bin/true) +require mv bin/true bin/save +require sh -c 'echo false > bin/true' +nhash=$(zpm hash bin/true) +pkgid=itest-4.0-1 +newpkg $pkgid bin/true +okexit setup package $pkgid +require mv bin/save bin/true +PF=$pkgid.zpm +zpm install -R. -d local.db -f $PF $pkgid | diagstdin +okexit installed $pkgid +rhash=$(zpm hash bin/true) +okstreq "$rhash" "$nhash" "updated bin/true" + skiponfail() { rv=$? if [ $rv -ne 0 ]; then @@ -162,7 +182,7 @@ pkgid=third-1.0-1 PF=$pkgid.zpm newpkg $pkgid /bin/echo skiponfail 3 "can't create $pkgid" || { - zpm setscript -f $PF $pkgid pre-install /bin/true + zpm script -s -f $PF -p pre-install $pkgid /bin/true okexit "add true pre-install script to $pkgid" skiponfail 2 "can't set $pkgid pre-install script" || { tryrun zpm install -v -R. -d local.db -f $PF $pkgid @@ -176,9 +196,9 @@ skiponfail 3 "can't create $pkgid" || { # pkgid=fourth-1.0-1 PF=$pkgid.zpm -newpkg $pkgid /bin/printf +newpkg $pkgid /bin/head skiponfail 3 "can't create $pkgid" || { - zpm setscript -f $PF $pkgid pre-install /bin/false + zpm script -s -f $PF -p pre-install $pkgid /bin/false okexit "add false pre-install script to $pkgid" skiponfail 1 "can't set $pkgid pre-install script" || { zpm install -R. -d local.db -f $PF $pkgid 2>/dev/null @@ -186,10 +206,9 @@ skiponfail 3 "can't create $pkgid" || { } } -tryrun zpm uninstall -d local.db third-1.0-1 +tryrun zpm uninstall -R. -d local.db third-1.0-1 test -f bin/echo failsok bin/echo removed -ls -l bin | diagstdin cd .. || bailout require rm -rf tmp