[CRIU] [PATCH 2/9] zdtm: don't use find to get executable files
Andrei Vagin
avagin at openvz.org
Sat Sep 30 01:41:38 MSK 2017
From: Andrei Vagin <avagin at virtuozzo.com>
find: unrecognized: -executable
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
test/zdtm.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/test/zdtm.py b/test/zdtm.py
index 2e37087f5..b48301f03 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -1530,16 +1530,25 @@ class launcher:
def all_tests(opts):
desc = eval(open(opts['set'] + '.desc').read())
- lst = subprocess.Popen(['find', desc['dir'], '-type', 'f', '-executable'],
- stdout = subprocess.PIPE)
+
+ files = []
+ mask = stat.S_IFREG | stat.S_IXUSR
+ for d in os.walk(desc['dir']):
+ for f in d[2]:
+ fp = os.path.join(d[0], f)
+ st = os.lstat(fp)
+ if (st.st_mode & mask) != mask:
+ continue
+ if stat.S_IFMT(st.st_mode) in [stat.S_IFLNK, stat.S_IFSOCK]:
+ continue
+ files.append(fp)
excl = map(lambda x: os.path.join(desc['dir'], x), desc['exclude'])
tlist = filter(lambda x:
not x.endswith('.checkskip') and
not x.endswith('.hook') and
x not in excl,
- map(lambda x: x.strip(), lst.stdout.readlines())
+ map(lambda x: x.strip(), files)
)
- lst.wait()
return tlist
--
2.13.3
More information about the CRIU
mailing list