xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/runtime/cases/skeletoninit.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# SPDX-License-Identifier: MIT
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun# This test should cover https://bugzilla.yoctoproject.org/tr_show_case.cgi?case_id=284
6*4882a593Smuzhiyun# testcase. Image under test must have meta-skeleton layer in bblayers and
7*4882a593Smuzhiyun# IMAGE_INSTALL:append = " service" in local.conf
8*4882a593Smuzhiyunfrom oeqa.runtime.case import OERuntimeTestCase
9*4882a593Smuzhiyunfrom oeqa.core.decorator.depends import OETestDepends
10*4882a593Smuzhiyunfrom oeqa.core.decorator.data import skipIfDataVar
11*4882a593Smuzhiyunfrom oeqa.runtime.decorator.package import OEHasPackage
12*4882a593Smuzhiyun
13*4882a593Smuzhiyunclass SkeletonBasicTest(OERuntimeTestCase):
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun    @OETestDepends(['ssh.SSHTest.test_ssh'])
16*4882a593Smuzhiyun    @OEHasPackage(['service'])
17*4882a593Smuzhiyun    @skipIfDataVar('VIRTUAL-RUNTIME_init_manager', 'systemd',
18*4882a593Smuzhiyun                   'Not appropiate for systemd image')
19*4882a593Smuzhiyun    def test_skeleton_availability(self):
20*4882a593Smuzhiyun        status, output = self.target.run('ls /etc/init.d/skeleton')
21*4882a593Smuzhiyun        msg = 'skeleton init script not found. Output:\n%s' % output
22*4882a593Smuzhiyun        self.assertEqual(status, 0, msg=msg)
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun        status, output =  self.target.run('ls /usr/sbin/skeleton-test')
25*4882a593Smuzhiyun        msg = 'skeleton-test not found. Output:\n%s' % output
26*4882a593Smuzhiyun        self.assertEqual(status, 0, msg=msg)
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    @OETestDepends(['skeletoninit.SkeletonBasicTest.test_skeleton_availability'])
29*4882a593Smuzhiyun    def test_skeleton_script(self):
30*4882a593Smuzhiyun        output1 = self.target.run("/etc/init.d/skeleton start")[1]
31*4882a593Smuzhiyun        cmd = '%s | grep [s]keleton-test' % self.tc.target_cmds['ps']
32*4882a593Smuzhiyun        status, output2 = self.target.run(cmd)
33*4882a593Smuzhiyun        msg = ('Skeleton script could not be started:'
34*4882a593Smuzhiyun               '\n%s\n%s' % (output1, output2))
35*4882a593Smuzhiyun        self.assertEqual(status, 0, msg=msg)
36