1c342db35SBrad Bishop#
2*92b42cb3SPatrick Williams# Copyright OpenEmbedded Contributors
3*92b42cb3SPatrick Williams#
4c342db35SBrad Bishop# SPDX-License-Identifier: MIT
5c342db35SBrad Bishop#
6c342db35SBrad Bishop
7eb8dc403SDave Cobbley# This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=287 testcase
8eb8dc403SDave Cobbley# Note that the image under test must have "pam" in DISTRO_FEATURES
9eb8dc403SDave Cobbley
10eb8dc403SDave Cobbleyfrom oeqa.runtime.case import OERuntimeTestCase
11eb8dc403SDave Cobbleyfrom oeqa.core.decorator.depends import OETestDepends
12eb8dc403SDave Cobbleyfrom oeqa.core.decorator.data import skipIfNotFeature
1390fd73cbSAndrew Geisslerfrom oeqa.runtime.decorator.package import OEHasPackage
14eb8dc403SDave Cobbley
15eb8dc403SDave Cobbleyclass PamBasicTest(OERuntimeTestCase):
16eb8dc403SDave Cobbley
17eb8dc403SDave Cobbley    @skipIfNotFeature('pam', 'Test requires pam to be in DISTRO_FEATURES')
18eb8dc403SDave Cobbley    @OETestDepends(['ssh.SSHTest.test_ssh'])
1990fd73cbSAndrew Geissler    @OEHasPackage(['shadow'])
2090fd73cbSAndrew Geissler    @OEHasPackage(['shadow-base'])
21eb8dc403SDave Cobbley    def test_pam(self):
22eb8dc403SDave Cobbley        status, output = self.target.run('login --help')
23eb8dc403SDave Cobbley        msg = ('login command does not work as expected. '
24eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
25eb8dc403SDave Cobbley        self.assertEqual(status, 1, msg = msg)
26eb8dc403SDave Cobbley
27eb8dc403SDave Cobbley        status, output = self.target.run('passwd --help')
28eb8dc403SDave Cobbley        msg = ('passwd command does not work as expected. '
29eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
30eb8dc403SDave Cobbley        self.assertEqual(status, 0, msg = msg)
31eb8dc403SDave Cobbley
32eb8dc403SDave Cobbley        status, output = self.target.run('su --help')
33eb8dc403SDave Cobbley        msg = ('su command does not work as expected. '
34eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
35eb8dc403SDave Cobbley        self.assertEqual(status, 0, msg = msg)
36eb8dc403SDave Cobbley
37eb8dc403SDave Cobbley        status, output = self.target.run('useradd --help')
38eb8dc403SDave Cobbley        msg = ('useradd command does not work as expected. '
39eb8dc403SDave Cobbley               'Status and output:%s and %s' % (status, output))
40eb8dc403SDave Cobbley        self.assertEqual(status, 0, msg = msg)
41