X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Fautotest_runner.py;h=95e74c760dba57a815d3f66b34cab505e9952e40;hb=10b71caecbe1cddcbb65c050ca775fba575e88db;hp=36941a40a16cac1ae7401292a0bd0ea3ccedc62a;hpb=a9de470cc7c0649221e156fc5f30a2dbdfe7c166;p=dpdk.git diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py index 36941a40a1..95e74c760d 100644 --- a/app/test/autotest_runner.py +++ b/app/test/autotest_runner.py @@ -43,9 +43,16 @@ def get_numa_nodes(): # find first (or any, really) CPU on a particular node, will be used to spread # processes around NUMA nodes to avoid exhausting memory on particular node def first_cpu_on_node(node_nr): - cpu_path = glob.glob("/sys/devices/system/node/node%d/cpu*" % node_nr)[0] - cpu_name = os.path.basename(cpu_path) - m = re.match(r"cpu(\d+)", cpu_name) + cpu_path = glob.glob("/sys/devices/system/node/node%d/cpu*" % node_nr) + r = re.compile(r"cpu(\d+)") + cpu_name = filter(None, + map(r.match, + map(os.path.basename, cpu_path) + ) + ) + # for compatibility between python 3 and 2 we need to make interable out + # of filter return as it returns list in python 2 and a generator in 3 + m = next(iter(cpu_name)) return int(m.group(1)) @@ -192,7 +199,6 @@ class AutotestRunner: def __init__(self, cmdline, target, blacklist, whitelist, n_processes): self.cmdline = cmdline self.target = target - self.binary = cmdline.split()[0] self.blacklist = blacklist self.whitelist = whitelist self.skipped = [] @@ -201,6 +207,16 @@ class AutotestRunner: self.n_processes = n_processes self.active_processes = 0 + # parse the binary for available test commands + binary = cmdline.split()[0] + stripped = 'not stripped' not in \ + subprocess.check_output(['file', binary]) + if not stripped: + symbols = subprocess.check_output(['nm', binary]).decode('utf-8') + self.avail_cmds = re.findall('test_register_(\w+)', symbols) + else: + self.avail_cmds = None + # log file filename logfile = "%s.log" % target csvfile = "%s.csv" % target @@ -275,20 +291,10 @@ class AutotestRunner: return False # if test wasn't compiled in, remove it as well - - # parse the binary for available test commands - stripped = 'not stripped' not in \ - subprocess.check_output(['file', self.binary]) - if not stripped: - symbols = subprocess.check_output(['nm', - self.binary]).decode('utf-8') - avail_cmds = re.findall('test_register_(\w+)', symbols) - - if test_cmd not in avail_cmds: - # notify user - result = 0, "Skipped [Not compiled]", test_id, 0, "", None - self.skipped.append(tuple(result)) - return False + if self.avail_cmds and test_cmd not in self.avail_cmds: + result = 0, "Skipped [Not compiled]", test_id, 0, "", None + self.skipped.append(tuple(result)) + return False return True