From 6e23f428e129307dd37f3f7f03d6cf31ccc0b0a8 Mon Sep 17 00:00:00 2001 From: Nicholas Murphy Date: Wed, 18 Sep 2024 19:54:04 +0000 Subject: [PATCH] DAOS-16585 tests: Fix NLT handling of __fxstat detection Use strace to determine whether calls to __fxstat actually happen when using a utility/command the IL is being tested on, and stop treating it as an error to not see __fxstat when it's not used. Signed-off-by: Nicholas Murphy Required-githooks: true --- ci/unit/required_packages.sh | 1 + utils/node_local_test.py | 21 +++++++++++++++++++-- utils/scripts/install-el8.sh | 1 + utils/scripts/install-el9.sh | 1 + utils/scripts/install-leap15.sh | 1 + utils/scripts/install-ubuntu.sh | 1 + 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ci/unit/required_packages.sh b/ci/unit/required_packages.sh index ff5e3f98d141..3b8aae4372b1 100755 --- a/ci/unit/required_packages.sh +++ b/ci/unit/required_packages.sh @@ -30,6 +30,7 @@ pkgs="argobots \ pmix \ protobuf-c \ spdk-devel \ + strace \ valgrind-devel" # output with trailing newline suppressed diff --git a/utils/node_local_test.py b/utils/node_local_test.py index 6ace1015df36..45485a141cea 100755 --- a/utils/node_local_test.py +++ b/utils/node_local_test.py @@ -1521,8 +1521,8 @@ def il_cmd(self, cmd, check_read=True, check_write=True, check_fstat=True): print(f'Logged il to {log_name}') print(ret) - if self.caching: - check_fstat = False + check_fstat = check_fstat and not self.caching and \ + look_for_library_call(self.conf, cmd, '__fxstat') try: log_test(self.conf, log_name, check_read=check_read, check_write=check_write, @@ -6327,6 +6327,23 @@ def server_fi(args): server.set_fi(probability=0) +def look_for_library_call(conf, cmd, library_str): + """Look for library_str in the strace call stack of running cmd.""" + tmpfile = tempfile.NamedTemporaryFile(mode='r', + prefix='dnt_assess_', + suffix='.strace', + dir=conf.tmp_dir) + strace_cmd = ['strace', '--stack-traces', '-v', '-o', tmpfile.name] + cmd + subprocess.run(strace_cmd, check=True) + lines = tmpfile.readlines() + tmpfile.close() + for line in lines: + if re.search(library_str, line): + return True + + return False + + def run(wf, args): """Main entry point""" # pylint: disable=too-many-branches diff --git a/utils/scripts/install-el8.sh b/utils/scripts/install-el8.sh index 81a044bfddb0..f5d0d9311211 100755 --- a/utils/scripts/install-el8.sh +++ b/utils/scripts/install-el8.sh @@ -60,6 +60,7 @@ dnf --nodocs install \ python3-devel \ python3-pip \ sg3_utils \ + strace \ sudo \ systemd \ valgrind-devel \ diff --git a/utils/scripts/install-el9.sh b/utils/scripts/install-el9.sh index 9ddd8c257d60..ccb05a10cf61 100755 --- a/utils/scripts/install-el9.sh +++ b/utils/scripts/install-el9.sh @@ -59,6 +59,7 @@ dnf --nodocs install \ python3-devel \ python3-pip \ sg3_utils \ + strace \ sudo \ valgrind-devel \ which \ diff --git a/utils/scripts/install-leap15.sh b/utils/scripts/install-leap15.sh index fc9826ce508d..3ef8ac37d554 100755 --- a/utils/scripts/install-leap15.sh +++ b/utils/scripts/install-leap15.sh @@ -57,6 +57,7 @@ dnf --nodocs install \ python3-devel \ scons \ sg3_utils \ + strace \ sudo \ valgrind-devel \ which \ diff --git a/utils/scripts/install-ubuntu.sh b/utils/scripts/install-ubuntu.sh index ec21c92f474c..da5518bd83b6 100755 --- a/utils/scripts/install-ubuntu.sh +++ b/utils/scripts/install-ubuntu.sh @@ -52,6 +52,7 @@ apt-get install \ pkg-config \ python3-dev \ python3-venv \ + strace \ uuid-dev \ valgrind \ yasm