def run(self, output): (product, group, test, config, env) = self._test self.result = True self.failures = [] line_num = 0 last_packet_len = 0 for i in range(len(output)): line_num += 1 if not re.match("Received \d+",output[i].strip()): self.record_failure(("Line %d of output does not match expected\n" % line_num)) continue packet_len = int(output[i].split()[1]) if packet_len <= last_packet_len: self.record_failure(("Line %d of output contains invalid packet size %d\n" % (line_num, packet_len))) continue last_packet_len = packet_len if (line_num == 0): self.record_failure("No packets seen") output = {'output':''.join(output)} if not self.result: output['failures'] = ''.join(self.failures) xmostest.set_test_result(product, group, test, config, self.result, output=output, env=env)
def run(self, device_job_output, host_job_output): self.result = True self.failures = [] # Check for any errors for line in (device_job_output + host_job_output ): if re.match('.*ERROR|.*error|.*Error|.*Problem|.*failed|.*could not|.*unrecognised', line): self.record_failure(line) output = {'device_job_output':''.join(device_job_output), 'host_job_output':''.join(host_job_output) } if not self.result: output['failures'] = ''.join(self.failures) xmostest.set_test_result(self.product, self.group, self.test, self.config, self.result, env={}, output=output)
def run(self, output): input_files = self._input index = 0 for input_file_name in input_files: print("Tester opening input file %s" % input_file_name) input_file = open(input_file_name, "r") test_result = [x.strip() for x in input_file.readlines()] (product, group, test, config, env) = self._test regexp = self._regexp golden_file_name = self._golden[index] print("Tester opening golden file %s" % golden_file_name) golden = open(golden_file_name, "r") expected = [x.strip() for x in golden.readlines()] if expected[0].strip()=='': expected = expected[1:] if expected[-1].strip()=='': expected = expected[:-1] self.result = True self.failures = [] line_num = -1 for i in range(len(test_result)): ignore = False for p in self._ignore: if re.match(p,test_result[i].strip()): ignore = True break if ignore: continue line_num += 1 #print("line_num=%d, result=%s, line=%s" % (line_num, self.result, test_result[i].strip())) if line_num >= len(expected): self.record_failure("Length of expected test result less than expected file") break if regexp: match = re.match(expected[line_num]+"$", test_result[i].strip()) else: match = expected[line_num] == test_result[i].strip() if not match: self.record_failure(("Line %d of test result does not match expected file\n"+ " Expected : %s\n"+ " Actual input : %s") % (line_num, expected[line_num].strip(), test_result[i].strip())) if (len(expected) > line_num + 1): self.record_failure("Length of expected file greater than test result") test_result = {'test_result':''.join(test_result)} if not self.result: test_result = ''.join(self.failures) index += 1 xmostest.set_test_result(product, group, test, config, self.result, output = test_result, env = env)
def run(self, device_job_output, host_job_output): self.result = True self.failures = [] # Check for any errors for line in (device_job_output + host_job_output): if re.match( '.*ERROR|.*error|.*Error|.*Problem|.*failed|.*could not|.*unrecognised', line): self.record_failure(line) output = { 'device_job_output': ''.join(device_job_output), 'host_job_output': ''.join(host_job_output) } if not self.result: output['failures'] = ''.join(self.failures) xmostest.set_test_result(self.product, self.group, self.test, self.config, self.result, env={}, output=output)
def run(self, output): result = True for line in output: if line.find("FAIL") != -1: result = False xmostest.set_test_result("lib_uart", "sim_regression", "loopback_test", {}, result, output=''.join(output))
def run(self, output): result = True for line in output: if line.find("FAIL") != -1: result = False xmostest.set_test_result("lib_uart", "sim_regression", "loopback_test", {}, result, output=''.join(output))
def check_file_count(test_files, golden_files): len_test_files = len(test_files) len_golden_files = len(golden_files) if isinstance(test_files, str): len_test_files = 1 if isinstance(golden_files, str): len_golden_files = 1 if len_test_files != len_golden_files: print("ERROR: %d test file(s) specified and %d golden file(s)" % (len_test_files, len_golden_files)) xmostest.set_test_result(product, group, test, config, result=False, output = "Number of inout and output files does not match", env = env) print("Found %d audio channels to process" % len(test_files))
def run(self, xc_output, python_output): self.result = True self.failures = [] expected_response = self._expected_response ip = self._ip (product, group, test, config, env) = self._test if isinstance(python_output, str): python_output = python_output.split('\n') while (python_output[-1] == ''): del python_output[-1] # Check for any xC device errors for line in (xc_output + python_output): if re.match('.*ERROR|.*error|.*Error|.*Problem', line): self.record_failure('Error: ' + line) if python_output[0] != expected_response: self.record_failure( 'Response from device did not match expected response\n' + ' Expected:\n{}'.format(expected_response) + ' Actual:\n{}'.format(python_output)) for line in xc_output: if re.match('IP Address: [0-9].[0-9].[0-9].[0-9]', line): found_ip = line.strip('IP Address: ').strip('\n') if (found_ip != ip): self.record_failure( 'Differing IP address used by device than expected\n' + ' Expected: {}\n'.format(ip) + ' Found: {}'.format(found_ip)) output = { 'python_output': ''.join(python_output), 'device_output': ''.join(xc_output) } if not self.result: output['failures'] = ''.join(self.failures) xmostest.set_test_result(product, group, test, config, self.result, env={}, output=output)
def run(self, xc_output, python_output): self.result = True self.failures = [] total_connections = self._total_connections packets = self._packets protocol = self._protocol (product, group, test, config, env) = self._test if isinstance(python_output, str): python_output = python_output.split('\n') while (python_output[-1] == ''): del python_output[-1] # Check for any xC device errors for line in (xc_output + python_output): if re.match('.*ERROR|.*error|.*Error|.*Problem', line): self.record_failure(line) # Check the board is listening on every port found_connections = 0 for i in range(len(xc_output)): if (re.match('Listening on port: [0-9]+$', xc_output[i])): found_connections += 1 if found_connections < total_connections: self.record_failure( "Incorrect amount of listening ports created on device\n" + " Expected ports: {}".format(total_connections) + " Actual ports: {}".format(found_connections)) udp_max_error = int(packets * total_connections * 0.01) total_errors = -1 for i in range(len(python_output)): if (re.match('Lost_packets: [0-9]+.*$', python_output[i])): total_errors = int(python_output[i].split(' ')[1]) break if total_errors == -1: self.record_failure( "Could not find the python script's error output") # Accept a 1% error rate for UDP? if protocol == "UDP": if total_errors > udp_max_error: self.record_failure( "Packet error rate too high \n" + " Allowable loss rate: {} packets\n".format( udp_max_error) + " Actual loss rate: {} packets\n".format(total_errors)) # Accept no errors for TCP else: if total_errors > 0: self.record_failure( "Packet error rate too high \n" + " Allowable loss rate: 0 packets\n" + " Actual loss rate: {} packets\n".format(total_errors)) output = { 'python_output': ''.join(python_output), 'device_output': ''.join(xc_output) } if not self.result: output['failures'] = ''.join(self.failures) xmostest.set_test_result(product, group, test, config, self.result, env={}, output=output)