diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-09-05 14:54:41 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-11 17:30:29 +0100 |
commit | f5a679e9b13c693fe0fc1f4747479a79fe6a096a (patch) | |
tree | 39a78dbf5ac484b8e9cd3b00999383769ade4750 /meta/lib/oeqa/selftest | |
parent | d3739ff0e26c45f59c0bc6a408269dc848d632dd (diff) | |
download | poky-f5a679e9b13c693fe0fc1f4747479a79fe6a096a.tar.gz |
wic: selftest: add test_wic_cp_ext test case
Tested if 'wic cp' correctly copies files to the ext4 partition
of the wic image.
(From OE-Core rev: 7970907c72d9533fd63d2c8796bbeb9be86b3fc3)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index eaec37dd14..00d1b64469 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
@@ -1008,3 +1008,33 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r | |||
1008 | self.assertEqual(0, result.status) | 1008 | self.assertEqual(0, result.status) |
1009 | self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset( | 1009 | self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset( |
1010 | set(line.split()[-1] for line in result.output.split('\n') if line))) | 1010 | set(line.split()[-1] for line in result.output.split('\n') if line))) |
1011 | |||
1012 | def test_wic_cp_ext(self): | ||
1013 | """Test copy files and directories to the ext partition.""" | ||
1014 | self.assertEqual(0, runCmd("wic create wictestdisk " | ||
1015 | "--image-name=core-image-minimal " | ||
1016 | "-D -o %s" % self.resultdir).status) | ||
1017 | images = glob(self.resultdir + "wictestdisk-*.direct") | ||
1018 | self.assertEqual(1, len(images)) | ||
1019 | |||
1020 | sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') | ||
1021 | |||
1022 | # list directory content of the ext4 partition | ||
1023 | result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot)) | ||
1024 | self.assertEqual(0, result.status) | ||
1025 | dirs = set(line.split()[-1] for line in result.output.split('\n') if line) | ||
1026 | self.assertTrue(set(['bin', 'home', 'proc', 'usr', 'var', 'dev', 'lib', 'sbin']).issubset(dirs)) | ||
1027 | |||
1028 | with NamedTemporaryFile("w", suffix=".wic-cp") as testfile: | ||
1029 | testfile.write("test") | ||
1030 | |||
1031 | # copy file to the partition | ||
1032 | result = runCmd("wic cp %s %s:2/ -n %s" % (testfile.name, images[0], sysroot)) | ||
1033 | self.assertEqual(0, result.status) | ||
1034 | |||
1035 | # check if file is there | ||
1036 | result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot)) | ||
1037 | self.assertEqual(0, result.status) | ||
1038 | newdirs = set(line.split()[-1] for line in result.output.split('\n') if line) | ||
1039 | self.assertEqual(newdirs.difference(dirs), set([os.path.basename(testfile.name)])) | ||
1040 | |||