def iotjs_build_info(self): ''' Get buildinfo from iotjs. ''' if self.device in ['rpi2', 'artik530']: iotjs = '%s/iotjs' % self.workdir buildinfo = '%s/tests/tools/iotjs_build_info.js' % self.workdir command = '%s %s' % (iotjs, buildinfo) elif self.device in ['artik053', 'stm32f4dis']: buildinfo = '/test/tools/iotjs_build_info.js' command = 'iotjs %s' % buildinfo # Wait a moment to boot the device. time.sleep(2) self.login() output = self.channel.exec_command(command) # Process the output to get the json string and the exitcode. build_info, _, exitcode = testrunner_utils.process_output(output) if exitcode != 0: console.fail('%s returned with exitcode %d' % (buildinfo, exitcode)) info = json.loads(build_info) builtins = set(info['builtins']) features = set(info['features']) stability = info['stability'] self.logout() return builtins, features, stability
def execute(self, testset, test): ''' Execute the given test. ''' self.reset() self.login() command = self._prepare_command(testset, test) # Run the test on the device. self.channel.putc(command[self.app]) self.channel.readline() if self.env.options.coverage: # Start the client script on a different thread for coverage. client_thread = Thread(target=testrunner_utils.run_coverage_script, kwargs={'env': self.env}) client_thread.daemon = True client_thread.start() message, output = self.channel.read_until('arm_dataabort', 'TASH>>') if message == 'arm_dataabort': output += self.channel.readline().replace('\r\n', '') stdout, memstat, exitcode = testrunner_utils.process_output(output) self.logout() return { 'output': stdout.rstrip('\r\n').replace('\r\n', '<br>'), 'memstat': memstat, 'exitcode': exitcode }
def execute(self, testset, test): ''' Execute the given test. ''' self.reset() self.login() # Absolute path to the test file on the device. testfile = '/test/%s/%s' % (testset, test['name']) args = [] if not self.env['info']['no_memstat']: args = ['--mem-stats'] command = { 'iotjs': 'iotjs %s %s' % (' '.join(args), testfile), 'jerryscript': 'jerry %s %s' % (testfile, ' '.join(args)) } # Run the test on the device. output = self.channel.exec_command(command[self.app]) stdout, memstat, _ = testrunner_utils.process_output(output) # Process the exitcode of the last command. exitcode = self.channel.exec_command('echo $?') self.logout() return { 'output': stdout.rstrip('\n').replace('\n', '<br>'), 'memstat': memstat, 'exitcode': exitcode }
def execute(self, testset, test): ''' Execute the given test. ''' self.reset() self.login() # Absolute path to the test file on the device. testfile = '/test/%s/%s' % (testset, test['name']) args = [] if not self.env['info']['no_memstat']: args = ['--mem-stats'] if self.env['info']['coverage']: args.append('--start-debug-server') port = testrunner_utils.read_port_from_url(self.env['info']['coverage']) args.append('--debug-port %s' % port) command = { 'iotjs': 'iotjs %s %s\n' % (' '.join(args), testfile), 'jerryscript': 'jerry %s %s\n' % (testfile, ' '.join(args)) } # Run the test on the device. self.channel.putc(command[self.app]) self.channel.readline() if self.env['info']['coverage'] and self.app == 'iotjs': # Start the client script on a different thread for coverage. client_thread = Thread(target=testrunner_utils.run_coverage_script, kwargs={'env': self.env}) client_thread.daemon = True client_thread.start() message, output = self.channel.read_until('arm_dataabort', 'TASH>>') if message == 'arm_dataabort': output += self.channel.readline().replace('\r\n', '') stdout, memstat, exitcode = testrunner_utils.process_output(output) self.logout() return { 'output': stdout.rstrip('\r\n').replace('\r\n', '<br>'), 'memstat': memstat, 'exitcode': exitcode }
def execute(self, testset, test): ''' Execute the given test. ''' self.reset() self.login() command = self._prepare_command(testset, test) # Run the test on the device. output = self.channel.exec_command(command[self.app]) stdout, memstat, _ = testrunner_utils.process_output(output) # Process the exitcode of the last command. exitcode = self.channel.exec_command('echo $?') self.logout() return { 'output': stdout.rstrip('\n').replace('\n', '<br>'), 'memstat': memstat, 'exitcode': exitcode }
def iotjs_build_info(self): ''' Get buildinfo from iotjs. ''' if not utils.exist_files(self.env.modules.app.paths.tests, ['testsets.json']): return set(), set(), 'stable' if self.device in ['rpi2', 'rpi3']: tester_py = 'python %s/tester.py ' % self.workdir iotjs = '%s/iotjs' % self.workdir buildinfo = '%s/tests/tools/iotjs_build_info.js' % self.workdir template = '%s --cwd %s --cmd %s --testfile %s --iotjs-build-info' command = template % (tester_py, self.workdir, iotjs, buildinfo) elif self.device in ['artik053', 'stm32f4dis']: buildinfo = '/test/tools/iotjs_build_info.js' command = 'iotjs %s' % buildinfo # Wait a moment to boot the device. time.sleep(2) self.login() output = self.channel.exec_command(command) # Process the output to get the json string and the exitcode. build_info, _, exitcode = testrunner_utils.process_output(output) if exitcode != 0: console.fail('%s returned with exitcode %d' % (buildinfo, exitcode)) info = json.loads(build_info) builtins = set(info['builtins']) features = set(info['features']) stability = info['stability'] return builtins, features, stability