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_IMAGE_SCRIPT="{}"
15 BR2_ROOTFS_POST_SCRIPT_ARGS="foobar baz"
16 """.format(infra.filepath("tests/core/post-build.sh"),
17 infra.filepath("tests/core/post-image.sh"))
19 def check_post_log_file(self, path, what):
21 with open(path, 'rb') as csvfile:
22 r = csv.reader(csvfile, delimiter=',')
24 lines[row[0]] = row[1]
26 self.assertEqual(lines["arg1"], os.path.join(self.builddir, what))
27 self.assertEqual(lines["arg2"], "foobar")
28 self.assertEqual(lines["arg3"], "baz")
29 self.assertEqual(lines["TARGET_DIR"], os.path.join(self.builddir, "target"))
30 self.assertEqual(lines["BUILD_DIR"], os.path.join(self.builddir, "build"))
31 self.assertEqual(lines["HOST_DIR"], os.path.join(self.builddir, "host"))
32 staging = os.readlink(os.path.join(self.builddir, "staging"))
33 self.assertEqual(lines["STAGING_DIR"], staging)
34 self.assertEqual(lines["BINARIES_DIR"], os.path.join(self.builddir, "images"))
35 self.assertEqual(lines["BR2_CONFIG"], os.path.join(self.builddir, ".config"))
38 f = os.path.join(self.builddir, "build", "post-build.log")
39 self.check_post_log_file(f, "target")
40 f = os.path.join(self.builddir, "build", "post-image.log")
41 self.check_post_log_file(f, "images")