|
@@ -10,11 +10,6 @@ from oeqa.core.utils.path import findFile
|
|
|
|
|
|
class RpmBasicTest(OERuntimeTestCase):
|
|
|
|
|
|
- @classmethod
|
|
|
- def setUpClass(cls):
|
|
|
- if cls.tc.td['PACKAGE_CLASSES'].split()[0] != 'package_rpm':
|
|
|
- cls.skipTest('Tests require image to be build from rpm')
|
|
|
-
|
|
|
@OETestID(960)
|
|
|
@OEHasPackage(['rpm'])
|
|
|
@OETestDepends(['ssh.SSHTest.test_ssh'])
|
|
@@ -26,6 +21,9 @@ class RpmBasicTest(OERuntimeTestCase):
|
|
|
@OETestID(191)
|
|
|
@OETestDepends(['rpm.RpmBasicTest.test_rpm_help'])
|
|
|
def test_rpm_query(self):
|
|
|
+ status, output = self.target.run('ls /var/lib/rpm/')
|
|
|
+ if status != 0:
|
|
|
+ self.skipTest('No /var/lib/rpm on target')
|
|
|
status, output = self.target.run('rpm -q rpm')
|
|
|
msg = 'status and output: %s and %s' % (status, output)
|
|
|
self.assertEqual(status, 0, msg=msg)
|
|
@@ -34,30 +32,25 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
|
|
|
|
|
|
@classmethod
|
|
|
def setUpClass(cls):
|
|
|
- if cls.tc.td['PACKAGE_CLASSES'].split()[0] != 'package_rpm':
|
|
|
- cls.skipTest('Tests require image to be build from rpm')
|
|
|
-
|
|
|
pkgarch = cls.td['TUNE_PKGARCH'].replace('-', '_')
|
|
|
rpmdir = os.path.join(cls.tc.td['DEPLOY_DIR'], 'rpm', pkgarch)
|
|
|
# Pick base-passwd-doc as a test file to get installed, because it's small
|
|
|
# and it will always be built for standard targets
|
|
|
rpm_doc = 'base-passwd-doc-*.%s.rpm' % pkgarch
|
|
|
+ if not os.path.exists(rpmdir):
|
|
|
+ return
|
|
|
for f in fnmatch.filter(os.listdir(rpmdir), rpm_doc):
|
|
|
- test_file = os.path.join(rpmdir, f)
|
|
|
- dst = '/tmp/base-passwd-doc.rpm'
|
|
|
- cls.tc.target.copyTo(test_file, dst)
|
|
|
-
|
|
|
- @classmethod
|
|
|
- def tearDownClass(cls):
|
|
|
- dst = '/tmp/base-passwd-doc.rpm'
|
|
|
- cls.tc.target.run('rm -f %s' % dst)
|
|
|
+ cls.test_file = os.path.join(rpmdir, f)
|
|
|
+ cls.dst = '/tmp/base-passwd-doc.rpm'
|
|
|
|
|
|
@OETestID(192)
|
|
|
- @OETestDepends(['rpm.RpmBasicTest.test_rpm_help'])
|
|
|
+ @OETestDepends(['rpm.RpmBasicTest.test_rpm_query'])
|
|
|
def test_rpm_install(self):
|
|
|
+ self.tc.target.copyTo(self.test_file, self.dst)
|
|
|
status, output = self.target.run('rpm -ivh /tmp/base-passwd-doc.rpm')
|
|
|
msg = 'Failed to install base-passwd-doc package: %s' % output
|
|
|
self.assertEqual(status, 0, msg=msg)
|
|
|
+ self.tc.target.run('rm -f %s' % self.dst)
|
|
|
|
|
|
@OETestID(194)
|
|
|
@OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_install'])
|
|
@@ -118,6 +111,8 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
|
|
|
msg = 'Failed to find database files under /var/lib/rpm/ as __db.xxx'
|
|
|
self.assertEqual(0, status, msg=msg)
|
|
|
|
|
|
+ self.tc.target.copyTo(self.test_file, self.dst)
|
|
|
+
|
|
|
# Remove the package just in case
|
|
|
self.target.run('rpm -e base-passwd-doc')
|
|
|
|
|
@@ -131,6 +126,8 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
|
|
|
msg = 'Failed to remove base-passwd-doc package. Reason: {}'.format(output)
|
|
|
self.assertEqual(0, status, msg=msg)
|
|
|
|
|
|
+ self.tc.target.run('rm -f %s' % self.dst)
|
|
|
+
|
|
|
# if using systemd this should ensure all entries are flushed to /var
|
|
|
status, output = self.target.run("journalctl --sync")
|
|
|
# Get the amount of entries in the log file
|