def setUp(self):
     super(Check_Halctl_Hald_Recovery, self).setUp()
     cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
         'tests.tablet.system_domains.conf')
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
class Check_Halctl_Hald_Recovery(UIATestBase):
    """
    xxxx
    """
    def setUp(self):
        super(Check_Halctl_Hald_Recovery, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
#         self.cfg = self.config.read(cfg_file, 'system_domain')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Halctl_Hald_Recovery, self).tearDown()
        self.cfg = None

    def testCheck_Halctl_Hald_Recovery(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
        1. Run "adb shell haclctl -l"

        Expect Result:
        1. It shows more than 100 modalias

        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res

        result = self.hal.halctl_cmd("-l", para1=None).count("modalias")
        assert result > 10, "[ERROR]: halctl -list is fail"
        print "[INFO]: halctl -list is success"

        pid_name = 'hald'
        pid = self.hal.get_pid(pid_name)
        print pid
        assert self.hal.kill_pid(
            pid) == None, "[ERROR]: kill %s failed" % pid_name
        print "[INFO]: kill %s success" % pid_name
        assert self.hal.get_pid(
            pid_name), "[ERROR]:  get pid of %s is fail" % pid_name
        print "[INFO]: get pid of %s is success" % pid_name
        time.sleep(5)

        result = self.hal.halctl_cmd("-l", para1=None).count("modalias")
        print result
        assert result > 10, "[ERROR]: halctl -list is fail"
        print "[INFO]: halctl -list is success"
Exemplo n.º 3
0
class CheckHalctl_add(UIATestBase):
    """
    check haclctl -l
    """
    def setUp(self):
        super(CheckHalctl_add, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
        print "[Setup]: %s" % self._test_name
        self.cfg = self.config.read(cfg_file, 'system_domain')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(CheckHalctl_add, self).tearDown()
        self.cfg = None
        self.hal = None

    def testCheckHalctl_add(self):
        """
        This test case is to check : adb shell haclctl -add

        Test Case Precondition:
        NoneSystemImpl

        Test Case Step:
1    adb root
2    adb shell
3    Type halctl --add new_module_alias
4    Type halctl -l press return return and check the




        Expect Result:
1    No error occurs.
2    No new entry was added. refcount was incremented.
3    No error occurs
4    New Sensors module is  listed anymore



        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        modalias2 = 'usbbbbb'
        self.hal.halctl_a(modalias2)
        halctl_i_search = self.hal.halctl_i(modalias2).count('usbbbbb')
        assert halctl_i_search > 0, "[ERROR]: halctl -i %s  is fail" % modalias2
        print "[INFO]: halctl -i %s is success" % modalias2
class Check_stress_halctl_add_del(UIATestBase):
    """
    Stress - halctl --add/--del
    """
    def setUp(self):
        super(Check_stress_halctl_add_del, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        self.cfg = self.config.read(cfg_file, 'system_domain')
        self.hal = AutodetectImpl()
        print "[Setup]: %s" % self._test_name
#         self.cfg = self.config.read(cfg_file, 'system_domain')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_stress_halctl_add_del, self).tearDown()
        self.hal = None
        self.hal = None

    def testCheck_stress_halctl_add_del(self):
        """
        This test case is to check : Stress - halctl --add/--del
        Test Case Precondition:
        NoneSystemImpl

        Test Case Step:
1    Type halctl --add new_entries
2    Halctl -l
3    Type halctl --del new_entries
4    Halctl -l
5    Repeat steps 1 to 4 ten times

        Expect Result:
1    No error occurs.
2    No new entry was added. refcount was incremented.
3    No error occurs
4    New_entries is not listed anymore
5    No error uccurs
        """
        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        #modalias=self.cfg.get("sensors_module_alias")
        modalias2 = 'usbbbbb'
        i = 5
        while i > 0:
            print "loop times: %s" % i
            self.hal.halctl_a(modalias2)
            time.sleep(3)
            self.hal.halctl_s(modalias2)
            i = i - 1
Exemplo n.º 5
0
class Check_Stress_kmod_i_r(UIATestBase):
    """
    Stress - halctl --add/--del
    """
    def setUp(self):
        super(Check_Stress_kmod_i_r, self).setUp()
        self._test_name = __name__
        self.hal = AutodetectImpl()
        print "[Setup]: %s" % self._test_name

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Stress_kmod_i_r, self).tearDown()
        self.hal = None

    def testCheck_Stress_kmod_i_r(self):
        """
        This test case is to check : Stress - kmod -i/-r
        Test Case Precondition:
        NoneSystemImpl

        Test Case Step:
1    Type halctl -l | grep kmod
2    Type kmod -r kmod_name
3    Type kmod -i kmod_name
4    Repeat steps 1 to 4 ten times

        Expect Result:
1    No error occurs
2    Module was unloaded
3    No error occurs
4    Each step has the expected behavior no matter the iteration
        """
        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        cmdstr = "adb shell halctl -l | grep kmod"
        halctl_cmd = os.popen(cmdstr).read().strip()
        print halctl_cmd
        kmod_model = halctl_cmd.replace('\r\n\t', ' ').split()[0].split(':')[1]
        print kmod_model
        i = 5
        while i > 0:
            print "loop times: %s" % i
            self.hal.kmod_r(kmod_model)
            self.hal.kmod_i(kmod_model)
            i = i - 1
Exemplo n.º 6
0
class Check_Halctl_list_SafeMode(UIATestBase):
    """
    check haclctl -l
    """
    def setUp(self):
        super(Check_Halctl_list_SafeMode, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl()
        self.cfg = self.config.read(cfg_file, 'system_domain')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Halctl_list_SafeMode, self).tearDown()
        self.cfg = None
        self.hal = None

    def testCheck_Halctl_list_SafeMode(self):
        """
                Test Case Step:
1    Boot  in safemode.
2    Have adb root session
3    Type halctl -l
4    Type halctl -li type=gralloc


        Expect Result:
1    Device boots successfully
2    successfully
3    Show binding list correctly
4    Gralloc entry is listed. Mount source is llvmpipe.

        """

        print "[RunTest]: %s" % self.__str__()
        self.hal.wake_up()
        self.hal.boot_safemode()
        time.sleep(10)
        res = g_common_obj2.root_on_device()
        print res
        result = self.hal.halctl_cmd("-l", para1=None).count("modalias")
        assert result > 10, "[ERROR]: halctl -list is fail"
        print "[INFO]: halctl -list is success"
        g_common_obj2.system_reboot(200)
class Check_Halctl_libhal_log_set_level(UIATestBase):
    """
#     check haclctl -l
    """

    def setUp(self):
        super(Check_Halctl_libhal_log_set_level, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Halctl_libhal_log_set_level, self).tearDown()
        self.cfg = None
        self.hal=None

    def testCheck_Halctl_libhal_log_set_level(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
        1. reboot devices
        2. Root
        3. check dmesg without hal errors

        Expect Result:
        1. dmesg without hal errors

        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        result=self.hal.halctl_cmd('-e', '7')
        print 'result is ',result
        assert result>0, "[ERROR]: halctl -e 7 is fail"
        print "[INFO]: halctl -e 7 is success"
        result1=self.hal.search_in_dmesg('hal').count('log level set to 7')
        print result1
        assert result1>0, "[ERROR]: log level set to 7 is fail"
        print "[INFO]: log level set to 7 is success"
Exemplo n.º 8
0
class Check_halctl_hald_not_root(UIATestBase):
    """
    xxxx
    """
    def setUp(self):
        super(Check_halctl_hald_not_root, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
#         self.cfg = self.config.read(cfg_file, 'system_domain')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_halctl_hald_not_root, self).tearDown()
        self.cfg = None

    def testCheck_halctl_hald_not_root(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
        1	Connect to device using adb. Root session
		2	Type ps and grep for hald


        Expect Result:
        1	adb root session is established
		2	Process owner is hal, not root.


        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res

        pid_name = 'hald'
        owner = 'hal'
        process_owner = self.hal.get_process_owner(pid_name)
        print 'process owner is %s' % process_owner
        assert process_owner == owner, "[ERROR]: Process owner is not %s" % owner
        print "[INFO]: Process owner is %s" % owner
Exemplo n.º 9
0
class Check_Halctl_FirstBoot(UIATestBase):
    """
    check haclctl -l
    """

    def setUp(self):
        super(Check_Halctl_FirstBoot, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Halctl_FirstBoot, self).tearDown()
        self.cfg = None
        self.hal=None

    def testCheck_Halctl_FirstBoot(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
1    Power on the device with newly installed device.
2    Connect to the device using adb for a root session
3    Issue dmesg command and check its output


        Expect Result:
1    Device boots successfully.
2    Root session available
3    No HAL errors are identified

        """

        print "[RunTest]: %s" % self.__str__()
        g_common_obj2.system_reboot()
        res = g_common_obj2.root_on_device()
        print 'root is :',res
        result=self.hal.search_in_dmesg('hal').count('error')
        print result
        assert result==0, "[ERROR]: halctl boot is fail"
        print "[INFO]: halctl boot is success"
Exemplo n.º 10
0
class Check_Halctl_fallback(UIATestBase):
    """
    check haclctl fallback
    """
    def setUp(self):
        super(Check_Halctl_fallback, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.cfg = self.config.read(cfg_file, 'system_domain')
        self.hal = AutodetectImpl()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Halctl_fallback, self).tearDown()
        self.cfg = None
        self.hal = None

    def testCheck_Halctl_fallback(self):
        """
        This test case is to   Check_Halctl_fallback

        Test Case Precondition:

        Test Case Step:
1    Boot device
2    Check for devices with only fallback entries in the HAL bindings array
3    Type halctl -l and grep tyep=fallback. Inspect the output.


        Expect Result:
1    Device is booted successfully
2    -
3    Fallback entry is used for the devices identified in step 2


        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        result = self.hal.halctl_cmd("-i", "fallback").count("Binding")
        assert result > 0, "[ERROR]: halctl -i fallback is fail"
        print "[INFO]: halctl -i fallback  is success"
Exemplo n.º 11
0
class CheckHalctl_Usage(UIATestBase):
    """
    check haclctl -l
    """

    def setUp(self):
        super(CheckHalctl_Usage, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
#          self.cfg = self.config.read(cfg_file, 'system_domain')

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(CheckHalctl_Usage, self).tearDown()
        self.cfg = None
        self.hal=None

    def testCheckHalctl_Usage(self):
        """
        This test case is to check : adb shell haclctl usage

        Test Case Precondition:
        None

        Test Case Step:
        1. Run "adb shell haclctl  /-h/--help"

        Expect Result:
        1. It shows usage of halctl --help

        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        
        cmdstr=['','-h','--help']
        for i in cmdstr:
            print "parameter is %s"%i
            result=self.hal.halctl_cmd(para=i,para1=None).count("Usage")
            assert result>0, "[ERROR]: adb shell halctl %s is fail"%i
            print "[INFO]: adb shell halctl %s is success"%i
Exemplo n.º 12
0
class CheckHalctl_del(UIATestBase):
    """
    check haclctl -l
    """
    def setUp(self):
        super(CheckHalctl_del, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.cfg = self.config.read(cfg_file, 'system_domain')
        self.cfg = self.config.read(cfg_file, 'sensors_module_alias')
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))
        print "[Setup]: %s" % self._test_name

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(CheckHalctl_del, self).tearDown()
        self.cfg = None

    def testCheckHalctl_del(self):
        """
        This test case is to check : adb shell haclctl --del sensors_module_alias

        Test Case Precondition:
        None

        Test Case Step:
        1. Run "adb shell haclctl -l"

        Expect Result:
        1. It shows more than 100 modalias

        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res

        modalias2 = 'usbbbbb'
        self.hal.halctl_a(modalias2)
        halctl_i_search = self.hal.halctl_i(modalias2).count('usbbbbb')
        assert halctl_i_search > 0, "[ERROR]: halctl -i %s  is fail" % modalias2
        print "[INFO]: halctl -i %s is success" % modalias2
        self.hal.halctl_s(modalias2)
        halctl_i_search = self.hal.halctl_i(modalias2).count('usbbbbb')
        assert halctl_i_search == 0, "[ERROR]: halctl -i %s  is fail" % modalias2
        print "[INFO]: halctl -i %s is success" % modalias2
Exemplo n.º 13
0
class Check_Multi_Kmod_N(UIATestBase):
    """
    check haclctl -l
    """

    def setUp(self):
        super(Check_Multi_Kmod_N, self).setUp()
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl()
    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Multi_Kmod_N, self).tearDown()
        self.hal=None
    def testCheck_Multi_Kmod_N(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
        1. Type adb shell halctl -l | grep kmod
        2. Type kmod -n kmod_model

        Expect Result:
        1    Get kmod information.
        2    It will display very verbose information about coretemp module

        """

        print "[RunTest]: %s" % self.__str__()
        self.hal.wake_up()
        self.hal.add_one_multi_user()
        res = g_common_obj2.root_on_device()
        print res
        cmdstr="adb shell halctl -l | grep kmod"
        halctl_cmd=os.popen(cmdstr).read().strip()
        print halctl_cmd
        kmod_model=halctl_cmd.replace('\r\n\t', ' ').split()[0].split(':')[1]
        cmdstr="adb shell kmod -n %s"%kmod_model
        halctl_cmd=os.popen(cmdstr).read()
        print halctl_cmd
        search_result=halctl_cmd.count('alias')
        assert search_result>0,"[Error]:kmod -n  coretemp  is fail"
        print "[INFO]: kmod -n  coretemp  is success"
        self.hal.switch_to_owner()
Exemplo n.º 14
0
class Check_Multi_Halctl_list(UIATestBase):
    """
    check haclctl -l
    """
    def setUp(self):
        super(Check_Multi_Halctl_list, self).setUp()
        cfg_file = os.path.join(os.environ.get('TEST_DATA_ROOT', ''), \
            'tests.tablet.system_domains.conf')
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        self.hal = AutodetectImpl(self.config.read(cfg_file, 'system_domain'))

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(Check_Multi_Halctl_list, self).tearDown()
        self.cfg = None
        self.hal = None

    def testCheck_Multi_Halctl_list(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
        1. Run "adb shell haclctl -l"

        Expect Result:
        1. It shows more than 100 modalias

        """

        print "[RunTest]: %s" % self.__str__()
        self.hal.wake_up()
        self.hal.add_one_multi_user()
        res = g_common_obj2.root_on_device()
        print res
        result = self.hal.halctl_cmd("-l", para1=None).count("modalias")
        assert result > 10, "[ERROR]: halctl -list is fail"
        print "[INFO]: halctl -list is success"
        self.hal.switch_to_owner()
 def setUp(self):
     super(Check_Platform_Input, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.hal = AutodetectImpl()
 def setUp(self):
     super(Check_Stress_kmod_i_r_overload, self).setUp()
     self._test_name = __name__
     self.hal = AutodetectImpl()
     print "[Setup]: %s" % self._test_name
Exemplo n.º 17
0
 def setUp(self):
     super(CheckKmod_N, self).setUp()
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     self.hal = AutodetectImpl()