Re: [PATCH 8/8] selftests/vm: hmm-tests: remove the libhugetlbfs dependency

From: John Hubbard
Date: Mon Sep 28 2020 - 16:46:00 EST


On 9/28/20 1:18 PM, John Hubbard wrote:
On 9/28/20 6:02 AM, Jason Gunthorpe wrote:
On Sun, Sep 27, 2020 at 11:21:59PM -0700, John Hubbard wrote:
...
+gcc -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1

This gcc has to come from some makefile variable
I plan on posting a v2 with this additional change, to fix the above point:

diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 986a90fa9653..019cbb7f3cf8 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -138,7 +138,7 @@ $(OUTPUT)/hmm-tests: local_config.h
$(OUTPUT)/hmm-tests: LDLIBS += $(HMM_EXTRA_LIBS)

local_config.mk local_config.h: check_config.sh
- ./check_config.sh
+ ./check_config.sh $(CC)

EXTRA_CLEAN += local_config.mk local_config.h

diff --git a/tools/testing/selftests/vm/check_config.sh b/tools/testing/selftests/vm/check_config.sh
index 651a4b192479..079c8a40b85d 100755
--- a/tools/testing/selftests/vm/check_config.sh
+++ b/tools/testing/selftests/vm/check_config.sh
@@ -16,7 +16,8 @@ echo "#include <sys/types.h>" > $tmpfile_c
echo "#include <hugetlbfs.h>" >> $tmpfile_c
echo "int func(void) { return 0; }" >> $tmpfile_c

-gcc -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1
+CC=${1:?"Usage: $0 <compiler> # example compiler: gcc"}
+$CC -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1

if [ -f $tmpfile_o ]; then
echo "#define LOCAL_CONFIG_HAVE_LIBHUGETLBFS 1" > $OUTPUT_H_FILE



thanks,
--
John Hubbard
NVIDIA