[ostree] deploy: Some minor assertion and error message improvements
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] deploy: Some minor assertion and error message improvements
- Date: Fri, 20 Sep 2013 15:29:38 +0000 (UTC)
commit d1bc9e2acf84416e0beed26ff36359ed73c47c81
Author: Colin Walters <walters verbum org>
Date: Thu Sep 19 22:09:48 2013 -0400
deploy: Some minor assertion and error message improvements
To help debug https://bugzilla.gnome.org/show_bug.cgi?id=708351
Plus run a status consistently in the tests.
src/libostree/ostree-sysroot-deploy.c | 7 ++++++-
tests/test-admin-deploy-1.sh | 14 +++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index cc8f542..34dbaf6 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -1018,6 +1018,8 @@ ostree_sysroot_write_deployments (OstreeSysroot *self,
gboolean requires_new_bootversion = FALSE;
gs_unref_object OstreeBootloader *bootloader = _ostree_sysroot_query_bootloader (self);
+ g_assert (self->loaded);
+
/* Determine whether or not we need to touch the bootloader
* configuration. If we have an equal number of deployments and
* more strongly an equal number of deployments per bootcsum, then
@@ -1116,7 +1118,10 @@ ostree_sysroot_write_deployments (OstreeSysroot *self,
/* Now reload from disk */
if (!ostree_sysroot_load (self, cancellable, error))
- goto out;
+ {
+ g_prefix_error (error, "Reloading deployments after commit: ");
+ goto out;
+ }
ret = TRUE;
out:
diff --git a/tests/test-admin-deploy-1.sh b/tests/test-admin-deploy-1.sh
index 62580a4..78d6ce7 100755
--- a/tests/test-admin-deploy-1.sh
+++ b/tests/test-admin-deploy-1.sh
@@ -34,6 +34,7 @@ rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runt
export rev
# This initial deployment gets kicked off with some kernel arguments
ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=testos
testos:testos/buildmaster/x86_64-runtime
+ostree admin --sysroot=sysroot status
echo "ok deploy command"
@@ -46,6 +47,7 @@ assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
echo "ok layout"
@@ -61,7 +63,6 @@ assert_not_has_dir sysroot/ostree/boot.1.1
assert_file_has_content sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf 'options.* root=LABEL=MOO'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS'
-
ostree admin --sysroot=sysroot status
echo "ok second deploy"
@@ -73,6 +74,7 @@ assert_not_has_dir sysroot/boot/loader.1
# But swap subbootversion
assert_has_dir sysroot/ostree/boot.0.0
assert_not_has_dir sysroot/ostree/boot.0.1
+ostree admin --sysroot=sysroot status
echo "ok third deploy (swap)"
@@ -83,6 +85,7 @@ assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
assert_has_file sysroot/boot/loader/entries/ostree-otheros-${rev}-0.conf
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
echo "ok independent deploy"
@@ -93,6 +96,7 @@ assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-0.conf
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS'
assert_has_file sysroot/boot/loader/entries/ostree-testos-${rev}-2.conf
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
echo "ok fourth deploy (retain)"
@@ -106,6 +110,7 @@ assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-rele
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-config-file 'a new local
config file'
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
+ostree admin --sysroot=sysroot status
echo "ok deploy with modified /etc"
@@ -122,11 +127,10 @@ assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-ne
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new
default dir and file"
# And persist /etc changes from before
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
+ostree admin --sysroot=sysroot status
echo "ok upgrade bare"
-ostree admin --sysroot=sysroot status
-
os_repository_new_commit
ostree --repo=sysroot/ostree/repo remote add testos file://$(pwd)/testos-repo
testos/buildmaster/x86_64-runtime
ostree admin --sysroot=sysroot upgrade --os=testos
@@ -135,11 +139,10 @@ rev=${newrev}
newrev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
assert_not_streq ${rev} ${newrev}
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
+ostree admin --sysroot=sysroot status
echo "ok upgrade"
-ostree admin --sysroot=sysroot status
-
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${origrev}.4/etc/os-release 'NAME=TestOS'
ostree admin --sysroot=sysroot undeploy 2
@@ -153,5 +156,6 @@ assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${origrev}.3
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-release 'NAME=TestOS'
ostree admin --sysroot=sysroot undeploy 0
assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${newrev}.0
+ostree admin --sysroot=sysroot status
echo "ok undeploy"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]