]> pd.if.org Git - zpackage/commitdiff
add tests for package file update
authorNathan Wagner <nw@hydaspes.if.org>
Sat, 20 Oct 2018 02:54:49 +0000 (02:54 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 3 Nov 2018 12:39:52 +0000 (12:39 +0000)
set user and group of package files to the user running the test

t/install.t

index f31ec6774bb994b263421f83a2b96a83f9033f34..bd9f2d5b3087f3549942aa16c4aa477525f15948 100755 (executable)
@@ -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
@@ -146,6 +149,23 @@ 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