Skip to content

Commit 797a324

Browse files
committed
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"
2 parents 972a2bf + 721cb3c commit 797a324

File tree

6 files changed

+48
-26
lines changed

6 files changed

+48
-26
lines changed

tools/testing/selftests/Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,45 +126,45 @@ endif
126126
# in the default INSTALL_HDR_PATH usr/include.
127127
khdr:
128128
ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
129-
make --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
129+
$(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
130130
else
131-
make --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
131+
$(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
132132
ARCH=$(ARCH) -C $(top_srcdir) headers_install
133133
endif
134134

135135
all: khdr
136136
@for TARGET in $(TARGETS); do \
137137
BUILD_TARGET=$$BUILD/$$TARGET; \
138138
mkdir $$BUILD_TARGET -p; \
139-
make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
139+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
140140
done;
141141

142142
run_tests: all
143143
@for TARGET in $(TARGETS); do \
144144
BUILD_TARGET=$$BUILD/$$TARGET; \
145-
make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
145+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
146146
done;
147147

148148
hotplug:
149149
@for TARGET in $(TARGETS_HOTPLUG); do \
150150
BUILD_TARGET=$$BUILD/$$TARGET; \
151-
make OUTPUT=$$BUILD_TARGET -C $$TARGET;\
151+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
152152
done;
153153

154154
run_hotplug: hotplug
155155
@for TARGET in $(TARGETS_HOTPLUG); do \
156156
BUILD_TARGET=$$BUILD/$$TARGET; \
157-
make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
157+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
158158
done;
159159

160160
clean_hotplug:
161161
@for TARGET in $(TARGETS_HOTPLUG); do \
162162
BUILD_TARGET=$$BUILD/$$TARGET; \
163-
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
163+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
164164
done;
165165

166166
run_pstore_crash:
167-
make -C pstore run_crash
167+
$(MAKE) -C pstore run_crash
168168

169169
# Use $BUILD as the default install root. $BUILD points to the
170170
# right output location for the following cases:
@@ -184,7 +184,7 @@ ifdef INSTALL_PATH
184184
install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
185185
@for TARGET in $(TARGETS); do \
186186
BUILD_TARGET=$$BUILD/$$TARGET; \
187-
make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
187+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
188188
done;
189189

190190
@# Ask all targets to emit their test scripts
@@ -203,7 +203,7 @@ ifdef INSTALL_PATH
203203
echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
204204
echo "cd $$TARGET" >> $(ALL_SCRIPT); \
205205
echo -n "run_many" >> $(ALL_SCRIPT); \
206-
make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
206+
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
207207
echo "" >> $(ALL_SCRIPT); \
208208
echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
209209
done;
@@ -216,7 +216,7 @@ endif
216216
clean:
217217
@for TARGET in $(TARGETS); do \
218218
BUILD_TARGET=$$BUILD/$$TARGET; \
219-
make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
219+
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
220220
done;
221221

222222
.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean

tools/testing/selftests/ftrace/test.d/trigger/trigger-snapshot.tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if [ -z "$FEATURE" ]; then
2828
exit_unsupported
2929
fi
3030

31-
echo "Test snapshot tigger"
31+
echo "Test snapshot trigger"
3232
echo 0 > snapshot
3333
echo 1 > events/sched/sched_process_fork/enable
3434
( echo "forked")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
CONFIG_LIVEPATCH=y
2+
CONFIG_DYNAMIC_DEBUG=y
13
CONFIG_TEST_LIVEPATCH=m

tools/testing/selftests/seccomp/seccomp_bpf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ struct seccomp_notif_sizes {
199199
};
200200
#endif
201201

202+
#ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY
203+
#define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
204+
#define PTRACE_EVENTMSG_SYSCALL_EXIT 2
205+
#endif
206+
202207
#ifndef seccomp
203208
int seccomp(unsigned int op, unsigned int flags, void *args)
204209
{

tools/testing/selftests/tpm2/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
include ../lib.mk
33

44
TEST_PROGS := test_smoke.sh test_space.sh
5-
TEST_FILES := tpm2.py tpm2_tests.py
5+
TEST_PROGS_EXTENDED := tpm2.py tpm2_tests.py

tools/testing/selftests/watchdog/watchdog-test.c

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
int fd;
2121
const char v = 'V';
22-
static const char sopts[] = "bdehp:t:Tn:NL";
22+
static const char sopts[] = "bdehp:t:Tn:NLf:";
2323
static const struct option lopts[] = {
2424
{"bootstatus", no_argument, NULL, 'b'},
2525
{"disable", no_argument, NULL, 'd'},
@@ -31,6 +31,7 @@ static const struct option lopts[] = {
3131
{"pretimeout", required_argument, NULL, 'n'},
3232
{"getpretimeout", no_argument, NULL, 'N'},
3333
{"gettimeleft", no_argument, NULL, 'L'},
34+
{"file", required_argument, NULL, 'f'},
3435
{NULL, no_argument, NULL, 0x0}
3536
};
3637

@@ -69,16 +70,19 @@ static void term(int sig)
6970
static void usage(char *progname)
7071
{
7172
printf("Usage: %s [options]\n", progname);
72-
printf(" -b, --bootstatus Get last boot status (Watchdog/POR)\n");
73-
printf(" -d, --disable Turn off the watchdog timer\n");
74-
printf(" -e, --enable Turn on the watchdog timer\n");
75-
printf(" -h, --help Print the help message\n");
76-
printf(" -p, --pingrate=P Set ping rate to P seconds (default %d)\n", DEFAULT_PING_RATE);
77-
printf(" -t, --timeout=T Set timeout to T seconds\n");
78-
printf(" -T, --gettimeout Get the timeout\n");
79-
printf(" -n, --pretimeout=T Set the pretimeout to T seconds\n");
80-
printf(" -N, --getpretimeout Get the pretimeout\n");
81-
printf(" -L, --gettimeleft Get the time left until timer expires\n");
73+
printf(" -f, --file\t\tOpen watchdog device file\n");
74+
printf("\t\t\tDefault is /dev/watchdog\n");
75+
printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n");
76+
printf(" -d, --disable\t\tTurn off the watchdog timer\n");
77+
printf(" -e, --enable\t\tTurn on the watchdog timer\n");
78+
printf(" -h, --help\t\tPrint the help message\n");
79+
printf(" -p, --pingrate=P\tSet ping rate to P seconds (default %d)\n",
80+
DEFAULT_PING_RATE);
81+
printf(" -t, --timeout=T\tSet timeout to T seconds\n");
82+
printf(" -T, --gettimeout\tGet the timeout\n");
83+
printf(" -n, --pretimeout=T\tSet the pretimeout to T seconds\n");
84+
printf(" -N, --getpretimeout\tGet the pretimeout\n");
85+
printf(" -L, --gettimeleft\tGet the time left until timer expires\n");
8286
printf("\n");
8387
printf("Parameters are parsed left-to-right in real-time.\n");
8488
printf("Example: %s -d -t 10 -p 5 -e\n", progname);
@@ -92,14 +96,20 @@ int main(int argc, char *argv[])
9296
int ret;
9397
int c;
9498
int oneshot = 0;
99+
char *file = "/dev/watchdog";
95100

96101
setbuf(stdout, NULL);
97102

98-
fd = open("/dev/watchdog", O_WRONLY);
103+
while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
104+
if (c == 'f')
105+
file = optarg;
106+
}
107+
108+
fd = open(file, O_WRONLY);
99109

100110
if (fd == -1) {
101111
if (errno == ENOENT)
102-
printf("Watchdog device not enabled.\n");
112+
printf("Watchdog device (%s) not found.\n", file);
103113
else if (errno == EACCES)
104114
printf("Run watchdog as root.\n");
105115
else
@@ -108,6 +118,8 @@ int main(int argc, char *argv[])
108118
exit(-1);
109119
}
110120

121+
optind = 0;
122+
111123
while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
112124
switch (c) {
113125
case 'b':
@@ -190,6 +202,9 @@ int main(int argc, char *argv[])
190202
else
191203
printf("WDIOC_GETTIMELEFT error '%s'\n", strerror(errno));
192204
break;
205+
case 'f':
206+
/* Handled above */
207+
break;
193208

194209
default:
195210
usage(argv[0]);

0 commit comments

Comments
 (0)