1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6from oeqa.runtime.case import OERuntimeTestCase
7from oeqa.core.decorator.depends import OETestDepends
8
9import time
10
11class RunLevel_Test(OERuntimeTestCase):
12
13    @OETestDepends(['ssh.SSHTest.test_ssh'])
14    def test_runlevel_3(self):
15        (status, output) = self.target.run("init 3 && sleep 5 && runlevel")
16        runlevel= '5 3'
17        self.assertEqual(output, runlevel, msg='Failed to set current runlevel to runlevel 3, current runlevel : %s' % output[-1])
18        (status, output) = self.target.run("uname -a")
19        self.assertEqual(status, 0, msg='Failed to run uname command, output: %s' % output)
20
21    @OETestDepends(['runlevel.RunLevel_Test.test_runlevel_3'])
22    def test_runlevel_5(self):
23        (status, output) = self.target.run("init 5 && sleep 5 && runlevel")
24        runlevel = '3 5'
25        self.assertEqual(output, runlevel, msg='Failed to set current runlevel to runlevel 5, current runlevel : %s' % output[-1])
26        (status, output) = self.target.run('export DISPLAY=:0 && x11perf -aa10text')
27        self.assertEqual(status, 0, msg='Failed to run 2D graphic test, output: %s' % output)
28