( self )
| 99 | self.log.flush() |
| 100 | |
| 101 | def run( self ): |
| 102 | global g_failed |
| 103 | |
| 104 | try: |
| 105 | # Set LD_LIBRARY_PATH |
| 106 | if os.name == 'posix': |
| 107 | LD_LIBRARY_PATH = self.env.get( 'LD_LIBRARY_PATH', '' ) |
| 108 | if LD_LIBRARY_PATH: LD_LIBRARY_PATH += ';' |
| 109 | self.env['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH + "." |
| 110 | self.WriteLn( "LD_LIBRARY_PATH = '%s'" % self.env['LD_LIBRARY_PATH']) |
| 111 | |
| 112 | self.WriteLn( "Executing: " + ' '.join( self.cmdline ) ) |
| 113 | self.process = subprocess.Popen( self.cmdline, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env, **self.popen_kwargs ) |
| 114 | self.process.stdin.close() |
| 115 | while True: |
| 116 | sOutput = self.process.stdout.readline() |
| 117 | if sOutput: |
| 118 | sOutput = str(sOutput, 'utf-8', 'ignore') |
| 119 | self.WriteLn( sOutput.rstrip() ) |
| 120 | # Check if this is the ready message, then set requested event |
| 121 | if self.ready_message and self.ready_event and self.ready_message in sOutput: |
| 122 | self.ready_event.set() |
| 123 | m = re.search( r'TEST ROUTE: addr=\S+ type=(\w+)', sOutput ) |
| 124 | if m: |
| 125 | self.route_type = m.group(1) |
| 126 | m = re.search( r'TEST_ICE_ctr_(\w+)=(\d+)', sOutput ) |
| 127 | if m: |
| 128 | self.counters[m.group(1)] = int( m.group(2) ) |
| 129 | elif self.process.poll() is not None: |
| 130 | break |
| 131 | self.process.wait() |
| 132 | self.WriteLn( "Exitted with %d" % self.process.returncode ) |
| 133 | if self.process.returncode != 0: |
| 134 | g_failed = True |
| 135 | except Exception as ex: |
| 136 | self.WriteLn( "FAILED to execute process: %s" % ex ) |
| 137 | g_failed = True |
| 138 | |
| 139 | # Wait for thread to shutdown. Nuke process if we don't exit in time |
| 140 | def join( self, timeout ): |
no test coverage detected