From 35bb5b663a527f434775637a181854902c52c97b Mon Sep 17 00:00:00 2001 From: Abdul Haleem Date: Wed, 28 Feb 2024 19:22:08 +0530 Subject: [PATCH] ltp_fs : resolve interactive user check With latest ltp source, a user id check has been added causing the test to wait for user response to this check ..user ids and/or groups are missing, would you like these created? [y/N] This code solves this check by passing the 'y' string to automatically proceed the test Signed-off-by: Abdul Haleem --- generic/ltp.py | 8 +++++++- io/disk/ltp_fs.py | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/generic/ltp.py b/generic/ltp.py index c9c74a833..785de0c5e 100644 --- a/generic/ltp.py +++ b/generic/ltp.py @@ -218,7 +218,13 @@ def test(self): skipfilepath)) if self.mem_leak: self.args += " -M %s" % self.mem_leak - cmd = "%s %s" % (os.path.join(self.ltpbin_dir, 'runltp'), self.args) + self.ltpbin_path = os.path.join(self.ltpbin_dir, 'runltp') + with open(self.ltpbin_path, 'r') as lfile: + data = lfile.read() + data = data.replace(" ${LTPROOT}/IDcheck.sh || \\", " echo -e \"y\" | ${LTPROOT}/IDcheck.sh || \\") + with open(self.ltpbin_path, 'w') as ofile: + ofile.write(data) + cmd = '%s %s' % (self.ltpbin_path, self.args) process.run(cmd, ignore_status=True) # Walk the ltp.log and try detect failed tests from lines like these: # msgctl04 FAIL 2 diff --git a/io/disk/ltp_fs.py b/io/disk/ltp_fs.py index bdd8ff29d..3fdb38954 100755 --- a/io/disk/ltp_fs.py +++ b/io/disk/ltp_fs.py @@ -316,8 +316,13 @@ def test_fs_run(self): self.args += (" -q -p -l %s -C %s -d %s" % (logfile, failcmdfile, self.dir)) self.log.info("Args = %s", self.args) - cmd = '%s %s' % (os.path.join(self.ltpbin_dir, 'runltp'), - self.args) + self.ltpbin_path = os.path.join(self.ltpbin_dir, 'runltp') + with open(self.ltpbin_path, 'r') as lfile: + data = lfile.read() + data = data.replace(" ${LTPROOT}/IDcheck.sh || \\", " echo -e \"y\" | ${LTPROOT}/IDcheck.sh || \\") + with open(self.ltpbin_path, 'w') as ofile: + ofile.write(data) + cmd = '%s %s' % (self.ltpbin_path, self.args) result = process.run(cmd, ignore_status=True) # Walk the stdout and try detect failed tests from lines # like these: