Skip to contentSkip to conversation

oeqa/pam: Fix tests to work with busybox

PATCH In review Khem Raj 2 participants 3 messages Feb 25, 2021 – Feb 26, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 oeqa/pam: Fix tests to work with busybox

Distros may not use shadow for login manager
secondly login --help return 0 not 1 so adjust the check accordingly

---
 meta/lib/oeqa/runtime/cases/pam.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/lib/oeqa/runtime/cases/pam.py +6 -6
index 271a1943e3..a61b5a881e 100644
@@ -17,7 +17,7 @@ class PamBasicTest(OERuntimeTestCase):
         status, output = self.target.run('login --help')
         msg = ('login command does not work as expected. '
                'Status and output:%s and %s' % (status, output))
-        self.assertEqual(status, 1, msg = msg)
+        self.assertEqual(status, 0, msg = msg)
 
         status, output = self.target.run('passwd --help')
         msg = ('passwd command does not work as expected. '
@@ -28,8 +28,8 @@ class PamBasicTest(OERuntimeTestCase):
         msg = ('su command does not work as expected. '
                'Status and output:%s and %s' % (status, output))
         self.assertEqual(status, 0, msg = msg)
-
-        status, output = self.target.run('useradd --help')
-        msg = ('useradd command does not work as expected. '
-               'Status and output:%s and %s' % (status, output))
-        self.assertEqual(status, 0, msg = msg)
+        if self.tc.td.get('VIRTUAL-RUNTIME_login_manager') == 'shadow-base':
+            status, output = self.target.run('useradd --help')
+            msg = ('useradd command does not work as expected. '
+                   'Status and output:%s and %s' % (status, output))
+            self.assertEqual(status, 0, msg = msg)
Signature · 1 line
2.30.1
#1 lore raw
Quoted 16 lines · Khem Raj

Distros may not use shadow for login manager
secondly login --help return 0 not 1 so adjust the check accordingly

---
 meta/lib/oeqa/runtime/cases/pam.py | 12 ++++++------

 1 file changed, 6 insertions(+), 6 deletions(-)
meta/lib/oeqa/runtime/cases/pam.py +0 -0
index 271a1943e3..a61b5a881e 100644
@@ -17,7 +17,7 @@ class PamBasicTest(OERuntimeTestCase):
          status, output = self.target.run('login --help')

         msg = ('login command does not work as expected. ' 'Status and output:%s and %s' % (status, output))

meta/lib/oeqa/runtime/cases/pam.py class PamBasicTest(OERuntimeTestCase): · line 20

Quoted 2 lines
meta/lib/oeqa/runtime/cases/pam.py +1 -1
-        self.assertEqual(status, 1, msg = msg)
+        self.assertEqual(status, 0, msg = msg)

Surely just changing the exit status to the opposite will cause the autobuilder to fail this instead?

Cheers,

Richard

author
#2 lore raw

yeah I realized that it should be rather skipped when shadow and shadow-base is missing in image
sent a v2

Quoted 28 lines · Richard Purdie
Quoted 13 lines · Khem Raj

Distros may not use shadow for login manager
secondly login --help return 0 not 1 so adjust the check accordingly

---
 meta/lib/oeqa/runtime/cases/pam.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/lib/oeqa/runtime/cases/pam.py +0 -0
index 271a1943e3..a61b5a881e 100644

meta/lib/oeqa/runtime/cases/pam.py class PamBasicTest(OERuntimeTestCase): · line 20

Quoted 5 lines
meta/lib/oeqa/runtime/cases/pam.py +1 -1
@@ -17,7 +17,7 @@ class PamBasicTest(OERuntimeTestCase):
         status, output = self.target.run('login --help')
         msg = ('login command does not work as expected. '
                'Status and output:%s and %s' % (status, output))
-        self.assertEqual(status, 1, msg = msg)
+        self.assertEqual(status, 0, msg = msg)

Surely just changing the exit status to the opposite will cause the autobuilder to fail this instead?

Cheers,

Richard