From d5d41bac19350e63c51d897aedcdfa626e77bf0a Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 30 Sep 2017 01:41:38 +0300 Subject: [PATCH] zdtm: don't use find to get executable files find: unrecognized: -executable Signed-off-by: Andrei Vagin --- 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