summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-07-27 14:04:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-27 23:29:15 +0100
commit86f0232bffb63cbcc3624f052d10675d521494fa (patch)
treecf894bcdba8a4473ace1687020dee385aaf99a0a
parent90a52ffd4458d01d9b465341b9781f6cbc21fb2e (diff)
downloadpoky-86f0232bffb63cbcc3624f052d10675d521494fa.tar.gz
oeqa/selftest/imagefeatures: fix RPM4 test
* Use our new runqemu function * Don't hard-code the RPM4 version * Double-check the native version is RPM4 * Check that an rpm 4.x package is in the image manifest (this isn't strictly necessary, but "belt-and-braces" and it serves as an example of how to do that) * Check that the database is working on the target * Ensure the image actually has openssh in it so we can connect to it Initial runqemu adaptation by Richard Purdie <richard.purdie@linuxfoundation.org> Part of the fix for [YOCTO #7994]. (From OE-Core rev: 80289106423746b7d7fd4c4fd181ffbae93f71d1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/imagefeatures.py75
1 files changed, 44 insertions, 31 deletions
diff --git a/meta/lib/oeqa/selftest/imagefeatures.py b/meta/lib/oeqa/selftest/imagefeatures.py
index 20cc58dc93..a370d1edb1 100644
--- a/meta/lib/oeqa/selftest/imagefeatures.py
+++ b/meta/lib/oeqa/selftest/imagefeatures.py
@@ -78,16 +78,17 @@ class ImageFeatures(oeSelfTest):
78 def test_rpm_version_4_support_on_image(self): 78 def test_rpm_version_4_support_on_image(self):
79 """ 79 """
80 Summary: Check rpm version 4 support on image 80 Summary: Check rpm version 4 support on image
81 Expected: Rpm version must be 4.11.2 81 Expected: Rpm version must be 4.x
82 Product: oe-core 82 Product: oe-core
83 Author: Ionut Chisanovici <ionutx.chisanovici@intel.com> 83 Author: Ionut Chisanovici <ionutx.chisanovici@intel.com>
84 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> 84 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
85 """ 85 """
86 86
87 rpm_version = '4.11.2' 87 features = 'PREFERRED_VERSION_rpm = "4.%"\n'
88 features = 'IMAGE_INSTALL_append = " rpm"\n' 88 features += 'PREFERRED_VERSION_rpm-native = "4.%"\n'
89 features += 'PREFERRED_VERSION_rpm = "{}"\n'.format(rpm_version) 89 # Use openssh in IMAGE_INSTALL instead of ssh-server-openssh in EXTRA_IMAGE_FEATURES as a workaround for bug 8047
90 features += 'PREFERRED_VERSION_rpm-native = "{}"\n'.format(rpm_version) 90 features += 'IMAGE_INSTALL_append = " openssh"\n'
91 features += 'EXTRA_IMAGE_FEATURES = "empty-root-password allow-empty-password package-management"\n'
91 features += 'RPMROOTFSDEPENDS_remove = "rpmresolve-native:do_populate_sysroot"' 92 features += 'RPMROOTFSDEPENDS_remove = "rpmresolve-native:do_populate_sysroot"'
92 93
93 # Append 'features' to local.conf 94 # Append 'features' to local.conf
@@ -96,32 +97,44 @@ class ImageFeatures(oeSelfTest):
96 # Build a core-image-minimal 97 # Build a core-image-minimal
97 bitbake('core-image-minimal') 98 bitbake('core-image-minimal')
98 99
99 # Boot qemu image & get rpm version 100 # Check the native version of rpm is correct
100 proc_qemu = pexpect.spawn('runqemu qemux86 nographic') 101 native_bindir = get_bb_var('STAGING_BINDIR_NATIVE')
101 try: 102 result = runCmd(os.path.join(native_bindir, 'rpm') + ' --version')
102 proc_qemu.expect('qemux86 login:', timeout=100) 103 self.assertIn('version 4.', result.output)
103 proc_qemu.sendline(self.root_user) 104
104 proc_qemu.expect(self.prompt) 105 # Check manifest for the rpm package
105 proc_qemu.sendline('rpm --version') 106 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
106 proc_qemu.expect(self.prompt) 107 imgname = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal')
107 except Exception as e: 108 with open(os.path.join(deploydir, imgname) + '.manifest', 'r') as f:
108 try: 109 for line in f:
109 killpg(proc_qemu.pid, signal.SIGTERM) 110 splitline = line.split()
110 except: 111 if len(splitline) > 2:
111 pass 112 rpm_version = splitline[2]
112 self.fail('Failed to start qemu: %s' % e) 113 if splitline[0] == 'rpm':
113 114 if not rpm_version.startswith('4.'):
114 found_rpm_version = proc_qemu.before 115 self.fail('rpm version %s found in image, expected 4.x' % rpm_version)
115 116 break
116 # Make sure the retrieved rpm version is the expected one 117 else:
117 self.assertIn(rpm_version, found_rpm_version, 118 self.fail('No rpm package found in image')
118 'RPM version is not {}, found instead {}.'.format(rpm_version, found_rpm_version)) 119
119 120 # Now do a couple of runtime tests
120 # Cleanup (close qemu) 121 with runqemu("core-image-minimal", self) as qemu:
121 try: 122 command = "rpm --version"
122 killpg(proc_qemu.pid, signal.SIGTERM) 123 status, output = qemu.run(command)
123 except: 124 self.assertEqual(0, status, 'Failed to run command "%s": %s' % (command, output))
124 pass 125 found_rpm_version = output.strip()
126
127 # Make sure the retrieved rpm version is the expected one
128 if rpm_version not in found_rpm_version:
129 self.fail('RPM version is not {}, found instead {}.'.format(rpm_version, found_rpm_version))
130
131 # Test that the rpm database is there and working
132 command = "rpm -qa"
133 status, output = qemu.run(command)
134 self.assertEqual(0, status, 'Failed to run command "%s": %s' % (command, output))
135 self.assertIn('packagegroup-core-boot', output)
136 self.assertIn('busybox', output)
137
125 138
126 @testcase(1116) 139 @testcase(1116)
127 def test_clutter_image_can_be_built(self): 140 def test_clutter_image_can_be_built(self):