示例#1
0
 def run(self, result, debug=False):
     """ Runs tests
     """
     self._group_tests(self)
     for app_cfg_id in self._groupped_suites:
         # check if suite have at least one test to run
         skip_count = 0
         for test in self._groupped_suites[app_cfg_id][1]:
             if getattr(type(test), '__unittest_skip__', False):
                 skip_count += 1
         if skip_count == self._groupped_suites[app_cfg_id][
                 1].countTestCases():
             get_logger().debug('Skip loading %s for %d tests', app_cfg_id,
                                skip_count)
         else:
             get_logger().debug(
                 'Load %s for %d tests', app_cfg_id,
                 self._groupped_suites[app_cfg_id][1].countTestCases())
             # load only if app bins are configured (used) for these tests
             if self.load_app_bins and self._groupped_suites[app_cfg_id][0]:
                 try:
                     self._load_app(self._groupped_suites[app_cfg_id][0])
                 except:
                     get_logger().critical('Failed to load %s!', app_cfg_id)
                     for test in self._groupped_suites[app_cfg_id][1]:
                         result.addError(test, sys.exc_info())
                     continue
             dbg.get_gdb().exec_file_set(
                 self._groupped_suites[app_cfg_id][0].build_app_elf_path())
         self._groupped_suites[app_cfg_id][1]._run_tests(result, debug)
     return result
示例#2
0
 def _load_app(self, app_cfg):
     """ Loads application binaries to target.
     """
     gdb = dbg.get_gdb()
     state, rsn = gdb.get_target_state()
     if state != dbg.Gdb.TARGET_STATE_STOPPED:
         gdb.exec_interrupt()
         gdb.wait_target_state(dbg.Gdb.TARGET_STATE_STOPPED, 5)
     # write bootloader
     gdb.target_program(app_cfg.build_bld_bin_path(), app_cfg.bld_off)
     # write partition table
     gdb.target_program(app_cfg.build_pt_bin_path(), app_cfg.pt_off)
     # write application
     # Currently we can not use GDB ELF loading facility for ESP32, so write binary image instead
     # _gdb.target_download()
     gdb.target_program(app_cfg.build_app_bin_path(), app_cfg.app_off)
     gdb.target_reset()
 def _load_app(self, app_cfg):
     """ Loads application binaries to target.
     """
     bins_dir = os.path.join(_test_apps_dir, app_cfg.app_name,
                             app_cfg.bin_dir)
     gdb = dbg.get_gdb()
     state, rsn = gdb.get_target_state()
     # print 'DebuggerTestAppTests.LOAD_APP %s / %s' % (cls, app_bins)
     if state != dbg.Gdb.TARGET_STATE_STOPPED:
         gdb.exec_interrupt()
         gdb.wait_target_state(dbg.Gdb.TARGET_STATE_STOPPED, 5)
     # write bootloader
     gdb.target_program(os.path.join(bins_dir, app_cfg.bld_path),
                        app_cfg.bld_off)
     # write partition table
     gdb.target_program(os.path.join(bins_dir, app_cfg.pt_path),
                        app_cfg.pt_off)
     # write application
     gdb.exec_file_set(os.path.join(bins_dir, '%s.elf' % app_cfg.app_name))
     # Currently we can not use GDB ELF loading facility for ESP32, so write binary image instead
     # _gdb.target_download()
     gdb.target_program(os.path.join(bins_dir, '%s.bin' % app_cfg.app_name),
                        app_cfg.app_off)
     gdb.target_reset()
示例#4
0
 def __init__(self, methodName):
     super(DebuggerTestsBase, self).__init__(methodName)
     self.gdb = dbg.get_gdb()
     self.oocd = dbg.get_oocd()
示例#5
0
 def test_creationOfGdbProcLog(self):
     tmp_log_file = tempfile.NamedTemporaryFile(delete=False)
     self.gdb = get_gdb(log_gdb_proc_file=tmp_log_file.name)
     self.assertTrue(os.path.exists(tmp_log_file.name))
示例#6
0
 def test_gdbrun(self):
     with self.assertRaises(ValueError):
         self.gdb = get_gdb(gdb_path="absolutely_not_gdb")
     self.gdb = get_gdb()