mirror of
https://github.com/torvalds/linux.git
synced 2026-03-13 23:46:14 +01:00
linux_kselftest-next-6.17-rc1
Fixes
- false failure of subsystem event test
- glob filter test to use mutex_unlock() instead of mutex_trylock()
- several spelling errors in tests
- test_kexec_jump build errors
- pidfd test duplicate-symbol warnings for SCHED_ CPP symbols
Adds a reliable check for suspend to breakpoints suspend test
Improvements to ipc test
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmiH76IACgkQCwJExA0N
QxyHAw/+PWj6IvX+3qQEhPL1l/huPpknPVqd/UVEozAudtkDMNwTXAzmc8TZAGU1
BiQTMRBothDZVxLa6YyQCNgHcFuE9X4PIDPCeRrtHQmoSIJz5Db7wrgy1LtrStBN
9bOrsoYUFyy5xWlnidreu5IHuZFrLGUdwF4BhlBL9IvNBv2FKujHfzGl0mbc2agH
/pbJuLiDKRWk+Wqgyv8LOBu9wsQSraunyiKxYZ+ICqzhangnH8SBVNejum9B/KUT
P2Jzyjjo9hyZxR85B7951HqubzWZjhrS2I9boDYaI0x8RyOM75pO6cdh681Gdzz9
lluospIzQRsKR1brtP+M5vH7F6yGnrQRvjp/PvW5a410JFYeIiuhCuDhGZzYsPdj
nFFXP/CLlTJ4U1TVAzZ0OpwapoLfSmnUzrmVHFJRDW6YpuhliFbxb4YErCRxmBLX
MLxN7NnPG0fUxO4voy49GiqXfFuYnvgZO1FWJuczKv4NXxPUbc77Y1K9Tv4mV97n
W5e1EO3JDLghUAkoQyDy9oC7g6ZYET1EcqhOeTujazOAVPlIKJ0YOnLqlFppc3F7
oqlXJbRdjamn9w+UcAjWNPQxYAJeK8jyB+S2LkCDLULD3dgJEzBj7szC67Ou3yQB
qKuh9u6xhFKc0xgW2YSm3+Cpj8BPGlKzNf+Ks4TIGF8pvurPCy0=
=DyuD
-----END PGP SIGNATURE-----
Merge tag 'linux_kselftest-next-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest updates from Shuah Khan:
- Fixes:
- false failure of subsystem event test
- glob filter test to use mutex_unlock() instead of mutex_trylock()
- several spelling errors in tests
- test_kexec_jump build errors
- pidfd test duplicate-symbol warnings for SCHED_ CPP symbols
- Add a reliable check for suspend to breakpoints suspend test
- Improvements to ipc test
* tag 'linux_kselftest-next-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests/pidfd: Fix duplicate-symbol warnings for SCHED_ CPP symbols
selftests/tracing: Fix false failure of subsystem event test
selftests/kexec: fix test_kexec_jump build
selftests: breakpoints: use suspend_stats to reliably check suspend success
selftests: tracing: Use mutex_unlock for testing glob filter
selftests: print installation complete message
selftests/ptrace: Fix spelling mistake "multible" -> "multiple"
selftests: ipc: Replace fail print statements with ksft_test_result_fail
selftests: Add version file to kselftest installation dir
selftests/cpu-hotplug: fix typo in hotplaggable_offline_cpus function name
This commit is contained in:
commit
0db240bc07
9 changed files with 102 additions and 41 deletions
|
|
@ -293,6 +293,14 @@ ifdef INSTALL_PATH
|
|||
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
|
||||
-C $$TARGET emit_tests >> $(TEST_LIST); \
|
||||
done;
|
||||
@VERSION=$$(git describe HEAD 2>/dev/null); \
|
||||
if [ -n "$$VERSION" ]; then \
|
||||
echo "$$VERSION" > $(INSTALL_PATH)/VERSION; \
|
||||
printf "Version saved to $(INSTALL_PATH)/VERSION\n"; \
|
||||
else \
|
||||
printf "Unable to get version from git describe\n"; \
|
||||
fi
|
||||
@echo "**Kselftest Installation is complete: $(INSTALL_PATH)**"
|
||||
else
|
||||
$(error Error: set INSTALL_PATH to use install)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -127,22 +127,42 @@ int run_test(int cpu)
|
|||
return KSFT_PASS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads the suspend success count from sysfs.
|
||||
* Returns the count on success or exits on failure.
|
||||
*/
|
||||
static int get_suspend_success_count_or_fail(void)
|
||||
{
|
||||
FILE *fp;
|
||||
int val;
|
||||
|
||||
fp = fopen("/sys/power/suspend_stats/success", "r");
|
||||
if (!fp)
|
||||
ksft_exit_fail_msg(
|
||||
"Failed to open suspend_stats/success: %s\n",
|
||||
strerror(errno));
|
||||
|
||||
if (fscanf(fp, "%d", &val) != 1) {
|
||||
fclose(fp);
|
||||
ksft_exit_fail_msg(
|
||||
"Failed to read suspend success count\n");
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return val;
|
||||
}
|
||||
|
||||
void suspend(void)
|
||||
{
|
||||
int power_state_fd;
|
||||
int timerfd;
|
||||
int err;
|
||||
int count_before;
|
||||
int count_after;
|
||||
struct itimerspec spec = {};
|
||||
|
||||
if (getuid() != 0)
|
||||
ksft_exit_skip("Please run the test as root - Exiting.\n");
|
||||
|
||||
power_state_fd = open("/sys/power/state", O_RDWR);
|
||||
if (power_state_fd < 0)
|
||||
ksft_exit_fail_msg(
|
||||
"open(\"/sys/power/state\") failed %s)\n",
|
||||
strerror(errno));
|
||||
|
||||
timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0);
|
||||
if (timerfd < 0)
|
||||
ksft_exit_fail_msg("timerfd_create() failed\n");
|
||||
|
|
@ -152,14 +172,15 @@ void suspend(void)
|
|||
if (err < 0)
|
||||
ksft_exit_fail_msg("timerfd_settime() failed\n");
|
||||
|
||||
count_before = get_suspend_success_count_or_fail();
|
||||
|
||||
system("(echo mem > /sys/power/state) 2> /dev/null");
|
||||
|
||||
timerfd_gettime(timerfd, &spec);
|
||||
if (spec.it_value.tv_sec != 0 || spec.it_value.tv_nsec != 0)
|
||||
count_after = get_suspend_success_count_or_fail();
|
||||
if (count_after <= count_before)
|
||||
ksft_exit_fail_msg("Failed to enter Suspend state\n");
|
||||
|
||||
close(timerfd);
|
||||
close(power_state_fd);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ hotpluggable_cpus()
|
|||
done
|
||||
}
|
||||
|
||||
hotplaggable_offline_cpus()
|
||||
hotpluggable_offline_cpus()
|
||||
{
|
||||
hotpluggable_cpus 0
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ offline_cpu_expect_fail()
|
|||
|
||||
online_all_hot_pluggable_cpus()
|
||||
{
|
||||
for cpu in `hotplaggable_offline_cpus`; do
|
||||
for cpu in `hotpluggable_offline_cpus`; do
|
||||
online_cpu_expect_success $cpu
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,35 @@ fail() { #msg
|
|||
exit_fail
|
||||
}
|
||||
|
||||
# As reading trace can last forever, simply look for 3 different
|
||||
# events then exit out of reading the file. If there's not 3 different
|
||||
# events, then the test has failed.
|
||||
check_unique() {
|
||||
cat trace | grep -v '^#' | awk '
|
||||
BEGIN { cnt = 0; }
|
||||
{
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (event[i] == $5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == cnt) {
|
||||
event[cnt++] = $5;
|
||||
if (cnt > 2) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
END {
|
||||
printf "%d", cnt;
|
||||
}'
|
||||
}
|
||||
|
||||
echo 'sched:*' > set_event
|
||||
|
||||
yield
|
||||
|
||||
count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
|
||||
count=`check_unique`
|
||||
if [ $count -lt 3 ]; then
|
||||
fail "at least fork, exec and exit events should be recorded"
|
||||
fi
|
||||
|
|
@ -29,7 +53,7 @@ echo 1 > events/sched/enable
|
|||
|
||||
yield
|
||||
|
||||
count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
|
||||
count=`check_unique`
|
||||
if [ $count -lt 3 ]; then
|
||||
fail "at least fork, exec and exit events should be recorded"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ ftrace_filter_check 'schedule*' '^schedule.*$'
|
|||
ftrace_filter_check '*pin*lock' '.*pin.*lock$'
|
||||
|
||||
# filter by start*mid*
|
||||
ftrace_filter_check 'mutex*try*' '^mutex.*try.*'
|
||||
ftrace_filter_check 'mutex*unl*' '^mutex.*unl.*'
|
||||
|
||||
# Advanced full-glob matching feature is recently supported.
|
||||
# Skip the tests if we are sure the kernel does not support it.
|
||||
|
|
|
|||
|
|
@ -39,26 +39,26 @@ int restore_queue(struct msgque_data *msgque)
|
|||
|
||||
fd = open("/proc/sys/kernel/msg_next_id", O_WRONLY);
|
||||
if (fd == -1) {
|
||||
printf("Failed to open /proc/sys/kernel/msg_next_id\n");
|
||||
ksft_test_result_fail("Failed to open /proc/sys/kernel/msg_next_id\n");
|
||||
return -errno;
|
||||
}
|
||||
sprintf(buf, "%d", msgque->msq_id);
|
||||
|
||||
ret = write(fd, buf, strlen(buf));
|
||||
if (ret != strlen(buf)) {
|
||||
printf("Failed to write to /proc/sys/kernel/msg_next_id\n");
|
||||
ksft_test_result_fail("Failed to write to /proc/sys/kernel/msg_next_id\n");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
id = msgget(msgque->key, msgque->mode | IPC_CREAT | IPC_EXCL);
|
||||
if (id == -1) {
|
||||
printf("Failed to create queue\n");
|
||||
ksft_test_result_fail("Failed to create queue\n");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if (id != msgque->msq_id) {
|
||||
printf("Restored queue has wrong id (%d instead of %d)\n",
|
||||
id, msgque->msq_id);
|
||||
ksft_test_result_fail("Restored queue has wrong id (%d instead of %d)\n"
|
||||
, id, msgque->msq_id);
|
||||
ret = -EFAULT;
|
||||
goto destroy;
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ int restore_queue(struct msgque_data *msgque)
|
|||
for (i = 0; i < msgque->qnum; i++) {
|
||||
if (msgsnd(msgque->msq_id, &msgque->messages[i].mtype,
|
||||
msgque->messages[i].msize, IPC_NOWAIT) != 0) {
|
||||
printf("msgsnd failed (%m)\n");
|
||||
ksft_test_result_fail("msgsnd failed (%m)\n");
|
||||
ret = -errno;
|
||||
goto destroy;
|
||||
}
|
||||
|
|
@ -90,23 +90,22 @@ int check_and_destroy_queue(struct msgque_data *msgque)
|
|||
if (ret < 0) {
|
||||
if (errno == ENOMSG)
|
||||
break;
|
||||
printf("Failed to read IPC message: %m\n");
|
||||
ksft_test_result_fail("Failed to read IPC message: %m\n");
|
||||
ret = -errno;
|
||||
goto err;
|
||||
}
|
||||
if (ret != msgque->messages[cnt].msize) {
|
||||
printf("Wrong message size: %d (expected %d)\n", ret,
|
||||
msgque->messages[cnt].msize);
|
||||
ksft_test_result_fail("Wrong message size: %d (expected %d)\n", ret, msgque->messages[cnt].msize);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
if (message.mtype != msgque->messages[cnt].mtype) {
|
||||
printf("Wrong message type\n");
|
||||
ksft_test_result_fail("Wrong message type\n");
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
if (memcmp(message.mtext, msgque->messages[cnt].mtext, ret)) {
|
||||
printf("Wrong message content\n");
|
||||
ksft_test_result_fail("Wrong message content\n");
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -114,7 +113,7 @@ int check_and_destroy_queue(struct msgque_data *msgque)
|
|||
}
|
||||
|
||||
if (cnt != msgque->qnum) {
|
||||
printf("Wrong message number\n");
|
||||
ksft_test_result_fail("Wrong message number\n");
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
|
@ -139,7 +138,7 @@ int dump_queue(struct msgque_data *msgque)
|
|||
if (ret < 0) {
|
||||
if (errno == EINVAL)
|
||||
continue;
|
||||
printf("Failed to get stats for IPC queue with id %d\n",
|
||||
ksft_test_result_fail("Failed to get stats for IPC queue with id %d\n",
|
||||
kern_id);
|
||||
return -errno;
|
||||
}
|
||||
|
|
@ -150,7 +149,7 @@ int dump_queue(struct msgque_data *msgque)
|
|||
|
||||
msgque->messages = malloc(sizeof(struct msg1) * ds.msg_qnum);
|
||||
if (msgque->messages == NULL) {
|
||||
printf("Failed to get stats for IPC queue\n");
|
||||
ksft_test_result_fail("Failed to get stats for IPC queue\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +161,7 @@ int dump_queue(struct msgque_data *msgque)
|
|||
ret = msgrcv(msgque->msq_id, &msgque->messages[i].mtype,
|
||||
MAX_MSG_SIZE, i, IPC_NOWAIT | MSG_COPY);
|
||||
if (ret < 0) {
|
||||
printf("Failed to copy IPC message: %m (%d)\n", errno);
|
||||
ksft_test_result_fail("Failed to copy IPC message: %m (%d)\n", errno);
|
||||
return -errno;
|
||||
}
|
||||
msgque->messages[i].msize = ret;
|
||||
|
|
@ -178,7 +177,7 @@ int fill_msgque(struct msgque_data *msgque)
|
|||
memcpy(msgbuf.mtext, TEST_STRING, sizeof(TEST_STRING));
|
||||
if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(TEST_STRING),
|
||||
IPC_NOWAIT) != 0) {
|
||||
printf("First message send failed (%m)\n");
|
||||
ksft_test_result_fail("First message send failed (%m)\n");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +185,7 @@ int fill_msgque(struct msgque_data *msgque)
|
|||
memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING));
|
||||
if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(ANOTHER_TEST_STRING),
|
||||
IPC_NOWAIT) != 0) {
|
||||
printf("Second message send failed (%m)\n");
|
||||
ksft_test_result_fail("Second message send failed (%m)\n");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -202,44 +201,44 @@ int main(int argc, char **argv)
|
|||
|
||||
msgque.key = ftok(argv[0], 822155650);
|
||||
if (msgque.key == -1) {
|
||||
printf("Can't make key: %d\n", -errno);
|
||||
ksft_test_result_fail("Can't make key: %d\n", -errno);
|
||||
ksft_exit_fail();
|
||||
}
|
||||
|
||||
msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666);
|
||||
if (msgque.msq_id == -1) {
|
||||
err = -errno;
|
||||
printf("Can't create queue: %d\n", err);
|
||||
ksft_test_result_fail("Can't create queue: %d\n", err);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
err = fill_msgque(&msgque);
|
||||
if (err) {
|
||||
printf("Failed to fill queue: %d\n", err);
|
||||
ksft_test_result_fail("Failed to fill queue: %d\n", err);
|
||||
goto err_destroy;
|
||||
}
|
||||
|
||||
err = dump_queue(&msgque);
|
||||
if (err) {
|
||||
printf("Failed to dump queue: %d\n", err);
|
||||
ksft_test_result_fail("Failed to dump queue: %d\n", err);
|
||||
goto err_destroy;
|
||||
}
|
||||
|
||||
err = check_and_destroy_queue(&msgque);
|
||||
if (err) {
|
||||
printf("Failed to check and destroy queue: %d\n", err);
|
||||
ksft_test_result_fail("Failed to check and destroy queue: %d\n", err);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
err = restore_queue(&msgque);
|
||||
if (err) {
|
||||
printf("Failed to restore queue: %d\n", err);
|
||||
ksft_test_result_fail("Failed to restore queue: %d\n", err);
|
||||
goto err_destroy;
|
||||
}
|
||||
|
||||
err = check_and_destroy_queue(&msgque);
|
||||
if (err) {
|
||||
printf("Failed to test queue: %d\n", err);
|
||||
ksft_test_result_fail("Failed to test queue: %d\n", err);
|
||||
goto err_out;
|
||||
}
|
||||
ksft_exit_pass();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ include ../../../scripts/Makefile.arch
|
|||
|
||||
ifeq ($(IS_64_BIT)$(ARCH_PROCESSED),1x86)
|
||||
TEST_PROGS += test_kexec_jump.sh
|
||||
test_kexec_jump.sh: $(OUTPUT)/test_kexec_jump
|
||||
TEST_GEN_PROGS := test_kexec_jump
|
||||
endif
|
||||
|
||||
include ../lib.mk
|
||||
|
|
|
|||
|
|
@ -16,6 +16,15 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
/*
|
||||
* Remove the userspace definitions of the following preprocessor symbols
|
||||
* to avoid duplicate-definition warnings from the subsequent in-kernel
|
||||
* definitions.
|
||||
*/
|
||||
#undef SCHED_NORMAL
|
||||
#undef SCHED_FLAG_KEEP_ALL
|
||||
#undef SCHED_FLAG_UTIL_CLAMP
|
||||
|
||||
#include "../kselftest.h"
|
||||
#include "../clone3/clone3_selftests.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
/*
|
||||
* Dump signal from the process-wide queue.
|
||||
* The number of signals is not multible to the buffer size
|
||||
* The number of signals is not multiple to the buffer size
|
||||
*/
|
||||
if (check_direct_path(child, 1, 3))
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue