Commit 920bc844 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux_kselftest-fixes-6.10' of...

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

Pull kselftest fixes from Shuah Khan
 "Fixes to clang build failures to timerns, vDSO tests and fixes to vDSO
  makefile"

* tag 'linux_kselftest-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/vDSO: remove duplicate compiler invocations from Makefile
  selftests/vDSO: remove partially duplicated "all:" target in Makefile
  selftests/vDSO: fix clang build errors and warnings
  selftest/timerns: fix clang build failures for abs() calls
parents b5efb63a 66cde337
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])

		for (i = 0; i < 2; i++) {
			_gettime(CLOCK_MONOTONIC, &tst, i);
			if (abs(tst.tv_sec - now.tv_sec) > 5)
			if (labs(tst.tv_sec - now.tv_sec) > 5)
				return pr_fail("%ld %ld\n", now.tv_sec, tst.tv_sec);
		}
		return 0;
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])

	for (i = 0; i < 2; i++) {
		_gettime(CLOCK_MONOTONIC, &tst, i);
		if (abs(tst.tv_sec - now.tv_sec) > 5)
		if (labs(tst.tv_sec - now.tv_sec) > 5)
			return pr_fail("%ld %ld\n",
					now.tv_sec, tst.tv_sec);
	}
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
		/* Check that a child process is in the new timens. */
		for (i = 0; i < 2; i++) {
			_gettime(CLOCK_MONOTONIC, &tst, i);
			if (abs(tst.tv_sec - now.tv_sec - OFFSET) > 5)
			if (labs(tst.tv_sec - now.tv_sec - OFFSET) > 5)
				return pr_fail("%ld %ld\n",
						now.tv_sec + OFFSET, tst.tv_sec);
		}
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ int run_test(int clockid, struct timespec now)
			return pr_perror("timerfd_gettime");

		elapsed = new_value.it_value.tv_sec;
		if (abs(elapsed - 3600) > 60) {
		if (llabs(elapsed - 3600) > 60) {
			ksft_test_result_fail("clockid: %d elapsed: %lld\n",
					      clockid, elapsed);
			return 1;
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ int run_test(int clockid, struct timespec now)
			return pr_perror("timerfd_gettime(%d)", clockid);

		elapsed = new_value.it_value.tv_sec;
		if (abs(elapsed - 3600) > 60) {
		if (llabs(elapsed - 3600) > 60) {
			ksft_test_result_fail("clockid: %d elapsed: %lld\n",
					      clockid, elapsed);
			return 1;
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ static void *tcheck(void *_args)

	for (i = 0; i < 2; i++) {
		_gettime(CLOCK_MONOTONIC, &tst, i);
		if (abs(tst.tv_sec - now->tv_sec) > 5) {
		if (labs(tst.tv_sec - now->tv_sec) > 5) {
			pr_fail("%s: in-thread: unexpected value: %ld (%ld)\n",
				args->tst_name, tst.tv_sec, now->tv_sec);
			return (void *)1UL;
@@ -64,7 +64,7 @@ static int check(char *tst_name, struct timespec *now)

	for (i = 0; i < 2; i++) {
		_gettime(CLOCK_MONOTONIC, &tst, i);
		if (abs(tst.tv_sec - now->tv_sec) > 5)
		if (labs(tst.tv_sec - now->tv_sec) > 5)
			return pr_fail("%s: unexpected value: %ld (%ld)\n",
					tst_name, tst.tv_sec, now->tv_sec);
	}
+12 −17
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
include ../lib.mk

uname_M := $(shell uname -m 2>/dev/null || echo not)
ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)

TEST_GEN_PROGS := $(OUTPUT)/vdso_test_gettimeofday $(OUTPUT)/vdso_test_getcpu
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_abi
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_clock_getres
TEST_GEN_PROGS := vdso_test_gettimeofday
TEST_GEN_PROGS += vdso_test_getcpu
TEST_GEN_PROGS += vdso_test_abi
TEST_GEN_PROGS += vdso_test_clock_getres
ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
TEST_GEN_PROGS += $(OUTPUT)/vdso_standalone_test_x86
TEST_GEN_PROGS += vdso_standalone_test_x86
endif
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_correctness
TEST_GEN_PROGS += vdso_test_correctness

CFLAGS := -std=gnu99
CFLAGS_vdso_standalone_test_x86 := -nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
LDFLAGS_vdso_test_correctness := -ldl

ifeq ($(CONFIG_X86_32),y)
LDLIBS += -lgcc_s
endif

all: $(TEST_GEN_PROGS)
include ../lib.mk
$(OUTPUT)/vdso_test_gettimeofday: parse_vdso.c vdso_test_gettimeofday.c
$(OUTPUT)/vdso_test_getcpu: parse_vdso.c vdso_test_getcpu.c
$(OUTPUT)/vdso_test_abi: parse_vdso.c vdso_test_abi.c
$(OUTPUT)/vdso_test_clock_getres: vdso_test_clock_getres.c

$(OUTPUT)/vdso_standalone_test_x86: vdso_standalone_test_x86.c parse_vdso.c
	$(CC) $(CFLAGS) $(CFLAGS_vdso_standalone_test_x86) \
		vdso_standalone_test_x86.c parse_vdso.c \
		-o $@
$(OUTPUT)/vdso_standalone_test_x86: CFLAGS +=-nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector

$(OUTPUT)/vdso_test_correctness: vdso_test_correctness.c
	$(CC) $(CFLAGS) \
		vdso_test_correctness.c \
		-o $@ \
		$(LDFLAGS_vdso_test_correctness)
$(OUTPUT)/vdso_test_correctness: LDFLAGS += -ldl
Loading