Browse Source

CI: ignore a non-fatal error in the loadable ELF file example

Roland Dobai 6 years ago
parent
commit
686abe6a2f
1 changed files with 17 additions and 6 deletions
  1. 17 6
      examples/get-started/hello_world/loadable_elf_example_test.py

+ 17 - 6
examples/get-started/hello_world/loadable_elf_example_test.py

@@ -34,14 +34,25 @@ class CustomProcess(object):
 
 
 class OCDProcess(CustomProcess):
 class OCDProcess(CustomProcess):
     def __init__(self, proj_path):
     def __init__(self, proj_path):
-        cmd = 'openocd -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp-wroom-32.cfg'
+        cmd = 'openocd -f board/esp32-wrover-kit-3.3v.cfg'
         log_file = os.path.join(proj_path, 'openocd.log')
         log_file = os.path.join(proj_path, 'openocd.log')
         super(OCDProcess, self).__init__(cmd, log_file)
         super(OCDProcess, self).__init__(cmd, log_file)
-        i = self.p.expect_exact(['Info : Listening on port 3333 for gdb connections', 'Error:'])
-        if i == 0:
-            Utility.console_log('openocd is listening for gdb connections')
-        else:
-            raise RuntimeError('openocd initialization has failed')
+        patterns = ['Info : Listening on port 3333 for gdb connections',
+                    'Error: type \'esp32\' is missing virt2phys']
+
+        try:
+            while True:
+                i = self.p.expect_exact(patterns, timeout=30)
+                # TIMEOUT or EOF exceptions will be thrown upon other errors
+                if i == 0:
+                    Utility.console_log('openocd is listening for gdb connections')
+                    break  # success
+                elif i == 1:
+                    Utility.console_log('Ignoring error: "{}"'.format(patterns[i]))
+                    # this error message is ignored because it is not a fatal error
+        except Exception:
+            Utility.console_log('openocd initialization has failed', 'R')
+            raise
 
 
     def close(self):
     def close(self):
         try:
         try: