]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-policy-pinning
test/integration/test-apt-update-file: improve test
[apt.git] / test / integration / test-policy-pinning
index 6b1473564810676536c6285729735755fa920587..8eb4bcbadffc7b2a0d02560855392bf935505e3c 100755 (executable)
@@ -25,28 +25,70 @@ testequalpolicy() {
 Pinned packages:" aptcache policy $*
 }
 
-aptget update -qq
+aptgetupdate() {
+       # just to be sure that no old files are used
+       rm -rf rootdir/var/lib/apt
+       if aptget update -qq 2>&1 | grep '^E: '; then
+               msgwarn 'apt-get update failed with an error'
+       fi
+}
+
+### not signed archive
+
+aptgetupdate
 testequalpolicy 100 500
 testequalpolicy 990 500 -t now
 
 sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-aptget update -qq
+aptgetupdate
 
 testequalpolicy 100 1 -o Test=NotAutomatic
 testequalpolicy 990 1 -o Test=NotAutomatic -t now
 
 sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-aptget update -qq
+aptgetupdate
 
 testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
 testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
 
 sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-aptget update -qq
+aptgetupdate
 
 testequalpolicy 100 500 -o Test=Automatic
 testequalpolicy 990 500 -o Test=Automatic -t now
 
+sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
+
+### signed but no key in trusted
+
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+testequalpolicy 100 500
+testequalpolicy 990 500 -t now
+
+sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+
+testequalpolicy 100 1 -o Test=NotAutomatic
+testequalpolicy 990 1 -o Test=NotAutomatic -t now
+
+sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+
+testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
+testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
+
+sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
+signreleasefiles 'Marvin Paranoid'
+aptgetupdate
+
+testequalpolicy 100 500 -o Test=Automatic
+testequalpolicy 990 500 -o Test=Automatic -t now
+
+### signed and valid key
+
 buildsimplenativepackage "coolstuff" "all" "1.0" "stable"
 buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports"
 
@@ -132,7 +174,7 @@ Pin-Priority: -1" > rootdir/etc/apt/preferences
 rm rootdir/etc/apt/preferences
 sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
 signreleasefiles
-aptget update -qq
+aptgetupdate
 
 testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic
 testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable
@@ -160,7 +202,7 @@ testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t s
 rm rootdir/etc/apt/preferences
 sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
 signreleasefiles
-aptget update -qq
+aptgetupdate
 
 testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
 testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
@@ -186,16 +228,16 @@ testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomat
 testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable
 
 rm rootdir/etc/apt/preferences
-aptget install coolstuff -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -y
 testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
 testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
 testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
 testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
 
-aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -t backports -y
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
@@ -206,7 +248,7 @@ setupaptarchive
 
 sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
 signreleasefiles
-aptget update -qq
+aptgetupdate
 
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable
@@ -214,7 +256,7 @@ testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=N
 
 sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
 signreleasefiles
-aptget update -qq
+aptgetupdate
 
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable