X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Finstall.t;h=bd9f2d5b3087f3549942aa16c4aa477525f15948;hb=cd81b1cb33d940e748ba52877267291a8ab27d18;hp=3424361ac7928318f0dfa9ceaff02efe198a4287;hpb=f8ef4d02afb01e90087a672fa5558db16292ed15;p=zpackage diff --git a/t/install.t b/t/install.t index 3424361..bd9f2d5 100755 --- a/t/install.t +++ b/t/install.t @@ -6,7 +6,10 @@ . tap.sh -plan 51 +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 @@ -53,11 +56,11 @@ PF=$pkgid.zpm #require zpm add -f $PF $pkgid /bin/true # -# install via pkgfiles +# install via syncfs # require zpm pkg -f $PF $pkgid status=installing -zpm pkgfiles -d $PF -R. $pkgid 2>&1 -okexit ran pkgfiles +zpm syncfs -d $PF -R. $pkgid 2>&1 +okexit ran syncfs test -f bin/true okexit bin/true installed @@ -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 @@ -186,6 +206,9 @@ skiponfail 3 "can't create $pkgid" || { } } +tryrun zpm uninstall -R. -d local.db third-1.0-1 +test -f bin/echo +failsok bin/echo removed cd .. || bailout require rm -rf tmp