[OE-core] [PATCH] oeqa: Remove linux user utilized for rpm test.

Edwin Plauchu edwin.plauchu.camacho at linux.intel.com
Thu Sep 8 01:26:45 UTC 2016


From: Edwin Plauchu <edwin.plauchu.camacho at intel.com>

When trying to re-test smart rpm tests. A fail arises
due to a linux user previously created upon the image.
W've added a few lines to delete such user and his home dir
when finishing test.

[YOCTO #9204]

Signed-off-by: Edwin Plauchu <edwin.plauchu.camacho at intel.com>
---
 meta/lib/oeqa/runtime/rpm.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/rpm.py b/meta/lib/oeqa/runtime/rpm.py
index 4d03ecb..285f39b 100644
--- a/meta/lib/oeqa/runtime/rpm.py
+++ b/meta/lib/oeqa/runtime/rpm.py
@@ -51,12 +51,15 @@ class RpmInstallRemoveTest(oeRuntimeTest):
     @testcase(1096)
     @skipUnlessPassed('test_ssh')
     def test_rpm_query_nonroot(self):
-        (status, output) = self.target.run('useradd test1')
+        test_user = 'test1'
+        (status, output) = self.target.run("useradd %s" % test_user)
         self.assertTrue(status == 0, msg="Failed to create new user: " + output)
-        (status, output) = self.target.run('su -c id test1')
+        (status, output) = self.target.run("su -c id %s" % test_user)
         self.assertTrue('(test1)' in output, msg="Failed to execute as new user")
-        (status, output) = self.target.run('su -c "rpm -qa" test1 ')
+        (status, output) = self.target.run("su -c \"rpm -qa\" %s " % test_user)
         self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa: %s" % (status, output))
+        (status, output) = self.target.run("userdel -r %s" % test_user)
+        self.assertTrue(status == 0, msg="Failed to erase user: %s" % output)
 
     @testcase(195)
     @skipUnlessPassed('test_rpm_install')
-- 
2.9.3




More information about the Openembedded-core mailing list