Commit 797a3242 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-kselftest-5.4-rc1.1' of...

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

Pull Kselftest updates from Shuah Khan:
 "Fixes to existing tests"

* tag 'linux-kselftest-5.4-rc1.1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: tpm2: install python files
  selftests: livepatch: add missing fragments to config
  selftests: watchdog: cleanup whitespace in usage options
  selftest/ftrace: Fix typo in trigger-snapshot.tc
  selftests: watchdog: Add optional file argument
  selftests/seccomp: fix build on older kernels
  selftests: use "$(MAKE)" instead of "make"
parents 972a2bf7 721cb3c8
...@@ -126,9 +126,9 @@ endif ...@@ -126,9 +126,9 @@ endif
# in the default INSTALL_HDR_PATH usr/include. # in the default INSTALL_HDR_PATH usr/include.
khdr: khdr:
ifeq (1,$(DEFAULT_INSTALL_HDR_PATH)) ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
make --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install $(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
else else
make --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \ $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
ARCH=$(ARCH) -C $(top_srcdir) headers_install ARCH=$(ARCH) -C $(top_srcdir) headers_install
endif endif
...@@ -136,35 +136,35 @@ all: khdr ...@@ -136,35 +136,35 @@ all: khdr
@for TARGET in $(TARGETS); do \ @for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
mkdir $$BUILD_TARGET -p; \ mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
done; done;
run_tests: all run_tests: all
@for TARGET in $(TARGETS); do \ @for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
done; done;
hotplug: hotplug:
@for TARGET in $(TARGETS_HOTPLUG); do \ @for TARGET in $(TARGETS_HOTPLUG); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
done; done;
run_hotplug: hotplug run_hotplug: hotplug
@for TARGET in $(TARGETS_HOTPLUG); do \ @for TARGET in $(TARGETS_HOTPLUG); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
done; done;
clean_hotplug: clean_hotplug:
@for TARGET in $(TARGETS_HOTPLUG); do \ @for TARGET in $(TARGETS_HOTPLUG); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done; done;
run_pstore_crash: run_pstore_crash:
make -C pstore run_crash $(MAKE) -C pstore run_crash
# Use $BUILD as the default install root. $BUILD points to the # Use $BUILD as the default install root. $BUILD points to the
# right output location for the following cases: # right output location for the following cases:
...@@ -184,7 +184,7 @@ ifdef INSTALL_PATH ...@@ -184,7 +184,7 @@ ifdef INSTALL_PATH
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 \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
done; done;
@# Ask all targets to emit their test scripts @# Ask all targets to emit their test scripts
...@@ -203,7 +203,7 @@ ifdef INSTALL_PATH ...@@ -203,7 +203,7 @@ ifdef INSTALL_PATH
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); \
make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
echo "" >> $(ALL_SCRIPT); \ echo "" >> $(ALL_SCRIPT); \
echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
done; done;
...@@ -216,7 +216,7 @@ endif ...@@ -216,7 +216,7 @@ endif
clean: clean:
@for TARGET in $(TARGETS); do \ @for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \ BUILD_TARGET=$$BUILD/$$TARGET; \
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done; done;
.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean .PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean
...@@ -28,7 +28,7 @@ if [ -z "$FEATURE" ]; then ...@@ -28,7 +28,7 @@ if [ -z "$FEATURE" ]; then
exit_unsupported exit_unsupported
fi fi
echo "Test snapshot tigger" echo "Test snapshot trigger"
echo 0 > snapshot echo 0 > snapshot
echo 1 > events/sched/sched_process_fork/enable echo 1 > events/sched/sched_process_fork/enable
( echo "forked") ( echo "forked")
......
CONFIG_LIVEPATCH=y
CONFIG_DYNAMIC_DEBUG=y
CONFIG_TEST_LIVEPATCH=m CONFIG_TEST_LIVEPATCH=m
...@@ -199,6 +199,11 @@ struct seccomp_notif_sizes { ...@@ -199,6 +199,11 @@ struct seccomp_notif_sizes {
}; };
#endif #endif
#ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY
#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
#endif
#ifndef seccomp #ifndef seccomp
int seccomp(unsigned int op, unsigned int flags, void *args) int seccomp(unsigned int op, unsigned int flags, void *args)
{ {
......
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
include ../lib.mk include ../lib.mk
TEST_PROGS := test_smoke.sh test_space.sh TEST_PROGS := test_smoke.sh test_space.sh
TEST_FILES := tpm2.py tpm2_tests.py TEST_PROGS_EXTENDED := tpm2.py tpm2_tests.py
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
int fd; int fd;
const char v = 'V'; const char v = 'V';
static const char sopts[] = "bdehp:t:Tn:NL"; static const char sopts[] = "bdehp:t:Tn:NLf:";
static const struct option lopts[] = { static const struct option lopts[] = {
{"bootstatus", no_argument, NULL, 'b'}, {"bootstatus", no_argument, NULL, 'b'},
{"disable", no_argument, NULL, 'd'}, {"disable", no_argument, NULL, 'd'},
...@@ -31,6 +31,7 @@ static const struct option lopts[] = { ...@@ -31,6 +31,7 @@ static const struct option lopts[] = {
{"pretimeout", required_argument, NULL, 'n'}, {"pretimeout", required_argument, NULL, 'n'},
{"getpretimeout", no_argument, NULL, 'N'}, {"getpretimeout", no_argument, NULL, 'N'},
{"gettimeleft", no_argument, NULL, 'L'}, {"gettimeleft", no_argument, NULL, 'L'},
{"file", required_argument, NULL, 'f'},
{NULL, no_argument, NULL, 0x0} {NULL, no_argument, NULL, 0x0}
}; };
...@@ -69,16 +70,19 @@ static void term(int sig) ...@@ -69,16 +70,19 @@ static void term(int sig)
static void usage(char *progname) static void usage(char *progname)
{ {
printf("Usage: %s [options]\n", progname); printf("Usage: %s [options]\n", progname);
printf(" -b, --bootstatus Get last boot status (Watchdog/POR)\n"); printf(" -f, --file\t\tOpen watchdog device file\n");
printf(" -d, --disable Turn off the watchdog timer\n"); printf("\t\t\tDefault is /dev/watchdog\n");
printf(" -e, --enable Turn on the watchdog timer\n"); printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n");
printf(" -h, --help Print the help message\n"); printf(" -d, --disable\t\tTurn off the watchdog timer\n");
printf(" -p, --pingrate=P Set ping rate to P seconds (default %d)\n", DEFAULT_PING_RATE); printf(" -e, --enable\t\tTurn on the watchdog timer\n");
printf(" -t, --timeout=T Set timeout to T seconds\n"); printf(" -h, --help\t\tPrint the help message\n");
printf(" -T, --gettimeout Get the timeout\n"); printf(" -p, --pingrate=P\tSet ping rate to P seconds (default %d)\n",
printf(" -n, --pretimeout=T Set the pretimeout to T seconds\n"); DEFAULT_PING_RATE);
printf(" -N, --getpretimeout Get the pretimeout\n"); printf(" -t, --timeout=T\tSet timeout to T seconds\n");
printf(" -L, --gettimeleft Get the time left until timer expires\n"); printf(" -T, --gettimeout\tGet the timeout\n");
printf(" -n, --pretimeout=T\tSet the pretimeout to T seconds\n");
printf(" -N, --getpretimeout\tGet the pretimeout\n");
printf(" -L, --gettimeleft\tGet the time left until timer expires\n");
printf("\n"); printf("\n");
printf("Parameters are parsed left-to-right in real-time.\n"); printf("Parameters are parsed left-to-right in real-time.\n");
printf("Example: %s -d -t 10 -p 5 -e\n", progname); printf("Example: %s -d -t 10 -p 5 -e\n", progname);
...@@ -92,14 +96,20 @@ int main(int argc, char *argv[]) ...@@ -92,14 +96,20 @@ int main(int argc, char *argv[])
int ret; int ret;
int c; int c;
int oneshot = 0; int oneshot = 0;
char *file = "/dev/watchdog";
setbuf(stdout, NULL); setbuf(stdout, NULL);
fd = open("/dev/watchdog", O_WRONLY); while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
if (c == 'f')
file = optarg;
}
fd = open(file, O_WRONLY);
if (fd == -1) { if (fd == -1) {
if (errno == ENOENT) if (errno == ENOENT)
printf("Watchdog device not enabled.\n"); printf("Watchdog device (%s) not found.\n", file);
else if (errno == EACCES) else if (errno == EACCES)
printf("Run watchdog as root.\n"); printf("Run watchdog as root.\n");
else else
...@@ -108,6 +118,8 @@ int main(int argc, char *argv[]) ...@@ -108,6 +118,8 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
} }
optind = 0;
while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) { while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
switch (c) { switch (c) {
case 'b': case 'b':
...@@ -190,6 +202,9 @@ int main(int argc, char *argv[]) ...@@ -190,6 +202,9 @@ int main(int argc, char *argv[])
else else
printf("WDIOC_GETTIMELEFT error '%s'\n", strerror(errno)); printf("WDIOC_GETTIMELEFT error '%s'\n", strerror(errno));
break; break;
case 'f':
/* Handled above */
break;
default: default:
usage(argv[0]); usage(argv[0]);
......
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