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

Burton, Ross ross.burton at intel.com
Thu Sep 8 10:38:56 UTC 2016


On 8 September 2016 at 02:26, Edwin Plauchu <
edwin.plauchu.camacho at linux.intel.com> wrote:

>      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)
>

The user removal should be in a try/finally block around the test so that
it always executes even if the test fails.

Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160908/f9ae8538/attachment-0002.html>


More information about the Openembedded-core mailing list