summaryrefslogtreecommitdiffstats
path: root/support/testing
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2018-03-31 11:05:59 +0200
committerPeter Korsgaard <peter@korsgaard.com>2018-03-31 20:53:06 +0200
commitbb2a57a17a71a53f823e2609ba08fa8c6bebe24a (patch)
tree20f436fbdf2f501c20c3bf262f2b2ed7f6a9af3b /support/testing
parent118534fe54b48532024b7883a46988b4e08671bc (diff)
downloadbuildroot-bb2a57a17a71a53f823e2609ba08fa8c6bebe24a.tar.gz
buildroot-bb2a57a17a71a53f823e2609ba08fa8c6bebe24a.zip
fs: run packages' filesystem hooks in a copy of target/
Currently, some packages may register hooks to be run just before and just after the generic tarball image is generated, because they need to prepare the filesystem for read-only or read-write operation. However, this means that, if any of the hooks or the image generation fails, the target directory is left in a dangling, inconsistent state. We fix that by doing a copy of target/, run the hooks on that copy, generate the generic tarball image out of that, and get rid of the copy. This way, we can guarantee consistency of the target directory, and we can even ditch support for post-fs hooks (those that restore target/). Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'support/testing')
-rw-r--r--support/testing/tests/core/test_post_scripts.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/support/testing/tests/core/test_post_scripts.py b/support/testing/tests/core/test_post_scripts.py
index edb339d8c4..a0e5b6b454 100644
--- a/support/testing/tests/core/test_post_scripts.py
+++ b/support/testing/tests/core/test_post_scripts.py
@@ -18,17 +18,17 @@ class TestPostScripts(infra.basetest.BRTest):
infra.filepath("tests/core/post-fakeroot.sh"),
infra.filepath("tests/core/post-image.sh"))
- def check_post_log_file(self, path, what):
+ def check_post_log_file(self, f, what, target_dir):
lines = {}
- with open(path, 'rb') as csvfile:
+ with open(os.path.join(self.builddir, "build", f), 'rb') as csvfile:
r = csv.reader(csvfile, delimiter=',')
for row in r:
lines[row[0]] = row[1]
- self.assertEqual(lines["arg1"], os.path.join(self.builddir, what))
+ self.assertEqual(lines["arg1"], what)
self.assertEqual(lines["arg2"], "foobar")
self.assertEqual(lines["arg3"], "baz")
- self.assertEqual(lines["TARGET_DIR"], os.path.join(self.builddir, "target"))
+ self.assertEqual(lines["TARGET_DIR"], target_dir)
self.assertEqual(lines["BUILD_DIR"], os.path.join(self.builddir, "build"))
self.assertEqual(lines["HOST_DIR"], os.path.join(self.builddir, "host"))
staging = os.readlink(os.path.join(self.builddir, "staging"))
@@ -37,9 +37,12 @@ class TestPostScripts(infra.basetest.BRTest):
self.assertEqual(lines["BR2_CONFIG"], os.path.join(self.builddir, ".config"))
def test_run(self):
- f = os.path.join(self.builddir, "build", "post-build.log")
- self.check_post_log_file(f, "target")
- f = os.path.join(self.builddir, "build", "post-fakeroot.log")
- self.check_post_log_file(f, "target")
- f = os.path.join(self.builddir, "build", "post-image.log")
- self.check_post_log_file(f, "images")
+ self.check_post_log_file("post-build.log",
+ os.path.join(self.builddir, "target"),
+ os.path.join(self.builddir, "target"))
+ self.check_post_log_file("post-fakeroot.log",
+ os.path.join(self.builddir, "build/buildroot-fs/target"),
+ os.path.join(self.builddir, "build/buildroot-fs/target"))
+ self.check_post_log_file("post-image.log",
+ os.path.join(self.builddir, "images"),
+ os.path.join(self.builddir, "target"))
OpenPOWER on IntegriCloud