hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import subprocess
 
import infra.basetest
 
 
def compare_file(file1, file2):
    return subprocess.call(["cmp", file1, file2])
 
 
class TestRootfsOverlay(infra.basetest.BRTest):
 
    rootfs_overlay_path = infra.filepath("tests/core/rootfs-overlay")
 
    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
        infra.basetest.MINIMAL_CONFIG + \
        """
        BR2_ROOTFS_OVERLAY="{0}1 {0}2"
        """.format(rootfs_overlay_path)
 
    def test_run(self):
        target_file = os.path.join(self.builddir, "target", "test-file1")
        overlay_file = "{}1/test-file1".format(self.rootfs_overlay_path)
        ret = compare_file(overlay_file, target_file)
        self.assertEqual(ret, 0)
 
        target_file = os.path.join(self.builddir, "target", "etc", "test-file2")
        overlay_file = "{}2/etc/test-file2".format(self.rootfs_overlay_path)
        ret = compare_file(overlay_file, target_file)
        self.assertEqual(ret, 0)