Skip to content

Commit ce24729

Browse files
committed
Merge tag 'linux-kselftest-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest fixes from Shuah Khan: - lkdtm runner fixes to prevent dmesg clearing and shellcheck errors - ftrace test handling when test module doesn't exist - nsfs test fix to replace zero-length array with flexible-array - dmabuf-heaps test fix to return clear error value * tag 'linux-kselftest-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/lkdtm: Use grep -E instead of egrep selftests/lkdtm: Don't clear dmesg when running tests selftests/ftrace: mark irqsoff_tracer.tc test as unresolved if the test module does not exist tools/testing: Replace zero-length array with flexible-array kselftests: dmabuf-heaps: Fix confused return value on expected error testing
2 parents 67e4562 + 851c4df commit ce24729

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ static int test_alloc_errors(char *heap_name)
351351
}
352352

353353
printf("Expected error checking passed\n");
354+
ret = 0;
354355
out:
355356
if (dmabuf_fd >= 0)
356357
close(dmabuf_fd);

tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ unsup() { #msg
1717
exit_unsupported
1818
}
1919

20-
modprobe $MOD || unsup "$MOD module not available"
20+
unres() { #msg
21+
reset_tracer
22+
rmmod $MOD || true
23+
echo $1
24+
exit_unresolved
25+
}
26+
27+
modprobe $MOD || unres "$MOD module not available"
2128
rmmod $MOD
2229

2330
grep -q "preemptoff" available_tracers || unsup "preemptoff tracer not enabled"

tools/testing/selftests/lkdtm/run.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ fi
2525
# Figure out which test to run from our script name.
2626
test=$(basename $0 .sh)
2727
# Look up details about the test from master list of LKDTM tests.
28-
line=$(egrep '^#?'"$test"'\b' tests.txt)
28+
line=$(grep -E '^#?'"$test"'\b' tests.txt)
2929
if [ -z "$line" ]; then
3030
echo "Skipped: missing test '$test' in tests.txt"
3131
exit $KSELFTEST_SKIP_TEST
3232
fi
3333
# Check that the test is known to LKDTM.
34-
if ! egrep -q '^'"$test"'$' "$TRIGGER" ; then
34+
if ! grep -E -q '^'"$test"'$' "$TRIGGER" ; then
3535
echo "Skipped: test '$test' missing in $TRIGGER!"
3636
exit $KSELFTEST_SKIP_TEST
3737
fi
@@ -59,30 +59,32 @@ if [ -z "$expect" ]; then
5959
expect="call trace:"
6060
fi
6161

62-
# Clear out dmesg for output reporting
63-
dmesg -c >/dev/null
64-
6562
# Prepare log for report checking
66-
LOG=$(mktemp --tmpdir -t lkdtm-XXXXXX)
63+
LOG=$(mktemp --tmpdir -t lkdtm-log-XXXXXX)
64+
DMESG=$(mktemp --tmpdir -t lkdtm-dmesg-XXXXXX)
6765
cleanup() {
68-
rm -f "$LOG"
66+
rm -f "$LOG" "$DMESG"
6967
}
7068
trap cleanup EXIT
7169

70+
# Save existing dmesg so we can detect new content below
71+
dmesg > "$DMESG"
72+
7273
# Most shells yell about signals and we're expecting the "cat" process
7374
# to usually be killed by the kernel. So we have to run it in a sub-shell
7475
# and silence errors.
7576
($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
7677

7778
# Record and dump the results
78-
dmesg -c >"$LOG"
79+
dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true
80+
7981
cat "$LOG"
8082
# Check for expected output
81-
if egrep -qi "$expect" "$LOG" ; then
83+
if grep -E -qi "$expect" "$LOG" ; then
8284
echo "$test: saw '$expect': ok"
8385
exit 0
8486
else
85-
if egrep -qi XFAIL: "$LOG" ; then
87+
if grep -E -qi XFAIL: "$LOG" ; then
8688
echo "$test: saw 'XFAIL': [SKIP]"
8789
exit $KSELFTEST_SKIP_TEST
8890
else

tools/testing/selftests/nsfs/pidns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define __stack_aligned__ __attribute__((aligned(16)))
2828
struct cr_clone_arg {
2929
char stack[128] __stack_aligned__;
30-
char stack_ptr[0];
30+
char stack_ptr[];
3131
};
3232

3333
static int child(void *args)

0 commit comments

Comments
 (0)