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"
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"
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"
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
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()