diff --git a/Makefile.am b/Makefile.am index ab5c02f9..2a0484d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -185,7 +185,9 @@ BATS = \ test/functional/update/include-old-bundle-with-tracked-file/test.bats \ test/functional/update/missing-os-core/test.bats \ test/functional/update/newest-deleted/test.bats \ + test/functional/update/newest-ghosted/test.bats \ test/functional/update/rename/test.bats \ + test/functional/update/rename-ghosted/test.bats \ test/functional/update/skip-verified-fullfiles/test.bats \ test/functional/update/status/test.bats \ test/functional/update/status-no-server-content/test.bats \ @@ -215,7 +217,10 @@ BATS = \ test/functional/verify/format-mismatch-override/test.bats \ test/functional/verify/install-directory/test.bats \ test/functional/verify/install-latest-directory/test.bats \ - test/functional/verify/latest-missing/test.bats + test/functional/verify/latest-missing/test.bats \ + test/functional/verify/ghosted/test.bats \ + test/functional/verify/picky-ghosted/test.bats \ + test/functional/verify/picky-ghosted-missing/test.bats dist_check_SCRIPTS = $(BATS) # Must be run before all other tests diff --git a/test/functional/update/newest-ghosted/lines-checked b/test/functional/update/newest-ghosted/lines-checked new file mode 100644 index 00000000..6897fe4f --- /dev/null +++ b/test/functional/update/newest-ghosted/lines-checked @@ -0,0 +1,17 @@ +Update started. +Attempting to download version string to memory +Preparing to update from 20 to 30 +Extracting os-core pack for version 30 +Statistics for going from version 20 to version 30: + changed bundles : 2 + new bundles : 0 + deleted bundles : 0 + changed files : 1 + new files : 0 + deleted files : 1 +Starting download of remaining update content. This may take a while... +Finishing download of update content... +Staging file content +Applying update +Update was applied. +Update successful. System updated from version 20 to version 30 diff --git a/test/functional/update/newest-ghosted/target-dir/testfile b/test/functional/update/newest-ghosted/target-dir/testfile new file mode 100644 index 00000000..b0e77ea5 --- /dev/null +++ b/test/functional/update/newest-ghosted/target-dir/testfile @@ -0,0 +1 @@ +should be deleted diff --git a/test/functional/update/newest-ghosted/target-dir/usr/lib/os-release b/test/functional/update/newest-ghosted/target-dir/usr/lib/os-release new file mode 100644 index 00000000..36f421bf --- /dev/null +++ b/test/functional/update/newest-ghosted/target-dir/usr/lib/os-release @@ -0,0 +1 @@ +VERSION_ID=20 diff --git a/test/functional/update/newest-ghosted/target-dir/usr/share/clear/bundles/os-core b/test/functional/update/newest-ghosted/target-dir/usr/share/clear/bundles/os-core new file mode 100644 index 00000000..e69de29b diff --git a/test/functional/update/newest-ghosted/target-dir/usr/share/clear/bundles/test-bundle2 b/test/functional/update/newest-ghosted/target-dir/usr/share/clear/bundles/test-bundle2 new file mode 100644 index 00000000..e69de29b diff --git a/test/functional/update/newest-ghosted/test.bats b/test/functional/update/newest-ghosted/test.bats new file mode 100755 index 00000000..4d331f78 --- /dev/null +++ b/test/functional/update/newest-ghosted/test.bats @@ -0,0 +1,38 @@ +#!/usr/bin/env bats + +load "../../swupdlib" + +os_release_file=1c1efd10467cbc1dddd8e63c3ef4d9099f36418ed5372d080a1bf0f03a49ab05 + +setup() { + clean_test_dir + create_manifest_tar 20 MoM + sign_manifest_mom 20 + create_manifest_tar 20 os-core + create_manifest_tar 20 test-bundle2 + create_manifest_tar 30 MoM + sign_manifest_mom 30 + create_manifest_tar 30 os-core + create_manifest_tar 30 test-bundle2 + chown_root "$DIR/web-dir/30/staged/$os_release_file" + tar -C "$DIR/web-dir/30" -cf "$DIR/web-dir/30/pack-os-core-from-20.tar" staged/$os_release_file + cp "$DIR/target-dir/testfile" "$DIR" +} + +teardown() { + clean_tars 20 + clean_tars 30 + revert_chown_root "$DIR/web-dir/30/staged/$os_release_file" + sed -i 's/30/20/' "$DIR/target-dir/usr/lib/os-release" + mv "$DIR/testfile" "$DIR/target-dir/" +} + +@test "update where the newest version of a file was ghosted" { + run sudo sh -c "$SWUPD update $SWUPD_OPTS" + + [ "$status" -eq 0 ] + check_lines "$output" + [ -f "$DIR/target-dir/testfile" ] +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/update/newest-ghosted/web-dir/20/Manifest.MoM b/test/functional/update/newest-ghosted/web-dir/20/Manifest.MoM new file mode 100644 index 00000000..4aa1ae2a --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/20/Manifest.MoM @@ -0,0 +1,9 @@ +MANIFEST 3 +version: 20 +previous: 10 +filecount: 2 +timestamp: 1451940175 +contentsize: 13805671819 + +M... f7abb1fdb99a70673498212f0bfd7f110757806e7a849563b4c7f886ea6352a0 20 os-core +M... 374556e970f164bd3e72dfdbd55bbabe332fef4e8b88667a67108cba5fcf4093 20 test-bundle2 diff --git a/test/functional/update/newest-ghosted/web-dir/20/Manifest.os-core b/test/functional/update/newest-ghosted/web-dir/20/Manifest.os-core new file mode 100644 index 00000000..9ce89181 --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/20/Manifest.os-core @@ -0,0 +1,14 @@ +MANIFEST 3 +version: 20 +previous: 10 +filecount: 7 +timestamp: 1451936779 +contentsize: 17929151 + +D... cde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr +D... dde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/lib +D... cde13514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share +D... cde23514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share/clear +D... cde43514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share/clear/bundles +F... b85f1dc2c2317a20f47a36d3257313b131124ffa6d4f19bb060d43014fd386b0 10 /usr/share/clear/bundles/os-core +F... fde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 20 /usr/lib/os-release diff --git a/test/functional/update/newest-ghosted/web-dir/20/Manifest.test-bundle2 b/test/functional/update/newest-ghosted/web-dir/20/Manifest.test-bundle2 new file mode 100644 index 00000000..6e5b33e6 --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/20/Manifest.test-bundle2 @@ -0,0 +1,9 @@ +MANIFEST 3 +version: 20 +previous: 10 +filecount: 2 +timestamp: 1451936779 +contentsize: 17929151 + +F... a85f1dc2c2317a20f47a36d3257313b131124ffa6d4f19bb060d43014fd386b0 20 /testfile +F... b85f1dc2c2317a20f47a36d3257313b131124ffa6d4f19bb060d43014fd386b0 20 /usr/share/clear/bundles/test-bundle2 diff --git a/test/functional/update/newest-ghosted/web-dir/30/Manifest.MoM b/test/functional/update/newest-ghosted/web-dir/30/Manifest.MoM new file mode 100644 index 00000000..85069eb6 --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/30/Manifest.MoM @@ -0,0 +1,9 @@ +MANIFEST 3 +version: 30 +previous: 20 +filecount: 2 +timestamp: 1451940175 +contentsize: 13805671819 + +M... 1af6a129461858652689ec4aecfef82387bb3fcd340a42e2522ad94106f48cc1 30 os-core +M... 21b4370ae849732b644503ad64048388392dec1f0c4e7bf7287e70657dfab9f0 30 test-bundle2 diff --git a/test/functional/update/newest-ghosted/web-dir/30/Manifest.os-core b/test/functional/update/newest-ghosted/web-dir/30/Manifest.os-core new file mode 100644 index 00000000..e07d98cc --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/30/Manifest.os-core @@ -0,0 +1,14 @@ +MANIFEST 3 +version: 30 +previous: 20 +filecount: 7 +timestamp: 1451936779 +contentsize: 17929151 + +D... cde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr +D... dde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/lib +D... cde13514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share +D... cde23514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share/clear +D... cde43514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share/clear/bundles +F... b85f1dc2c2317a20f47a36d3257313b131124ffa6d4f19bb060d43014fd386b0 10 /usr/share/clear/bundles/os-core +F... 1c1efd10467cbc1dddd8e63c3ef4d9099f36418ed5372d080a1bf0f03a49ab05 30 /usr/lib/os-release diff --git a/test/functional/update/newest-ghosted/web-dir/30/Manifest.test-bundle2 b/test/functional/update/newest-ghosted/web-dir/30/Manifest.test-bundle2 new file mode 100644 index 00000000..b88929fd --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/30/Manifest.test-bundle2 @@ -0,0 +1,9 @@ +MANIFEST 3 +version: 30 +previous: 20 +filecount: 2 +timestamp: 1451936779 +contentsize: 17929151 + +F... b85f1dc2c2317a20f47a36d3257313b131124ffa6d4f19bb060d43014fd386b0 20 /usr/share/clear/bundles/test-bundle2 +.g.. 0000000000000000000000000000000000000000000000000000000000000000 30 /testfile diff --git a/test/functional/update/newest-ghosted/web-dir/30/staged/1c1efd10467cbc1dddd8e63c3ef4d9099f36418ed5372d080a1bf0f03a49ab05 b/test/functional/update/newest-ghosted/web-dir/30/staged/1c1efd10467cbc1dddd8e63c3ef4d9099f36418ed5372d080a1bf0f03a49ab05 new file mode 100644 index 00000000..9e48031d --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/30/staged/1c1efd10467cbc1dddd8e63c3ef4d9099f36418ed5372d080a1bf0f03a49ab05 @@ -0,0 +1 @@ +VERSION_ID=30 diff --git a/test/functional/update/newest-ghosted/web-dir/version/formatstaging/latest b/test/functional/update/newest-ghosted/web-dir/version/formatstaging/latest new file mode 100644 index 00000000..64bb6b74 --- /dev/null +++ b/test/functional/update/newest-ghosted/web-dir/version/formatstaging/latest @@ -0,0 +1 @@ +30 diff --git a/test/functional/update/rename-ghosted/lines-checked b/test/functional/update/rename-ghosted/lines-checked new file mode 100644 index 00000000..49017f0d --- /dev/null +++ b/test/functional/update/rename-ghosted/lines-checked @@ -0,0 +1,17 @@ +Update started. +Attempting to download version string to memory +Preparing to update from 10 to 20 +Extracting os-core pack for version 20 +Statistics for going from version 10 to version 20: + changed bundles : 1 + new bundles : 0 + deleted bundles : 0 + changed files : 1 + new files : 2 + deleted files : 2 +Starting download of remaining update content. This may take a while... +Finishing download of update content... +Staging file content +Applying update +Update was applied. +Update successful. System updated from version 10 to version 20 diff --git a/test/functional/update/rename-ghosted/target-dir/bar b/test/functional/update/rename-ghosted/target-dir/bar new file mode 100644 index 00000000..190423f8 --- /dev/null +++ b/test/functional/update/rename-ghosted/target-dir/bar @@ -0,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 diff --git a/test/functional/update/rename-ghosted/target-dir/bat b/test/functional/update/rename-ghosted/target-dir/bat new file mode 100644 index 00000000..27b40f37 --- /dev/null +++ b/test/functional/update/rename-ghosted/target-dir/bat @@ -0,0 +1,99 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 20 diff --git a/test/functional/update/rename-ghosted/target-dir/baz b/test/functional/update/rename-ghosted/target-dir/baz new file mode 100644 index 00000000..06ed4e5a --- /dev/null +++ b/test/functional/update/rename-ghosted/target-dir/baz @@ -0,0 +1,99 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 10 diff --git a/test/functional/update/rename-ghosted/target-dir/foo b/test/functional/update/rename-ghosted/target-dir/foo new file mode 100644 index 00000000..190423f8 --- /dev/null +++ b/test/functional/update/rename-ghosted/target-dir/foo @@ -0,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 diff --git a/test/functional/update/rename-ghosted/target-dir/usr/lib/os-release b/test/functional/update/rename-ghosted/target-dir/usr/lib/os-release new file mode 100644 index 00000000..36f421bf --- /dev/null +++ b/test/functional/update/rename-ghosted/target-dir/usr/lib/os-release @@ -0,0 +1 @@ +VERSION_ID=20 diff --git a/test/functional/update/rename-ghosted/target-dir/usr/share/clear/bundles/os-core b/test/functional/update/rename-ghosted/target-dir/usr/share/clear/bundles/os-core new file mode 100644 index 00000000..e69de29b diff --git a/test/functional/update/rename-ghosted/test.bats b/test/functional/update/rename-ghosted/test.bats new file mode 100755 index 00000000..8bb89fb2 --- /dev/null +++ b/test/functional/update/rename-ghosted/test.bats @@ -0,0 +1,39 @@ +#!/usr/bin/env bats + +load "../../swupdlib" + +setup() { + clean_state_dir + clean_target_dir + create_manifest_tar 10 MoM + sign_manifest_mom 10 + create_manifest_tar 10 os-core + create_manifest_tar 20 MoM + sign_manifest_mom 20 + create_manifest_tar 20 os-core + set_os_release 10 + chown_root -R "$DIR/target-dir" "$DIR/web-dir" + unpack_target_from_manifest 10 MoM + unpack_target_from_manifest 10 os-core + sudo tar -C "$DIR/web-dir/20" -cf "$DIR/web-dir/20/pack-os-core-from-10.tar" delta/ staged/ +} + +teardown() { + revert_chown_root -R "$DIR/web-dir" +} + +@test "update rename ghosted file" { + run sudo sh -c "$SWUPD update $SWUPD_OPTS" + + [ $status -eq 0 ] + check_lines "$output" + + # all the files should still exist, including the ghosted ones + [ -e "$DIR/target-dir/bar" ] + [ -e "$DIR/target-dir/foo" ] + [ -e "$DIR/target-dir/bat" ] + [ -e "$DIR/target-dir/baz" ] + +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/update/rename-ghosted/web-dir/10/Manifest.MoM b/test/functional/update/rename-ghosted/web-dir/10/Manifest.MoM new file mode 100644 index 00000000..06be7494 --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/10/Manifest.MoM @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1505693993 +contentsize: 5722 + +M... d904b539bd1b18baf1309146e780f952851052203c1fef338b860ec0a47ac614 10 os-core diff --git a/test/functional/update/rename-ghosted/web-dir/10/Manifest.os-core b/test/functional/update/rename-ghosted/web-dir/10/Manifest.os-core new file mode 100644 index 00000000..3ea87a42 --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/10/Manifest.os-core @@ -0,0 +1,17 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 9 +timestamp: 1505693993 +contentsize: 5722 +status: ACTIVE + +F... fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334 10 /baz +F... 0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 10 /foo +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/lib +F... e6b5b316f2b470fc5d7a22caf4e7f6c8384a26ac8aacd80ccde5a6bd3838e87f 10 /usr/lib/os-release +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/share +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/share/clear +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/share/clear/bundles +F... 28cb7c6cad23920f344157f48ae353caca34e9a2f5cff934a4fdaaf7509f2062 10 /usr/share/clear/bundles/os-core diff --git a/test/functional/update/rename-ghosted/web-dir/10/staged/0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 b/test/functional/update/rename-ghosted/web-dir/10/staged/0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 new file mode 100644 index 00000000..190423f8 --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/10/staged/0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 @@ -0,0 +1,100 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 diff --git a/test/functional/update/rename-ghosted/web-dir/10/staged/28cb7c6cad23920f344157f48ae353caca34e9a2f5cff934a4fdaaf7509f2062 b/test/functional/update/rename-ghosted/web-dir/10/staged/28cb7c6cad23920f344157f48ae353caca34e9a2f5cff934a4fdaaf7509f2062 new file mode 100644 index 00000000..e69de29b diff --git a/test/functional/update/rename-ghosted/web-dir/10/staged/e6b5b316f2b470fc5d7a22caf4e7f6c8384a26ac8aacd80ccde5a6bd3838e87f b/test/functional/update/rename-ghosted/web-dir/10/staged/e6b5b316f2b470fc5d7a22caf4e7f6c8384a26ac8aacd80ccde5a6bd3838e87f new file mode 100644 index 00000000..b01f31ec --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/10/staged/e6b5b316f2b470fc5d7a22caf4e7f6c8384a26ac8aacd80ccde5a6bd3838e87f @@ -0,0 +1 @@ +VERSION_ID=10 diff --git a/test/functional/update/rename-ghosted/web-dir/10/staged/fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334 b/test/functional/update/rename-ghosted/web-dir/10/staged/fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334 new file mode 100644 index 00000000..06ed4e5a --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/10/staged/fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334 @@ -0,0 +1,99 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 10 diff --git a/test/functional/update/rename-ghosted/web-dir/20/Manifest.MoM b/test/functional/update/rename-ghosted/web-dir/20/Manifest.MoM new file mode 100644 index 00000000..9fb9de97 --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/20/Manifest.MoM @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 20 +previous: 10 +filecount: 1 +timestamp: 1505693993 +contentsize: 602 + +M... cde1ce5ec0e036b3a2d11a8c7f5a38286d3583ba8fd5e0c533307bd57cfa8e63 20 os-core diff --git a/test/functional/update/rename-ghosted/web-dir/20/Manifest.os-core b/test/functional/update/rename-ghosted/web-dir/20/Manifest.os-core new file mode 100644 index 00000000..7666e19d --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/20/Manifest.os-core @@ -0,0 +1,19 @@ +MANIFEST 3 +version: 20 +previous: 10 +filecount: 11 +timestamp: 1505693993 +contentsize: 602 +status: ACTIVE + +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/lib +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/share +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/share/clear +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/share/clear/bundles +F... 28cb7c6cad23920f344157f48ae353caca34e9a2f5cff934a4fdaaf7509f2062 10 /usr/share/clear/bundles/os-core +F..r 0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 20 /bar +F..r c21cc55db744a24867470b7343bdc6bde1c19e4b5a782fd82c84a86b55de6d54 20 /bat +.g.r c21cc55db744a24867470b7343bdc6bde1c19e4b5a782fd82c84a86b55de6d54 20 /baz +.g.r 0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 20 /foo +F... 43fff5857537e90559eebe9acce089110b12e62f52b057d57ccdd310f612779a 20 /usr/lib/os-release diff --git a/test/functional/update/rename-ghosted/web-dir/20/delta/10-20-0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50-0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 b/test/functional/update/rename-ghosted/web-dir/20/delta/10-20-0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50-0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 new file mode 100644 index 00000000..2f0bb3b9 Binary files /dev/null and b/test/functional/update/rename-ghosted/web-dir/20/delta/10-20-0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50-0c00735e7bf78ac9063de74a9c6712052cdebd05ae5d4a4b76a22c8395d6aa50 differ diff --git a/test/functional/update/rename-ghosted/web-dir/20/delta/10-20-fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334-c21cc55db744a24867470b7343bdc6bde1c19e4b5a782fd82c84a86b55de6d54 b/test/functional/update/rename-ghosted/web-dir/20/delta/10-20-fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334-c21cc55db744a24867470b7343bdc6bde1c19e4b5a782fd82c84a86b55de6d54 new file mode 100644 index 00000000..f14a2392 Binary files /dev/null and b/test/functional/update/rename-ghosted/web-dir/20/delta/10-20-fdfec2695a18d214f80ef9fa6edde7b9fd64312b6be61f73429c39389e1d1334-c21cc55db744a24867470b7343bdc6bde1c19e4b5a782fd82c84a86b55de6d54 differ diff --git a/test/functional/update/rename-ghosted/web-dir/20/staged/43fff5857537e90559eebe9acce089110b12e62f52b057d57ccdd310f612779a b/test/functional/update/rename-ghosted/web-dir/20/staged/43fff5857537e90559eebe9acce089110b12e62f52b057d57ccdd310f612779a new file mode 100644 index 00000000..36f421bf --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/20/staged/43fff5857537e90559eebe9acce089110b12e62f52b057d57ccdd310f612779a @@ -0,0 +1 @@ +VERSION_ID=20 diff --git a/test/functional/update/rename-ghosted/web-dir/version/formatstaging/latest b/test/functional/update/rename-ghosted/web-dir/version/formatstaging/latest new file mode 100644 index 00000000..209e3ef4 --- /dev/null +++ b/test/functional/update/rename-ghosted/web-dir/version/formatstaging/latest @@ -0,0 +1 @@ +20 diff --git a/test/functional/verify/ghosted/lines-checked b/test/functional/verify/ghosted/lines-checked new file mode 100644 index 00000000..97ce2332 --- /dev/null +++ b/test/functional/verify/ghosted/lines-checked @@ -0,0 +1,9 @@ +Verifying version 10 +Starting download of remaining update content. This may take a while... +Finishing download of update content... +Adding any missing files +Fixing modified files +Inspected 0 files + 0 files were missing + 0 files found which should be deleted +Fix successful diff --git a/test/functional/verify/ghosted/target-dir.bak/foo b/test/functional/verify/ghosted/target-dir.bak/foo new file mode 100644 index 00000000..37bfb8c6 --- /dev/null +++ b/test/functional/verify/ghosted/target-dir.bak/foo @@ -0,0 +1,5 @@ + .-. + (o o) boo! + | O \ + \ \ + `~~~' diff --git a/test/functional/verify/ghosted/target-dir/foo b/test/functional/verify/ghosted/target-dir/foo new file mode 100644 index 00000000..37bfb8c6 --- /dev/null +++ b/test/functional/verify/ghosted/target-dir/foo @@ -0,0 +1,5 @@ + .-. + (o o) boo! + | O \ + \ \ + `~~~' diff --git a/test/functional/verify/ghosted/target-dir/usr/lib/os-release b/test/functional/verify/ghosted/target-dir/usr/lib/os-release new file mode 100644 index 00000000..d20f3873 --- /dev/null +++ b/test/functional/verify/ghosted/target-dir/usr/lib/os-release @@ -0,0 +1,9 @@ +NAME="Clear Linux Software for Intel Architecture" +VERSION=1 +ID=clear-linux-os +VERSION_ID=10 +PRETTY_NAME="Clear Linux Software for Intel Architecture" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="https://bugs.clearlinux.org/jira" diff --git a/test/functional/verify/ghosted/test.bats b/test/functional/verify/ghosted/test.bats new file mode 100755 index 00000000..018e4378 --- /dev/null +++ b/test/functional/verify/ghosted/test.bats @@ -0,0 +1,29 @@ +#!/usr/bin/env bats + +load "../../swupdlib" + +setup() { + clean_test_dir + create_manifest_tar 10 MoM + sign_manifest_mom 10 + create_manifest_tar 10 os-core + chown_root -R "$DIR/target-dir" +} + +teardown() { + clean_tars 10 + clean_tars 10 files + sudo cp -r "$DIR/target-dir.bak/foo" "$DIR/target-dir" +} + +@test "verify ghosted file skipped" { + run sudo sh -c "$SWUPD verify --fix $SWUPD_OPTS" + + [ $status -eq 0 ] + check_lines "$output" + # this should exist at the end, despite being marked as "ghosted" in the + # Manifest and treated as deleted for parts of swupd-client. + [ -f "$DIR/target-dir/foo" ] +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/verify/ghosted/web-dir/10/Manifest.MoM b/test/functional/verify/ghosted/web-dir/10/Manifest.MoM new file mode 100644 index 00000000..618acf4f --- /dev/null +++ b/test/functional/verify/ghosted/web-dir/10/Manifest.MoM @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1451940175 +contentsize: 13805671819 + +M... 907d96973c42eac1e5f81fad740561ac86ade5e9d342ec05274cbc15f9730760 10 os-core diff --git a/test/functional/verify/ghosted/web-dir/10/Manifest.os-core b/test/functional/verify/ghosted/web-dir/10/Manifest.os-core new file mode 100644 index 00000000..7413eb80 --- /dev/null +++ b/test/functional/verify/ghosted/web-dir/10/Manifest.os-core @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1451936779 +contentsize: 17929151 + +.g.. 17a3a547dc2ccfd56bf13f9ed90d086d0d5967127086f223a4a514c7c468ed19 10 /foo diff --git a/test/functional/verify/ghosted/web-dir/version/formatstaging/latest b/test/functional/verify/ghosted/web-dir/version/formatstaging/latest new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/test/functional/verify/ghosted/web-dir/version/formatstaging/latest @@ -0,0 +1 @@ +10 diff --git a/test/functional/verify/picky-ghosted-missing/lines-checked b/test/functional/verify/picky-ghosted-missing/lines-checked new file mode 100644 index 00000000..61af35df --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/lines-checked @@ -0,0 +1,10 @@ +Verifying version 10 +Starting download of remaining update content. This may take a while... +Finishing download of update content... +Adding any missing files +Fixing modified files +REGEXP:--picky removing extra files under .* +Inspected 3 files + 0 files were missing + 0 files found which should be deleted +Fix successful diff --git a/test/functional/verify/picky-ghosted-missing/target-dir.bak/usr/lib/os-release b/test/functional/verify/picky-ghosted-missing/target-dir.bak/usr/lib/os-release new file mode 100644 index 00000000..d20f3873 --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/target-dir.bak/usr/lib/os-release @@ -0,0 +1,9 @@ +NAME="Clear Linux Software for Intel Architecture" +VERSION=1 +ID=clear-linux-os +VERSION_ID=10 +PRETTY_NAME="Clear Linux Software for Intel Architecture" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="https://bugs.clearlinux.org/jira" diff --git a/test/functional/verify/picky-ghosted-missing/target-dir/usr/lib/os-release b/test/functional/verify/picky-ghosted-missing/target-dir/usr/lib/os-release new file mode 100644 index 00000000..d20f3873 --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/target-dir/usr/lib/os-release @@ -0,0 +1,9 @@ +NAME="Clear Linux Software for Intel Architecture" +VERSION=1 +ID=clear-linux-os +VERSION_ID=10 +PRETTY_NAME="Clear Linux Software for Intel Architecture" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="https://bugs.clearlinux.org/jira" diff --git a/test/functional/verify/picky-ghosted-missing/test.bats b/test/functional/verify/picky-ghosted-missing/test.bats new file mode 100755 index 00000000..4021e041 --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/test.bats @@ -0,0 +1,28 @@ +#!/usr/bin/env bats + +load "../../swupdlib" + +setup() { + clean_test_dir + create_manifest_tar 10 MoM + sign_manifest_mom 10 + create_manifest_tar 10 os-core + chown_root -R "$DIR/target-dir" +} + +teardown() { + clean_tars 10 + sudo cp -r "$DIR/target-dir.bak/usr" "$DIR/target-dir/" +} + +@test "verify ghosted file not added during --picky" { + run sudo sh -c "$SWUPD verify --fix --picky $SWUPD_OPTS" + + [ $status -eq 0 ] + check_lines "$output" + # this should not exist at the end, despite being marked in the Manifest as + # "ghosted". In this case ghosted files should be ignored. + [ ! -f "$DIR/target-dir/usr/foo" ] +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/verify/picky-ghosted-missing/web-dir/10/Manifest.MoM b/test/functional/verify/picky-ghosted-missing/web-dir/10/Manifest.MoM new file mode 100644 index 00000000..cdac4ecc --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/web-dir/10/Manifest.MoM @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1451940175 +contentsize: 13805671819 + +M... 3adc3fb46d04589a96cbd0e6ea2f4a7aef7566daec64778b12865bd67aa160b0 10 os-core diff --git a/test/functional/verify/picky-ghosted-missing/web-dir/10/Manifest.os-core b/test/functional/verify/picky-ghosted-missing/web-dir/10/Manifest.os-core new file mode 100644 index 00000000..a19ea445 --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/web-dir/10/Manifest.os-core @@ -0,0 +1,11 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1451936779 +contentsize: 17929151 + +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr +.g.. 17a3a547dc2ccfd56bf13f9ed90d086d0d5967127086f223a4a514c7c468ed19 10 /usr/foo +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 10 /usr/lib +F... 8b77bb0234b3e202a8e27bc1b4d20c9ca48582519717c8379fb58078feaa5f7a 10 /usr/lib/os-release diff --git a/test/functional/verify/picky-ghosted-missing/web-dir/10/files/17a3a547dc2ccfd56bf13f9ed90d086d0d5967127086f223a4a514c7c468ed19 b/test/functional/verify/picky-ghosted-missing/web-dir/10/files/17a3a547dc2ccfd56bf13f9ed90d086d0d5967127086f223a4a514c7c468ed19 new file mode 100644 index 00000000..37bfb8c6 --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/web-dir/10/files/17a3a547dc2ccfd56bf13f9ed90d086d0d5967127086f223a4a514c7c468ed19 @@ -0,0 +1,5 @@ + .-. + (o o) boo! + | O \ + \ \ + `~~~' diff --git a/test/functional/verify/picky-ghosted-missing/web-dir/version/formatstaging/latest b/test/functional/verify/picky-ghosted-missing/web-dir/version/formatstaging/latest new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/test/functional/verify/picky-ghosted-missing/web-dir/version/formatstaging/latest @@ -0,0 +1 @@ +10 diff --git a/test/functional/verify/picky-ghosted/lines-checked b/test/functional/verify/picky-ghosted/lines-checked new file mode 100644 index 00000000..182c914e --- /dev/null +++ b/test/functional/verify/picky-ghosted/lines-checked @@ -0,0 +1,10 @@ +Verifying version 10 +Starting download of remaining update content. This may take a while... +Finishing download of update content... +Adding any missing files +Fixing modified files +REGEXP:--picky removing extra files under .* +Inspected 4 files + 0 files were missing + 0 files found which should be deleted +Fix successful diff --git a/test/functional/verify/picky-ghosted/target-dir.bak/usr/foo b/test/functional/verify/picky-ghosted/target-dir.bak/usr/foo new file mode 100644 index 00000000..37bfb8c6 --- /dev/null +++ b/test/functional/verify/picky-ghosted/target-dir.bak/usr/foo @@ -0,0 +1,5 @@ + .-. + (o o) boo! + | O \ + \ \ + `~~~' diff --git a/test/functional/verify/picky-ghosted/target-dir.bak/usr/lib/os-release b/test/functional/verify/picky-ghosted/target-dir.bak/usr/lib/os-release new file mode 100644 index 00000000..d20f3873 --- /dev/null +++ b/test/functional/verify/picky-ghosted/target-dir.bak/usr/lib/os-release @@ -0,0 +1,9 @@ +NAME="Clear Linux Software for Intel Architecture" +VERSION=1 +ID=clear-linux-os +VERSION_ID=10 +PRETTY_NAME="Clear Linux Software for Intel Architecture" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="https://bugs.clearlinux.org/jira" diff --git a/test/functional/verify/picky-ghosted/target-dir/usr/foo b/test/functional/verify/picky-ghosted/target-dir/usr/foo new file mode 100644 index 00000000..37bfb8c6 --- /dev/null +++ b/test/functional/verify/picky-ghosted/target-dir/usr/foo @@ -0,0 +1,5 @@ + .-. + (o o) boo! + | O \ + \ \ + `~~~' diff --git a/test/functional/verify/picky-ghosted/target-dir/usr/lib/os-release b/test/functional/verify/picky-ghosted/target-dir/usr/lib/os-release new file mode 100644 index 00000000..d20f3873 --- /dev/null +++ b/test/functional/verify/picky-ghosted/target-dir/usr/lib/os-release @@ -0,0 +1,9 @@ +NAME="Clear Linux Software for Intel Architecture" +VERSION=1 +ID=clear-linux-os +VERSION_ID=10 +PRETTY_NAME="Clear Linux Software for Intel Architecture" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="https://bugs.clearlinux.org/jira" diff --git a/test/functional/verify/picky-ghosted/test.bats b/test/functional/verify/picky-ghosted/test.bats new file mode 100755 index 00000000..e482c5ce --- /dev/null +++ b/test/functional/verify/picky-ghosted/test.bats @@ -0,0 +1,30 @@ +#!/usr/bin/env bats + +load "../../swupdlib" + +setup() { + clean_test_dir + create_manifest_tar 10 MoM + sign_manifest_mom 10 + create_manifest_tar 10 os-core + chown_root -R "$DIR/target-dir" +} + +teardown() { + clean_tars 10 + sudo cp -r "$DIR/target-dir.bak/usr" "$DIR/target-dir/" + revert_chown_root -R "$DIR/target-dir" +} + +@test "verify ghosted file skipped during --picky" { + run sudo sh -c "$SWUPD verify --fix --picky $SWUPD_OPTS" + + [ $status -eq 0 ] + check_lines "$output" + # this should exist at the end, despite being marked as "ghosted" in the + # Manifest. With the ghosted file existing under /usr this test is to make + # sure the ghosted files aren't removed during the --picky flow. + [ -f "$DIR/target-dir/usr/foo" ] +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/verify/picky-ghosted/web-dir/10/Manifest.MoM b/test/functional/verify/picky-ghosted/web-dir/10/Manifest.MoM new file mode 100644 index 00000000..8e5c443b --- /dev/null +++ b/test/functional/verify/picky-ghosted/web-dir/10/Manifest.MoM @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1451940175 +contentsize: 13805671819 + +M... 5d2f97d49149d49a24091a24858f5609bfa9d6a7c8306a071d46970b4960b7cb 10 os-core diff --git a/test/functional/verify/picky-ghosted/web-dir/10/Manifest.os-core b/test/functional/verify/picky-ghosted/web-dir/10/Manifest.os-core new file mode 100644 index 00000000..eb5d90af --- /dev/null +++ b/test/functional/verify/picky-ghosted/web-dir/10/Manifest.os-core @@ -0,0 +1,11 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 1 +timestamp: 1451936779 +contentsize: 17929151 + +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 0 /usr +.g.. 17a3a547dc2ccfd56bf13f9ed90d086d0d5967127086f223a4a514c7c468ed19 10 /usr/foo +D... 6c27df6efcd6fc401ff1bc67c970b83eef115f6473db4fb9d57e5de317eba96e 0 /usr/lib +F... 8b77bb0234b3e202a8e27bc1b4d20c9ca48582519717c8379fb58078feaa5f7a 0 /usr/lib/os-release diff --git a/test/functional/verify/picky-ghosted/web-dir/version/formatstaging/latest b/test/functional/verify/picky-ghosted/web-dir/version/formatstaging/latest new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/test/functional/verify/picky-ghosted/web-dir/version/formatstaging/latest @@ -0,0 +1 @@ +10