Example #1
0
    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
Example #2
0
    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"
Example #3
0
    def testCheckKmod_Usage(self):
        """
        This test case is to check : adb shell kmod usage

        Test Case Precondition:
        None

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

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

        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        cmdstr = "adb shell kmod"
        print cmdstr
        halctl_cmd = os.popen(cmdstr).read()
        print halctl_cmd
        search_result = halctl_cmd.count('Usage')
        assert search_result > 0, "[ERROR]: adb shell kmod  is fail"
        print "[INFO]: adb shell kmod is success"
    def testCheckHalctl_get_module(self):
        """
        This test case is to check : adb shell haclctl halctl --get-module camera

        Test Case Precondition:
        None

        Test Case Step:
        1. Run "halctl --get-module"

        Expect Result:
        1.  HW module ID:     camera
            HW module name:   Intel Camera3HAL Module
            HW module author: Intel


        """

        print "[RunTest]: %s" % self.__str__()
        get_module_name = self.cfg.get("get_module_name")
        camera_g_name = self.cfg.get("camera_g_name")
        res = g_common_obj2.root_on_device()
        print res
        result = autodetect.halctl_cmd('--get-module', get_module_name)
        print result
        res = result.count(camera_g_name)
        assert res > 0, "[ERROR]: adb shell halctl --get-module %s :is fail" % get_module_name
        print "[INFO]: adb shell halctl --get-module %s is pass" % get_module_name
    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
Example #6
0
    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"
    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)
    def testCheck_Platform_Graphics(self):
        """
        This test case is to check : adb shell haclctl -l

        Test Case Precondition:
        None

        Test Case Step:
1    adb root -->adb shell
2    Type halctl -i gralloc



        Expect Result:
1    Connect device and root device successful
2    Bindings list is displayed
        """

        print "[RunTest]: %s" % self.__str__()
        halctl_keyword1='graphic'
        halctl_keyword2='gralloc'
        res = g_common_obj2.root_on_device()
        print res
        cmdstr1="adb shell halctl -i %s"%halctl_keyword1
        cmdstr2="adb shell halctl -i %s"%halctl_keyword2
        halctl_cmd1=os.popen(cmdstr1).read()
        print halctl_cmd1
        time.sleep(2)
        search_result=halctl_cmd1.count('Binding')
        time.sleep(1)
        if search_result == 0:
            halctl_cmd2=os.popen(cmdstr2).read()
            search_result=halctl_cmd2.count('Binding')
        assert search_result>0,"[ERROR]: halctl -i %s  is fail"%halctl_keyword2
        print "[INFO]: halctl -i %s is success"%halctl_keyword2
Example #9
0
    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
    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"
Example #11
0
    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
    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
Example #13
0
    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()
    def testCheck_unsupported_devices(self):
        """
        This test case is to check : adb shell haclctl -i

        Test Case Precondition:
        None

        Test Case Step:
1    adb root -->adb shell
2    Type halctl -i unsupported



        Expect Result:
1    Connect device and root device successful
2    Bindings list is displayed
       """
        print "[RunTest]: %s" % self.__str__()
        halctl_keyword = 'unsupported'
        g_common_obj2.system_reboot()
        res = g_common_obj2.root_on_device()
        print res
        cmdstr = "adb shell halctl -i %s" % halctl_keyword
        print cmdstr
        halctl_cmd = os.popen(cmdstr).read()
        print halctl_cmd
        search_result = halctl_cmd.count('unsupported')
        assert search_result > 0, "[ERROR]: halctl -i %s  is fail" % halctl_keyword
        print "[INFO]: halctl -i %s is success" % halctl_keyword
Example #15
0
    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
Example #16
0
    def testCheckHalctl_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__()
        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"
Example #17
0
    def testCheckKmod_N(self):
        """
        This test case is to check kmod -n

        Test Case Precondition:
        None

        Test Case Step:
1    Connect to the device using adb for root session
2    Type adb shell halctl -l | grep kmod
3    Type kmod -n kmod_model



        Expect Result:
1    Connection is successful. Root session is available.
2    Get kmod information.
3    It will display very verbose information about coretemp module



        """

        print "[RunTest]: %s" % self.__str__()
        res = g_common_obj2.root_on_device()
        print res
        cmdstr = "adb shell halctl -l | grep kmod"
        print cmdstr
        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
        cmdstr = "adb shell kmod -n %s" % kmod_model
        print cmdstr
        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"
    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"