Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'linux-kselftest-fixes-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest fixes from Shuah Khan:
"Compile time fixes and run-time resources leaks:

- Fix clang cross compilation

- Fix resource leak when return error

- fix compile error for dma_map_benchmark

- Fix regression - make use of GUP_TEST_FILE macro"

* tag 'linux-kselftest-fixes-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests: make use of GUP_TEST_FILE macro
selftests: vm: Fix resource leak when return error
selftests dma: fix compile error for dma_map_benchmark
selftests: Fix clang cross compilation

+29 -5
+1
tools/testing/selftests/dma/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 CFLAGS += -I../../../../usr/include/ 3 + CFLAGS += -I../../../../include/ 3 4 4 5 TEST_GEN_PROGS := dma_map_benchmark 5 6
+1 -1
tools/testing/selftests/dma/dma_map_benchmark.c
··· 10 10 #include <unistd.h> 11 11 #include <sys/ioctl.h> 12 12 #include <sys/mman.h> 13 - #include <linux/map_benchmark.h> 14 13 #include <linux/types.h> 14 + #include <linux/map_benchmark.h> 15 15 16 16 #define NSEC_PER_MSEC 1000000L 17 17
+23 -2
tools/testing/selftests/lib.mk
··· 7 7 LLVM_SUFFIX := $(LLVM) 8 8 endif 9 9 10 - CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) 10 + CLANG_TARGET_FLAGS_arm := arm-linux-gnueabi 11 + CLANG_TARGET_FLAGS_arm64 := aarch64-linux-gnu 12 + CLANG_TARGET_FLAGS_hexagon := hexagon-linux-musl 13 + CLANG_TARGET_FLAGS_m68k := m68k-linux-gnu 14 + CLANG_TARGET_FLAGS_mips := mipsel-linux-gnu 15 + CLANG_TARGET_FLAGS_powerpc := powerpc64le-linux-gnu 16 + CLANG_TARGET_FLAGS_riscv := riscv64-linux-gnu 17 + CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu 18 + CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu 19 + CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH)) 20 + 21 + ifeq ($(CROSS_COMPILE),) 22 + ifeq ($(CLANG_TARGET_FLAGS),) 23 + $(error Specify CROSS_COMPILE or add '--target=' option to lib.mk 24 + else 25 + CLANG_FLAGS += --target=$(CLANG_TARGET_FLAGS) 26 + endif # CLANG_TARGET_FLAGS 27 + else 28 + CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) 29 + endif # CROSS_COMPILE 30 + 31 + CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLANG_FLAGS) -fintegrated-as 11 32 else 12 33 CC := $(CROSS_COMPILE)gcc 13 - endif 34 + endif # LLVM 14 35 15 36 ifeq (0,$(MAKELEVEL)) 16 37 ifeq ($(OUTPUT),)
+2 -2
tools/testing/selftests/vm/gup_test.c
··· 209 209 if (write) 210 210 gup.gup_flags |= FOLL_WRITE; 211 211 212 - gup_fd = open("/sys/kernel/debug/gup_test", O_RDWR); 212 + gup_fd = open(GUP_TEST_FILE, O_RDWR); 213 213 if (gup_fd == -1) { 214 214 switch (errno) { 215 215 case EACCES: ··· 224 224 printf("check if CONFIG_GUP_TEST is enabled in kernel config\n"); 225 225 break; 226 226 default: 227 - perror("failed to open /sys/kernel/debug/gup_test"); 227 + perror("failed to open " GUP_TEST_FILE); 228 228 break; 229 229 } 230 230 exit(KSFT_SKIP);
+2
tools/testing/selftests/vm/ksm_tests.c
··· 54 54 } 55 55 if (fprintf(f, "%lu", val) < 0) { 56 56 perror("fprintf"); 57 + fclose(f); 57 58 return 1; 58 59 } 59 60 fclose(f); ··· 73 72 } 74 73 if (fscanf(f, "%lu", val) != 1) { 75 74 perror("fscanf"); 75 + fclose(f); 76 76 return 1; 77 77 } 78 78 fclose(f);