From d11705367949b4823e7c2296f912fe452b0cce18 Mon Sep 17 00:00:00 2001 From: Kamil Godzwon Date: Tue, 2 May 2023 07:10:19 -0400 Subject: [PATCH] test/autobuild: Update llvm_precompile function to handle newer CLANG versions The llvm_precompile function checks for the CLANG version available on the machine using bash regex and searches for fuzzer libraries in a path based on the full CLANG version number. (e.g. /usr/lib64/clang/15.0.3/...) However, on the newest Fedora distribution, the path has changed and fuzzer libraries couldn't be found. Currently, CLANG libraries path contains only major version number (/usr/lib64/clang/16) To address this issue, the function has been updated to search only for the major CLANG version number instead of the full version number. Instead of using clang_version, the function now uses clang_num because in every Fedora distribution there is directory or symlink that points to the right CLANG version. e.g. symlinks /usr/lib64/clang/13 -> /usr/lib64/clang/13.0.1 /usr/lib64/clang/15 -> /usr/lib64/clang/15.0.3 or directory: /usr/lib64/clang/16 Fixes #3000 Signed-off-by: Kamil Godzwon Change-Id: Iaf0dedc2bb3956cf06796e2eb60a5fa6f492b780 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17907 Reviewed-by: Ben Walker Reviewed-by: Konrad Sztyber Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris --- test/common/autobuild_common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/common/autobuild_common.sh b/test/common/autobuild_common.sh index 8a448c48a..3c7f9a3dd 100755 --- a/test/common/autobuild_common.sh +++ b/test/common/autobuild_common.sh @@ -30,13 +30,12 @@ _ocf_precompile() { # Find matching llvm fuzzer library and clang compiler version _llvm_precompile() { [[ $(clang --version) =~ "version "(([0-9]+).([0-9]+).([0-9]+)) ]] - clang_version=${BASH_REMATCH[1]} clang_num=${BASH_REMATCH[2]} export CC=clang-$clang_num export CXX=clang++-$clang_num - fuzzer_libs=(/usr/lib*/clang/"$clang_version"/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a) + fuzzer_libs=(/usr/lib*/clang/"$clang_num"/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a) fuzzer_lib=${fuzzer_libs[0]} [[ -e $fuzzer_lib ]]