7 class TestPostScripts(infra.basetest.BRTest):
8 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
11 BR2_SYSTEM_BIN_SH_NONE=y
12 # BR2_PACKAGE_BUSYBOX is not set
13 BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
14 BR2_ROOTFS_POST_FAKEROOT_SCRIPT="{}"
15 BR2_ROOTFS_POST_IMAGE_SCRIPT="{}"
16 BR2_ROOTFS_POST_SCRIPT_ARGS="foobar baz"
17 """.format(infra.filepath("tests/core/post-build.sh"),
18 infra.filepath("tests/core/post-fakeroot.sh"),
19 infra.filepath("tests/core/post-image.sh"))
21 def check_post_log_file(self, path, what):
23 with open(path, 'rb') as csvfile:
24 r = csv.reader(csvfile, delimiter=',')
26 lines[row[0]] = row[1]
28 self.assertEqual(lines["arg1"], os.path.join(self.builddir, what))
29 self.assertEqual(lines["arg2"], "foobar")
30 self.assertEqual(lines["arg3"], "baz")
31 self.assertEqual(lines["TARGET_DIR"], os.path.join(self.builddir, "target"))
32 self.assertEqual(lines["BUILD_DIR"], os.path.join(self.builddir, "build"))
33 self.assertEqual(lines["HOST_DIR"], os.path.join(self.builddir, "host"))
34 staging = os.readlink(os.path.join(self.builddir, "staging"))
35 self.assertEqual(lines["STAGING_DIR"], staging)
36 self.assertEqual(lines["BINARIES_DIR"], os.path.join(self.builddir, "images"))
37 self.assertEqual(lines["BR2_CONFIG"], os.path.join(self.builddir, ".config"))
40 f = os.path.join(self.builddir, "build", "post-build.log")
41 self.check_post_log_file(f, "target")
42 f = os.path.join(self.builddir, "build", "post-fakeroot.log")
43 self.check_post_log_file(f, "target")
44 f = os.path.join(self.builddir, "build", "post-image.log")
45 self.check_post_log_file(f, "images")