-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch filters out kselftests binaries using python regexp, instead of using a bash script.
- Loading branch information
Showing
1 changed file
with
12 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
.. moduleauthor:: Andrea Cervesato <[email protected]> | ||
""" | ||
import re | ||
import os | ||
import shlex | ||
import logging | ||
|
@@ -51,21 +52,26 @@ async def _get_cgroup(self, sut: SUT) -> Suite: | |
raise KirkException( | ||
f"cgroup folder is not available: {cgroup_dir}") | ||
|
||
ret = await sut.run_command( | ||
"basename -s .c -- test_*.c", | ||
cwd=cgroup_dir) | ||
ret = await sut.run_command("ls -1 test_*", cwd=cgroup_dir) | ||
if ret["returncode"] != 0 or not ret["stdout"]: | ||
raise KirkException("Can't read cgroup tests") | ||
|
||
names = [n.rstrip() for n in ret["stdout"].split('\n')] | ||
# we want to loop into a list rather than using one regexp that | ||
# rules everything. In this way we are not dependent by ls format | ||
names = ret["stdout"].split('\n') | ||
if not names: | ||
raise KirkException("Can't find cgroup tests") | ||
|
||
match = re.compile(r'^test_[^.]+$') | ||
tests_obj = [] | ||
|
||
for name in names: | ||
if not name: | ||
myname = match.search(name) | ||
if not myname: | ||
continue | ||
|
||
tests_obj.append(Test( | ||
name=name, | ||
name=myname, | ||
cmd=os.path.join(cgroup_dir, name), | ||
cwd=cgroup_dir, | ||
parallelizable=False)) | ||
|