Skip to contentSkip to conversation

userfaultfd: selftest: combine all cases into a single executable

PATCH New [email protected] 1 participant 1 message May 3, 2017 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 65/102 userfaultfd: selftest: combine all cases into a single executable

From: Mike Rapoport <[email protected]>
Subject: userfaultfd: selftest: combine all cases into a single executable

Currently, selftest for userfaultfd is compiled three times: for anonymous, shared and hugetlb memory. Let's combine all the cases into a single executable which will have a command line option for selection of the test type.

---

 tools/testing/selftests/vm/Makefile      |   11 -
 tools/testing/selftests/vm/run_vmtests   |    6 
 tools/testing/selftests/vm/userfaultfd.c |  205 +++++++++++----------
 3 files changed, 115 insertions(+), 107 deletions(-)
tools/testing/selftests/vm/Makefile renamed from tools/testing/selftests/vm/Makefile~userfaultfd-selftest-combine-all-cases-into-the-single-executable +2 -9
diff -puN tools/testing/selftests/vm/Makefile~userfaultfd-selftest-combine-all-cases-into-the-single-executable tools/testing/selftests/vm/Makefile
@@ -15,21 +15,14 @@ TEST_GEN_FILES += on-fault-limit
 TEST_GEN_FILES += thuge-gen
 TEST_GEN_FILES += transhuge-stress
 TEST_GEN_FILES += userfaultfd
-TEST_GEN_FILES += userfaultfd_hugetlb
-TEST_GEN_FILES += userfaultfd_shmem
 TEST_GEN_FILES += mlock-random-test
 
 TEST_PROGS := run_vmtests
 
 include ../lib.mk
 
-$(OUTPUT)/userfaultfd: LDLIBS += -lpthread ../../../../usr/include/linux/kernel.h
-
-$(OUTPUT)/userfaultfd_hugetlb: userfaultfd.c ../../../../usr/include/linux/kernel.h
-	$(CC) $(CFLAGS) -DHUGETLB_TEST -O2 -o $@ $< -lpthread
-
-$(OUTPUT)/userfaultfd_shmem: userfaultfd.c  ../../../../usr/include/linux/kernel.h
-	$(CC) $(CFLAGS) -DSHMEM_TEST -O2 -o $@ $< -lpthread
+$(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h
+$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
 
 $(OUTPUT)/mlock-random-test: LDLIBS += -lcap
 
tools/testing/selftests/vm/run_vmtests renamed from tools/testing/selftests/vm/run_vmtests~userfaultfd-selftest-combine-all-cases-into-the-single-executable +3 -3
diff -puN tools/testing/selftests/vm/run_vmtests~userfaultfd-selftest-combine-all-cases-into-the-single-executable tools/testing/selftests/vm/run_vmtests
@@ -95,7 +95,7 @@ echo "      hugetlb regression testing."
 echo "--------------------"
 echo "running userfaultfd"
 echo "--------------------"
-./userfaultfd 128 32
+./userfaultfd anon 128 32
 if [ $? -ne 0 ]; then
 	echo "[FAIL]"
 	exitcode=1
@@ -107,7 +107,7 @@ echo "----------------------------"
 echo "running userfaultfd_hugetlb"
 echo "----------------------------"
 # 258MB total huge pages == 128MB src and 128MB dst
-./userfaultfd_hugetlb 128 32 $mnt/ufd_test_file
+./userfaultfd hugetlb 128 32 $mnt/ufd_test_file
 if [ $? -ne 0 ]; then
 	echo "[FAIL]"
 	exitcode=1
@@ -119,7 +119,7 @@ rm -f $mnt/ufd_test_file
 echo "----------------------------"
 echo "running userfaultfd_shmem"
 echo "----------------------------"
-./userfaultfd_shmem 128 32
+./userfaultfd shmem 128 32
 if [ $? -ne 0 ]; then
 	echo "[FAIL]"
 	exitcode=1
tools/testing/selftests/vm/userfaultfd.c renamed from tools/testing/selftests/vm/userfaultfd.c~userfaultfd-selftest-combine-all-cases-into-the-single-executable +110 -95

374 lines not on this page · raw message

_