]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - support/testing/tests/core/test_rootfs_overlay.py
support/testing: standardize defconfig fragments style
[coffee/buildroot.git] / support / testing / tests / core / test_rootfs_overlay.py
1 import os
2 import subprocess
3
4 import infra.basetest
5
6 def compare_file(file1, file2):
7     return subprocess.call(["cmp", file1, file2])
8
9 class TestRootfsOverlay(infra.basetest.BRTest):
10
11     rootfs_overlay_path = infra.filepath("tests/core/rootfs-overlay")
12
13     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
14         infra.basetest.MINIMAL_CONFIG + \
15         """
16         BR2_ROOTFS_OVERLAY="{0}1 {0}2"
17         """.format(rootfs_overlay_path)
18
19     def test_run(self):
20         target_file = os.path.join(self.builddir, "target", "test-file1")
21         overlay_file = "{}1/test-file1".format(self.rootfs_overlay_path)
22         ret = compare_file(overlay_file, target_file)
23         self.assertEqual(ret, 0)
24
25         target_file = os.path.join(self.builddir, "target", "etc", "test-file2")
26         overlay_file = "{}2/etc/test-file2".format(self.rootfs_overlay_path)
27         ret = compare_file(overlay_file, target_file)
28         self.assertEqual(ret, 0)