def update_skip_according_to_rm(): global SKIP_TESTS print "Check redmine for open issues" rm = MlxRedmine() SKIP_TESTS = {} for t in TESTS: data = [] with open(t) as f: for line in f.xreadlines(): if line.startswith('#') or not line.strip(): data.append(line) else: break data = ''.join(data) t = os.path.basename(t) bugs = re.findall("#\s*Bug SW #([0-9]+):", data) for b in bugs: task = rm.get_issue(b) if rm.is_issue_open(task): SKIP_TESTS[t] = "RM #%s: %s" % (b, task['subject']) print '.', sys.stdout.flush() if t not in SKIP_TESTS and 'IGNORE_FROM_TEST_ALL' in data: SKIP_TESTS[t] = "IGNORE_FROM_TEST_ALL" print
def db_check(): rm = MlxRedmine() all_tests = glob(MYDIR + '/test-*.sh') sort_tests(all_tests) for test in TESTS: if test.fname in all_tests: all_tests.remove(test.fname) for test in all_tests: name = os.path.basename(test) print_test_line(name, "Missing in db") target_version = '' for test in TESTS: name = test.name if test.name in WONT_FIX: print_test_line(name, WONT_FIX[name]) continue for task in test.issues: if rm.is_tracker_bug(task): if 'fixed_version' in task: fixed_version = task['fixed_version']['name'] if not target_version: target_version = fixed_version elif fixed_version != target_version: print_test_line(name, "Mismatch target versions '%s' vs '%s' (RM #%s)" % (fixed_version, target_version, task['id'])) else: tmp = "RM #%s: %s" % (task['id'], task['subject']) print_test_line(name, "Missing target version: %s" % tmp) return 0
def update_skip_according_to_rm(): print("Check redmine for open issues") rm = MlxRedmine() for t in TESTS: data = get_test_header(t.fname) name = t.name bugs = re.findall(r"#\s*Bug SW #([0-9]+):", data) for b in bugs: task = rm.get_issue(b) sys.stdout.write('.') sys.stdout.flush() if rm.is_issue_open(task): t.set_skip("RM #%s: %s" % (b, task['subject'])) break if not t.skip and 'IGNORE_FROM_TEST_ALL' in data: t.set_ignore("IGNORE_FROM_TEST_ALL") print()
def update_skip_according_to_rm(): global SKIP_TESTS print "Check redmine for open issues" rm = MlxRedmine() SKIP_TESTS = {} for t in TESTS: with open(t) as f: data = f.read() t = os.path.basename(t) bugs = re.findall("Bug SW #([0-9]+):", data) for b in bugs: task = rm.get_issue(b) if rm.is_issue_open(task): SKIP_TESTS[t] = "RM #%s: %s" % (b, task['subject']) print '.', sys.stdout.flush() print
def update_skip_according_to_db(data): if type(data['tests']) is list: return def kernel_match(kernel1, kernel2): if kernel1 in custom_kernels: kernel1 = custom_kernels[kernel1] # regex issue with strings like "3.10-100+$" so use string compare for exact match. if (kernel1.strip('()') == kernel2 or re.search("^%s$" % kernel1, kernel2)): return True return False rm = MlxRedmine() nic = get_config_value('NIC') current_fw_ver = get_current_fw(nic) current_nic = DeviceType.get(get_current_nic_type(nic)) if args.test_kernel: current_kernel = args.test_kernel else: current_kernel = os.uname()[2] flow_steering_mode = get_flow_steering_mode(nic) simx_mode = check_simx(nic) custom_kernels = data.get('custom_kernels', {}) print("nic: %s" % current_nic) print("fw: %s" % current_fw_ver) print("flow steering: %s" % flow_steering_mode) print("kernel: %s" % current_kernel) if simx_mode: print("simx mode") for t in TESTS: name = t.name if data['tests'][name] is None: data['tests'][name] = {} ignore_for_linust = data['tests'][name].get('ignore_for_linust', 0) ignore_for_upstream = data['tests'][name].get('ignore_for_upstream', 0) simx_ignore = data['tests'][name].get('simx_ignore', 0) if ignore_for_linust and ignore_for_upstream: raise RuntimeError("%s: Do not ignore on both for_linust and for_upstream." % name) if ignore_for_linust and 'linust' in current_kernel: t.set_ignore("Ignore on for-linust kernel") continue if ignore_for_upstream and 'upstream' in current_kernel: t.set_ignore("Ignore on for-upstream kernel") continue ignore_fs = data['tests'][name].get('ignore_flow_steering', '') if ignore_fs and (not flow_steering_mode or ignore_fs == flow_steering_mode): t.set_ignore("Ignore flow steering mode %s" % ignore_fs) continue if simx_mode and simx_ignore: t.set_ignore("Ignore for SimX mode with reason %s" % simx_ignore) continue ignore_not_supported = data['tests'][name].get('ignore_not_supported', 0) if ignore_not_supported is True: t.set_ignore("Not supported") continue elif type(ignore_not_supported) == list: for kernel in ignore_not_supported: if kernel_match(kernel, current_kernel): t.set_ignore("Not supported") break if t.ignore: continue if 'el' in current_kernel: min_kernel = data['tests'][name].get('min_kernel_rhel', None) else: min_kernel = data['tests'][name].get('min_kernel', None) kernels = data['tests'][name].get('kernels', []) if kernels and not min_kernel: raise RuntimeError("%s: Specifying kernels without min_kernel is not allowed." % name) if min_kernel: kernels += custom_kernels.values() ok = False for kernel in kernels: if kernel_match(kernel, current_kernel): ok = True break if not ok: a = VersionInfo(min_kernel) b = VersionInfo(current_kernel) if b < a: t.set_ignore("Unsupported kernel version. Minimum %s" % min_kernel) continue for nic in data['tests'][name].get('ignore_nic', []): if nic == current_nic: t.set_ignore("Unsupported nic %s" % nic) break if t.ignore: continue bugs_list = [] # issue number key with list of kernels issue_keys = [x for x in data['tests'][name].keys() if isinstance(x, int)] for issue in issue_keys: for kernel in data['tests'][name][issue]: if kernel_match(kernel, current_kernel): bugs_list.append(issue) ignore_kernel = data['tests'][name].get('ignore_kernel', {}) for kernel in ignore_kernel: if kernel_match(kernel, current_kernel): bugs_list += ignore_kernel[kernel] for fw in data['tests'][name].get('ignore_fw', {}): if not current_fw_ver or re.search("^%s$" % fw, current_fw_ver): bugs_list += data['tests'][name]['ignore_fw'][fw] ignore_smfs = data['tests'][name].get('ignore_smfs', []) if ignore_smfs and (not flow_steering_mode or flow_steering_mode == 'smfs'): for kernel in ignore_smfs: if kernel_match(kernel, current_kernel): bugs_list.extend(ignore_smfs[kernel]) if simx_mode: simx_ignore_issues = data['tests'][name].get('simx_ignore_issue', []) bugs_list.extend(simx_ignore_issues) for bug in bugs_list: try: task = rm.get_issue(bug) t.issues.append(task) except ValueError: t.set_skip("Cannot fetch RM #%s" % bug) continue if rm.is_issue_wont_fix_or_release_notes(task): WONT_FIX[name] = "%s RM #%s: %s" % (task['status']['name'], bug, task['subject']) if rm.is_issue_open(task): t.set_skip("RM #%s: %s" % (bug, task['subject'])) break sys.stdout.write('.') sys.stdout.flush() print()