mirror of
https://github.com/clearlinux/swupd-server.git
synced 2026-10-04 16:08:29 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22823ec8c8 | ||
|
|
c69a5d87bf | ||
|
|
b103c214a0 |
@@ -117,6 +117,7 @@ dist_check_SCRIPTS = \
|
|||||||
test/functional/no-delta/test.bats \
|
test/functional/no-delta/test.bats \
|
||||||
test/functional/pack/test.bats \
|
test/functional/pack/test.bats \
|
||||||
test/functional/state-file/test.bats \
|
test/functional/state-file/test.bats \
|
||||||
|
test/functional/subtract-delete/test.bats \
|
||||||
test/functional/update/test.bats
|
test/functional/update/test.bats
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ([2.66])
|
AC_PREREQ([2.66])
|
||||||
AC_INIT(swupd-server, 3.3.3, tudor.marcu@intel.com)
|
AC_INIT(swupd-server, 3.3.4, tudor.marcu@intel.com)
|
||||||
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|||||||
@@ -582,6 +582,16 @@ void subtract_manifests(struct manifest *m1, struct manifest *m2)
|
|||||||
list1 = g_list_next(list1);
|
list1 = g_list_next(list1);
|
||||||
list2 = g_list_next(list2);
|
list2 = g_list_next(list2);
|
||||||
|
|
||||||
|
/* When both files are marked deleted, skip
|
||||||
|
* subtraction. Preserving the deleted entries in both
|
||||||
|
* manifests is required for 'swupd update' to know
|
||||||
|
* when to delete the file, because the m2 bundle may
|
||||||
|
* be installed with or without the m1 bundle.
|
||||||
|
*/
|
||||||
|
if (file1->is_deleted && file2->is_deleted) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (file1->is_deleted == file2->is_deleted && file1->is_file == file2->is_file) {
|
if (file1->is_deleted == file2->is_deleted && file1->is_file == file2->is_file) {
|
||||||
m1->files = g_list_delete_link(m1->files, todel);
|
m1->files = g_list_delete_link(m1->files, todel);
|
||||||
m1->count--;
|
m1->count--;
|
||||||
|
|||||||
Executable
+56
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
# common functions
|
||||||
|
load "../swupdlib"
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
clean_test_dir
|
||||||
|
init_test_dir
|
||||||
|
|
||||||
|
init_server_ini
|
||||||
|
set_latest_ver 0
|
||||||
|
init_groups_ini os-core test-bundle
|
||||||
|
|
||||||
|
# start with both bundles containing a file "foo"
|
||||||
|
set_os_release 10 os-core
|
||||||
|
track_bundle 10 os-core
|
||||||
|
track_bundle 10 test-bundle
|
||||||
|
gen_file_plain 10 os-core foo
|
||||||
|
gen_file_plain 10 test-bundle foo
|
||||||
|
|
||||||
|
# delete "foo" from os-core (the included bundle)
|
||||||
|
set_os_release 20 os-core
|
||||||
|
track_bundle 20 os-core
|
||||||
|
track_bundle 20 test-bundle
|
||||||
|
gen_file_plain 20 test-bundle foo
|
||||||
|
|
||||||
|
# delete "foo" from test-bundle
|
||||||
|
set_os_release 30 os-core
|
||||||
|
track_bundle 30 os-core
|
||||||
|
track_bundle 30 test-bundle
|
||||||
|
|
||||||
|
# make modification (add new file) to test-bundle
|
||||||
|
set_os_release 40 os-core
|
||||||
|
track_bundle 40 os-core
|
||||||
|
track_bundle 40 test-bundle
|
||||||
|
gen_file_plain 40 test-bundle foobar
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "no subtraction for two deleted files" {
|
||||||
|
sudo $CREATE_UPDATE --osversion 10 --statedir $DIR --format 3
|
||||||
|
set_latest_ver 10
|
||||||
|
sudo $CREATE_UPDATE --osversion 20 --statedir $DIR --format 3
|
||||||
|
set_latest_ver 20
|
||||||
|
sudo $CREATE_UPDATE --osversion 30 --statedir $DIR --format 3
|
||||||
|
set_latest_ver 30
|
||||||
|
sudo $CREATE_UPDATE --osversion 40 --statedir $DIR --format 3
|
||||||
|
set_latest_ver 40
|
||||||
|
|
||||||
|
# If the file is absent in test-bundle, this means it was subtracted. If
|
||||||
|
# present, subtraction was not performed.
|
||||||
|
hash1=$(hash_for 40 test-bundle "/foo")
|
||||||
|
[ -n "$hash1" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# vi: ft=sh ts=8 sw=2 sts=2 et tw=80
|
||||||
Reference in New Issue
Block a user