diff options
author | Ross Burton <ross@burtonini.com> | 2022-03-31 19:29:15 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-04-01 23:11:38 +0100 |
commit | 9bcf56e6e7db6c85af974e0af01b2c169dbf5b04 (patch) | |
tree | 2268cc266c034bef3e363219f4c41630f18aa686 /meta/lib/oeqa/selftest | |
parent | c4436040eb27afbbf602679e66c23a973279e3a7 (diff) | |
download | poky-9bcf56e6e7db6c85af974e0af01b2c169dbf5b04.tar.gz |
oeqa/selftest: generalise test_devtool_virtual_kernel_modify
Generalise this test so that it works on more than qemux86-64:
- Don't edit a file in arch/x86 to cause a rebuild, instead use init/
- Look for the edits in the build tree, as the deployed kernel could be
of any type (zImage/bzImage/etc) and edits may be in the compressed
part.
Also remove redundant checks on the result of runCmd(), as this will
raise AssertionError exceptions itself so the explicit asserts will
never trigger.
(From OE-Core rev: f1d2b2ec51f748a28d1bca6615558d553876e5c3)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.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/devtool.py | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index ba5dca0359..3eea2b1a0e 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -1875,8 +1875,9 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
1875 | Expected: devtool modify is able to checkout the source of the kernel | 1875 | Expected: devtool modify is able to checkout the source of the kernel |
1876 | and modification to the source and configurations are reflected | 1876 | and modification to the source and configurations are reflected |
1877 | when building the kernel. | 1877 | when building the kernel. |
1878 | """ | 1878 | """ |
1879 | kernel_provider = get_bb_var('PREFERRED_PROVIDER_virtual/kernel') | 1879 | kernel_provider = self.td['PREFERRED_PROVIDER_virtual/kernel'] |
1880 | |||
1880 | # Clean up the environment | 1881 | # Clean up the environment |
1881 | bitbake('%s -c clean' % kernel_provider) | 1882 | bitbake('%s -c clean' % kernel_provider) |
1882 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | 1883 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') |
@@ -1903,33 +1904,28 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
1903 | self.assertExists(os.path.join(tempdir, 'Makefile'), 'Extracted source could not be found') | 1904 | self.assertExists(os.path.join(tempdir, 'Makefile'), 'Extracted source could not be found') |
1904 | #Step 4.2 | 1905 | #Step 4.2 |
1905 | configfile = os.path.join(tempdir,'.config') | 1906 | configfile = os.path.join(tempdir,'.config') |
1906 | diff = runCmd('diff %s %s' % (tmpconfig, configfile)) | 1907 | runCmd('diff %s %s' % (tmpconfig, configfile)) |
1907 | self.assertEqual(0,diff.status,'Kernel .config file is not the same using bitbake and devtool') | 1908 | |
1908 | #Step 4.3 | 1909 | #Step 4.3 |
1909 | #NOTE: virtual/kernel is mapped to kernel_provider | 1910 | #NOTE: virtual/kernel is mapped to kernel_provider |
1910 | result = runCmd('devtool build %s' % kernel_provider) | 1911 | runCmd('devtool build %s' % kernel_provider) |
1911 | self.assertEqual(0,result.status,'Cannot build kernel using `devtool build`') | ||
1912 | kernelfile = os.path.join(get_bb_var('KBUILD_OUTPUT', kernel_provider), 'vmlinux') | 1912 | kernelfile = os.path.join(get_bb_var('KBUILD_OUTPUT', kernel_provider), 'vmlinux') |
1913 | self.assertExists(kernelfile, 'Kernel was not build correctly') | 1913 | self.assertExists(kernelfile, 'Kernel was not build correctly') |
1914 | 1914 | ||
1915 | #Modify the kernel source | 1915 | #Modify the kernel source |
1916 | modfile = os.path.join(tempdir,'arch/x86/boot/header.S') | 1916 | modfile = os.path.join(tempdir, 'init/version.c') |
1917 | modstring = "Use a boot loader. Devtool testing." | 1917 | runCmd("sed -i 's/Linux/LiNuX/g' %s" % (modfile)) |
1918 | modapplied = runCmd("sed -i 's/Use a boot loader./%s/' %s" % (modstring, modfile)) | 1918 | |
1919 | self.assertEqual(0,modapplied.status,'Modification to %s on kernel source failed' % modfile) | ||
1920 | #Modify the configuration | 1919 | #Modify the configuration |
1921 | codeconfigfile = os.path.join(tempdir,'.config.new') | 1920 | codeconfigfile = os.path.join(tempdir, '.config.new') |
1922 | modconfopt = "CONFIG_SG_POOL=n" | 1921 | modconfopt = "CONFIG_SG_POOL=n" |
1923 | modconf = runCmd("sed -i 's/CONFIG_SG_POOL=y/%s/' %s" % (modconfopt, codeconfigfile)) | 1922 | runCmd("sed -i 's/CONFIG_SG_POOL=y/%s/' %s" % (modconfopt, codeconfigfile)) |
1924 | self.assertEqual(0,modconf.status,'Modification to %s failed' % codeconfigfile) | 1923 | |
1925 | #Build again kernel with devtool | 1924 | #Build again kernel with devtool |
1926 | rebuild = runCmd('devtool build %s' % kernel_provider) | 1925 | runCmd('devtool build %s' % kernel_provider) |
1927 | self.assertEqual(0,rebuild.status,'Fail to build kernel after modification of source and config') | 1926 | |
1928 | #Step 4.4 | 1927 | #Step 4.4 |
1929 | bzimagename = 'bzImage-' + get_bb_var('KERNEL_VERSION_NAME', kernel_provider) | 1928 | runCmd("grep '%s' %s" % ('LiNuX', kernelfile)) |
1930 | bzimagefile = os.path.join(get_bb_var('D', kernel_provider),'boot', bzimagename) | 1929 | |
1931 | checkmodcode = runCmd("grep '%s' %s" % (modstring, bzimagefile)) | ||
1932 | self.assertEqual(0,checkmodcode.status,'Modification on kernel source failed') | ||
1933 | #Step 4.5 | 1930 | #Step 4.5 |
1934 | checkmodconfg = runCmd("grep %s %s" % (modconfopt, codeconfigfile)) | 1931 | runCmd("grep %s %s" % (modconfopt, codeconfigfile)) |
1935 | self.assertEqual(0,checkmodconfg.status,'Modification to configuration file failed') | ||