public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Edwin Plauchu <edwin.plauchu.camacho@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: Edwin Plauchu <edwin.plauchu.camacho@intel.com>
Subject: [PATCH] oeqa: Remove linux user utilized for rpm test.
Date: Wed,  7 Sep 2016 20:26:45 -0500	[thread overview]
Message-ID: <20160908012645.25324-1-edwin.plauchu.camacho@linux.intel.com> (raw)

From: Edwin Plauchu <edwin.plauchu.camacho@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@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



             reply	other threads:[~2016-09-08  1:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08  1:26 Edwin Plauchu [this message]
2016-09-08 10:38 ` [PATCH] oeqa: Remove linux user utilized for rpm test Burton, Ross
2016-09-08 11:01 ` Burton, Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160908012645.25324-1-edwin.plauchu.camacho@linux.intel.com \
    --to=edwin.plauchu.camacho@linux.intel.com \
    --cc=edwin.plauchu.camacho@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox