[Piuparts-devel] Bug#589498: [PATCH 4/5] add pre_test_ hooks

Andreas Beckmann debian at abeckmann.de
Fri Nov 11 11:22:39 UTC 2011


Add a pre_test_* hook at the beginning of each test that is run
after taking the metadata snapshot.
Cleanup can be performed in post_remove_ or post_purge_.

Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
---
 README.txt  |    7 ++++++-
 piuparts.py |    4 ++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/README.txt b/README.txt
index de9d344..6d00b25 100644
--- a/README.txt
+++ b/README.txt
@@ -171,6 +171,10 @@ PIUPARTS_DISTRIBUTION.
 The following prefixes for scripts are recognized:
 
 'post_setup_' - after the *setup* of the chroot is finished.
+Before metadata of the chroot is recorded for later comparison.
+
+'pre_test_' - at the beginning of each test. After metadata of
+the chroot was recorded for later comparison.
 
 'pre_install_' - before *installing* your package. Depending on
 the test, this may be run multiple times. The PIUPARTS_TEST and
@@ -185,7 +189,8 @@ to distinguish the cases.
 
 'post_remove_' - after *removing* your package.
 
-'post_purge_' - after *purging* your package.
+'post_purge_' - after *purging* your package. Right before
+comparing the chroot with the initially recorded metadata.
 
 'pre_distupgrade_' - before *upgrading* the chroot to the *next
 distribution*. The next distribution is available in the variable
diff --git a/piuparts.py b/piuparts.py
index 8dc1785..820e169 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1684,6 +1684,7 @@ def install_purge_test(chroot, root_info, selections, package_list, packages):
        chroot, with packages in states given by 'selections'."""
 
     os.environ["PIUPARTS_TEST"] = "install"
+    chroot.run_scripts("pre_test")
 
     # Install packages into the chroot.
     os.environ["PIUPARTS_PHASE"] = "install"
@@ -1758,6 +1759,7 @@ def install_upgrade_test(chroot, root_info, selections, package_list, package_na
     Return True if successful, False if not."""
 
     os.environ["PIUPARTS_TEST"] = "upgrade"
+    chroot.run_scripts("pre_test")
 
     # First install via apt-get.
     os.environ["PIUPARTS_PHASE"] = "install"
@@ -1863,6 +1865,8 @@ def install_and_upgrade_between_distros(filenames, packages):
 
     chroot.check_for_no_processes()
 
+    chroot.run_scripts("pre_test")
+
     os.environ["PIUPARTS_PHASE"] = "install"
 
     chroot.run(["apt-get", "update"])
-- 
1.7.7.1






More information about the Piuparts-devel mailing list