Commit db7d2754 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-5.5-rc1-fixes' of...

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

Pull kselftest fixes from Shuah Khan:
 "This consists of several fixes to tests and framework.

  Masami Hiramatsu fixed several tests to build and run correctly on arm
  and other 32bit architectures"

* tag 'linux-kselftest-5.5-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: sync: Fix cast warnings on arm
  selftests: net: Fix printf format warnings on arm
  selftests: net: Use size_t and ssize_t for counting file size
  selftests: vm: Build/Run 64bit tests only on 64bit arch
  selftests: proc: Make va_max 1MB
  kselftest: Fix NULL INSTALL_PATH for TARGETS runlist
  selftests: Move kselftest_module.sh into kselftest/
  selftests: gen_kselftest_tar.sh: Do not clobber kselftest/
  selftests: breakpoints: Fix a typo of function name
  selftests: Fix O= and KBUILD_OUTPUT handling for relative paths
parents 1c1ff483 ed2d8fa7
...@@ -86,10 +86,10 @@ override LDFLAGS = ...@@ -86,10 +86,10 @@ override LDFLAGS =
endif endif
ifneq ($(O),) ifneq ($(O),)
BUILD := $(O) BUILD := $(abs_objtree)
else else
ifneq ($(KBUILD_OUTPUT),) ifneq ($(KBUILD_OUTPUT),)
BUILD := $(KBUILD_OUTPUT)/kselftest BUILD := $(abs_objtree)/kselftest
else else
BUILD := $(shell pwd) BUILD := $(shell pwd)
DEFAULT_INSTALL_HDR_PATH := 1 DEFAULT_INSTALL_HDR_PATH := 1
...@@ -102,6 +102,7 @@ include $(top_srcdir)/scripts/subarch.include ...@@ -102,6 +102,7 @@ include $(top_srcdir)/scripts/subarch.include
ARCH ?= $(SUBARCH) ARCH ?= $(SUBARCH)
export KSFT_KHDR_INSTALL_DONE := 1 export KSFT_KHDR_INSTALL_DONE := 1
export BUILD export BUILD
#$(info abd_objtree = $(abs_objtree) BUILD = $(BUILD))
# build and run gpio when output directory is the src dir. # build and run gpio when output directory is the src dir.
# gpio has dependency on tools/gpio and builds tools/gpio # gpio has dependency on tools/gpio and builds tools/gpio
...@@ -190,6 +191,7 @@ install: all ...@@ -190,6 +191,7 @@ install: all
ifdef INSTALL_PATH ifdef INSTALL_PATH
@# Ask all targets to install their files @# Ask all targets to install their files
mkdir -p $(INSTALL_PATH)/kselftest mkdir -p $(INSTALL_PATH)/kselftest
install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/
install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
@for TARGET in $(TARGETS); do \ @for TARGET in $(TARGETS); do \
...@@ -213,7 +215,7 @@ ifdef INSTALL_PATH ...@@ -213,7 +215,7 @@ ifdef INSTALL_PATH
@# included in the generated runlist. @# included in the generated runlist.
for TARGET in $(TARGETS); do \ for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
[ ! -d $$INSTALL_PATH/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \ [ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \
echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \ echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
echo "cd $$TARGET" >> $(ALL_SCRIPT); \ echo "cd $$TARGET" >> $(ALL_SCRIPT); \
echo -n "run_many" >> $(ALL_SCRIPT); \ echo -n "run_many" >> $(ALL_SCRIPT); \
......
...@@ -109,7 +109,7 @@ static bool set_watchpoint(pid_t pid, int size, int wp) ...@@ -109,7 +109,7 @@ static bool set_watchpoint(pid_t pid, int size, int wp)
return false; return false;
} }
static bool arun_test(int wr_size, int wp_size, int wr, int wp) static bool run_test(int wr_size, int wp_size, int wr, int wp)
{ {
int status; int status;
siginfo_t siginfo; siginfo_t siginfo;
......
...@@ -38,16 +38,21 @@ main() ...@@ -38,16 +38,21 @@ main()
esac esac
fi fi
install_dir=./kselftest # Create working directory.
dest=`pwd`
install_work="$dest"/kselftest_install
install_name=kselftest
install_dir="$install_work"/"$install_name"
mkdir -p "$install_dir"
# Run install using INSTALL_KSFT_PATH override to generate install # Run install using INSTALL_KSFT_PATH override to generate install
# directory # directory
./kselftest_install.sh ./kselftest_install.sh "$install_dir"
tar $copts kselftest${ext} $install_dir (cd "$install_work"; tar $copts "$dest"/kselftest${ext} $install_name)
echo "Kselftest archive kselftest${ext} created!" echo "Kselftest archive kselftest${ext} created!"
# clean up install directory # clean up top-level install work directory
rm -rf kselftest rm -rf "$install_work"
} }
main "$@" main "$@"
...@@ -6,30 +6,30 @@ ...@@ -6,30 +6,30 @@
# Author: Shuah Khan <shuahkh@osg.samsung.com> # Author: Shuah Khan <shuahkh@osg.samsung.com>
# Copyright (C) 2015 Samsung Electronics Co., Ltd. # Copyright (C) 2015 Samsung Electronics Co., Ltd.
install_loc=`pwd`
main() main()
{ {
if [ $(basename $install_loc) != "selftests" ]; then base_dir=`pwd`
install_dir="$base_dir"/kselftest_install
# Make sure we're in the selftests top-level directory.
if [ $(basename "$base_dir") != "selftests" ]; then
echo "$0: Please run it in selftests directory ..." echo "$0: Please run it in selftests directory ..."
exit 1; exit 1;
fi fi
# Only allow installation into an existing location.
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then
echo "$0: Installing in default location - $install_loc ..." echo "$0: Installing in default location - $install_dir ..."
elif [ ! -d "$1" ]; then elif [ ! -d "$1" ]; then
echo "$0: $1 doesn't exist!!" echo "$0: $1 doesn't exist!!"
exit 1; exit 1;
else else
install_loc=$1 install_dir="$1"
echo "$0: Installing in specified location - $install_loc ..." echo "$0: Installing in specified location - $install_dir ..."
fi fi
install_dir=$install_loc/kselftest_install # Build tests
KSFT_INSTALL_PATH="$install_dir" make install
# Create install directory
mkdir -p $install_dir
# Build tests
KSFT_INSTALL_PATH=$install_dir make install
} }
main "$@" main "$@"
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
$(dirname $0)/../kselftest_module.sh "bitmap" test_bitmap $(dirname $0)/../kselftest/module.sh "bitmap" test_bitmap
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Checks fast/slow prime_number generation for inconsistencies # Checks fast/slow prime_number generation for inconsistencies
$(dirname $0)/../kselftest_module.sh "prime numbers" prime_numbers selftest=65536 $(dirname $0)/../kselftest/module.sh "prime numbers" prime_numbers selftest=65536
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Tests the printf infrastructure using test_printf kernel module. # Tests the printf infrastructure using test_printf kernel module.
$(dirname $0)/../kselftest_module.sh "printf" test_printf $(dirname $0)/../kselftest/module.sh "printf" test_printf
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0+ # SPDX-License-Identifier: GPL-2.0+
$(dirname $0)/../kselftest_module.sh "strscpy*" test_strscpy $(dirname $0)/../kselftest/module.sh "strscpy*" test_strscpy
...@@ -105,8 +105,8 @@ static void do_recv_one(int fdr, struct timed_send *ts) ...@@ -105,8 +105,8 @@ static void do_recv_one(int fdr, struct timed_send *ts)
tstop = (gettime_ns() - glob_tstart) / 1000; tstop = (gettime_ns() - glob_tstart) / 1000;
texpect = ts->delay_us >= 0 ? ts->delay_us : 0; texpect = ts->delay_us >= 0 ? ts->delay_us : 0;
fprintf(stderr, "payload:%c delay:%ld expected:%ld (us)\n", fprintf(stderr, "payload:%c delay:%lld expected:%lld (us)\n",
rbuf[0], tstop, texpect); rbuf[0], (long long)tstop, (long long)texpect);
if (rbuf[0] != ts->data) if (rbuf[0] != ts->data)
error(1, 0, "payload mismatch. expected %c", ts->data); error(1, 0, "payload mismatch. expected %c", ts->data);
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
#define MSG_ZEROCOPY 0x4000000 #define MSG_ZEROCOPY 0x4000000
#endif #endif
#define FILE_SZ (1UL << 35) #define FILE_SZ (1ULL << 35)
static int cfg_family = AF_INET6; static int cfg_family = AF_INET6;
static socklen_t cfg_alen = sizeof(struct sockaddr_in6); static socklen_t cfg_alen = sizeof(struct sockaddr_in6);
static int cfg_port = 8787; static int cfg_port = 8787;
...@@ -155,7 +155,7 @@ void *child_thread(void *arg) ...@@ -155,7 +155,7 @@ void *child_thread(void *arg)
socklen_t zc_len = sizeof(zc); socklen_t zc_len = sizeof(zc);
int res; int res;
zc.address = (__u64)addr; zc.address = (__u64)((unsigned long)addr);
zc.length = chunk_size; zc.length = chunk_size;
zc.recv_skip_hint = 0; zc.recv_skip_hint = 0;
res = getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, res = getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE,
...@@ -302,7 +302,7 @@ int main(int argc, char *argv[]) ...@@ -302,7 +302,7 @@ int main(int argc, char *argv[])
{ {
struct sockaddr_storage listenaddr, addr; struct sockaddr_storage listenaddr, addr;
unsigned int max_pacing_rate = 0; unsigned int max_pacing_rate = 0;
unsigned long total = 0; size_t total = 0;
char *host = NULL; char *host = NULL;
int fd, c, on = 1; int fd, c, on = 1;
char *buffer; char *buffer;
...@@ -417,7 +417,7 @@ int main(int argc, char *argv[]) ...@@ -417,7 +417,7 @@ int main(int argc, char *argv[])
zflg = 0; zflg = 0;
} }
while (total < FILE_SZ) { while (total < FILE_SZ) {
long wr = FILE_SZ - total; ssize_t wr = FILE_SZ - total;
if (wr > chunk_size) if (wr > chunk_size)
wr = chunk_size; wr = chunk_size;
......
...@@ -440,7 +440,8 @@ static bool __send_one(int fd, struct msghdr *msg, int flags) ...@@ -440,7 +440,8 @@ static bool __send_one(int fd, struct msghdr *msg, int flags)
if (ret == -1) if (ret == -1)
error(1, errno, "sendmsg"); error(1, errno, "sendmsg");
if (ret != msg->msg_iov->iov_len) if (ret != msg->msg_iov->iov_len)
error(1, 0, "sendto: %d != %lu", ret, msg->msg_iov->iov_len); error(1, 0, "sendto: %d != %llu", ret,
(unsigned long long)msg->msg_iov->iov_len);
if (msg->msg_flags) if (msg->msg_flags)
error(1, 0, "sendmsg: return flags 0x%x\n", msg->msg_flags); error(1, 0, "sendmsg: return flags 0x%x\n", msg->msg_flags);
......
...@@ -405,7 +405,8 @@ static int send_udp_segment(int fd, char *data) ...@@ -405,7 +405,8 @@ static int send_udp_segment(int fd, char *data)
if (ret == -1) if (ret == -1)
error(1, errno, "sendmsg"); error(1, errno, "sendmsg");
if (ret != iov.iov_len) if (ret != iov.iov_len)
error(1, 0, "sendmsg: %u != %lu\n", ret, iov.iov_len); error(1, 0, "sendmsg: %u != %llu\n", ret,
(unsigned long long)iov.iov_len);
return 1; return 1;
} }
......
...@@ -47,7 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b) ...@@ -47,7 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b)
int main(void) int main(void)
{ {
const int PAGE_SIZE = sysconf(_SC_PAGESIZE); const int PAGE_SIZE = sysconf(_SC_PAGESIZE);
const unsigned long va_max = 1UL << 32; /*
* va_max must be enough bigger than vm.mmap_min_addr, which is
* 64KB/32KB by default. (depends on CONFIG_LSM_MMAP_MIN_ADDR)
*/
const unsigned long va_max = 1UL << 20;
unsigned long va; unsigned long va;
void *p; void *p;
int fd; int fd;
......
...@@ -109,7 +109,7 @@ static struct sync_file_info *sync_file_info(int fd) ...@@ -109,7 +109,7 @@ static struct sync_file_info *sync_file_info(int fd)
return NULL; return NULL;
} }
info->sync_fence_info = (uint64_t)fence_info; info->sync_fence_info = (uint64_t)(unsigned long)fence_info;
err = ioctl(fd, SYNC_IOC_FILE_INFO, info); err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
if (err < 0) { if (err < 0) {
...@@ -124,7 +124,7 @@ static struct sync_file_info *sync_file_info(int fd) ...@@ -124,7 +124,7 @@ static struct sync_file_info *sync_file_info(int fd)
static void sync_file_info_free(struct sync_file_info *info) static void sync_file_info_free(struct sync_file_info *info)
{ {
free((void *)info->sync_fence_info); free((void *)(unsigned long)info->sync_fence_info);
free(info); free(info);
} }
...@@ -152,7 +152,7 @@ int sync_fence_count_with_status(int fd, int status) ...@@ -152,7 +152,7 @@ int sync_fence_count_with_status(int fd, int status)
if (!info) if (!info)
return -1; return -1;
fence_info = (struct sync_fence_info *)info->sync_fence_info; fence_info = (struct sync_fence_info *)(unsigned long)info->sync_fence_info;
for (i = 0 ; i < info->num_fences ; i++) { for (i = 0 ; i < info->num_fences ; i++) {
if (fence_info[i].status == status) if (fence_info[i].status == status)
count++; count++;
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Makefile for vm selftests # Makefile for vm selftests
uname_M := $(shell uname -m 2>/dev/null || echo not)
ARCH ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/')
CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
LDLIBS = -lrt LDLIBS = -lrt
...@@ -16,8 +18,11 @@ TEST_GEN_FILES += on-fault-limit ...@@ -16,8 +18,11 @@ TEST_GEN_FILES += on-fault-limit
TEST_GEN_FILES += thuge-gen TEST_GEN_FILES += thuge-gen
TEST_GEN_FILES += transhuge-stress TEST_GEN_FILES += transhuge-stress
TEST_GEN_FILES += userfaultfd TEST_GEN_FILES += userfaultfd
ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sh64 sparc64 x86_64))
TEST_GEN_FILES += va_128TBswitch TEST_GEN_FILES += va_128TBswitch
TEST_GEN_FILES += virtual_address_range TEST_GEN_FILES += virtual_address_range
endif
TEST_PROGS := run_vmtests TEST_PROGS := run_vmtests
......
...@@ -58,6 +58,14 @@ else ...@@ -58,6 +58,14 @@ else
exit 1 exit 1
fi fi
#filter 64bit architectures
ARCH64STR="arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sh64 sparc64 x86_64"
if [ -z $ARCH ]; then
ARCH=`uname -m 2>/dev/null | sed -e 's/aarch64.*/arm64/'`
fi
VADDR64=0
echo "$ARCH64STR" | grep $ARCH && VADDR64=1
mkdir $mnt mkdir $mnt
mount -t hugetlbfs none $mnt mount -t hugetlbfs none $mnt
...@@ -189,6 +197,7 @@ else ...@@ -189,6 +197,7 @@ else
echo "[PASS]" echo "[PASS]"
fi fi
if [ $VADDR64 -ne 0 ]; then
echo "-----------------------------" echo "-----------------------------"
echo "running virtual_address_range" echo "running virtual_address_range"
echo "-----------------------------" echo "-----------------------------"
...@@ -210,6 +219,7 @@ if [ $? -ne 0 ]; then ...@@ -210,6 +219,7 @@ if [ $? -ne 0 ]; then
else else
echo "[PASS]" echo "[PASS]"
fi fi
fi # VADDR64
echo "------------------------------------" echo "------------------------------------"
echo "running vmalloc stability smoke test" echo "running vmalloc stability smoke test"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment