This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from matthewrsj/contentsize-fix
Calculate entire contentsize for manifest
- Loading branch information
Showing
3 changed files
with
79 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
test/functional/contentsize-across-versions-includes/test.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env bats | ||
|
||
# common functions | ||
load "../swupdlib" | ||
|
||
setup() { | ||
clean_test_dir | ||
init_test_dir | ||
|
||
init_server_ini | ||
init_groups_ini os-core test-bundle1 test-bundle2 | ||
|
||
set_os_release 10 os-core | ||
track_bundle 10 os-core | ||
track_bundle 10 test-bundle1 | ||
track_bundle 10 test-bundle2 | ||
gen_file_plain 10 test-bundle1 foo | ||
gen_file_plain 10 test-bundle1 foobar | ||
gen_file_plain 10 test-bundle2 foo2 | ||
gen_includes_file test-bundle2 10 test-bundle1 | ||
|
||
set_os_release 20 os-core | ||
track_bundle 20 os-core | ||
track_bundle 20 test-bundle1 | ||
track_bundle 20 test-bundle2 | ||
gen_file_plain 20 test-bundle1 foo | ||
gen_file_plain 20 test-bundle1 foobar | ||
gen_file_plain 20 test-bundle1 foobarbaz | ||
gen_file_plain 20 test-bundle2 foo2 | ||
gen_file_plain 20 test-bundle2 foo2bar | ||
gen_includes_file test-bundle2 20 test-bundle1 | ||
} | ||
|
||
@test "correct contentsize" { | ||
# create a couple updates to both check that contentsize does not add included | ||
# bundles and to verify that files changed in previous updates are counted. | ||
sudo $CREATE_UPDATE --osversion 10 --statedir $DIR --format 3 | ||
set_latest_ver 10 | ||
|
||
# contentsize for test-bundle2 should not include test-bundle1's contentsize | ||
[[ 1 -eq $(grep '^contentsize: 11$' $DIR/www/10/Manifest.test-bundle1 | wc -l) ]] | ||
[[ 1 -eq $(grep '^contentsize: 5$' $DIR/www/10/Manifest.test-bundle2 | wc -l) ]] | ||
# os-core is large because it includes /usr/* | ||
[[ 1 -eq $(grep '^contentsize: 5134$' $DIR/www/10/Manifest.os-core | wc -l) ]] | ||
# 5134 + 11 + 5 = 5150 | ||
[[ 1 -eq $(grep '^contentsize: 5150$' $DIR/www/10/Manifest.full | wc -l) ]] | ||
|
||
sudo $CREATE_UPDATE --osversion 20 --statedir $DIR --format 3 | ||
set_latest_ver 20 | ||
|
||
# one new file: foobarbaz (10 bytes) | ||
[[ 1 -eq $(grep '^contentsize: 21$' $DIR/www/20/Manifest.test-bundle1 | wc -l) ]] | ||
# one new file: foo2bar (8 bytes) | ||
[[ 1 -eq $(grep '^contentsize: 13$' $DIR/www/20/Manifest.test-bundle2 | wc -l) ]] | ||
# os-core should not change size | ||
[[ 1 -eq $(grep '^contentsize: 5134$' $DIR/www/10/Manifest.os-core | wc -l) ]] | ||
# contentsize for full should be all files, including ones not changed in this release | ||
# two new files: foo2bar (8 bytes) and foobarbaz (10 bytes) | ||
# 5150 + 10 + 8 = 5168 | ||
# 5134 + 21 + 13 = 5168 | ||
[[ 1 -eq $(grep '^contentsize: 5168$' $DIR/www/20/Manifest.full | wc -l) ]] | ||
} | ||
|
||
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 |