Hi Linus,
Please pull the following Kselftest update for Linux 4.21-rc1.
This Kselftest update for Linux 4.21-rc1 consists of:
- fixes, and improvements to the framework, and individual tests.
- a new media test for IR encoders from Sean Young.
- a new watchdog test option to find time left on a timer.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a:
Linux 4.20-rc1 (2018-11-04 15:37:52 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
tags/linux-kselftest-4.21-rc1
for you to fetch changes up to 283ac6d5fb2a47f12bcef7806b78acf6ad89907e:
selftests: Fix test errors related to lib.mk khdr target (2018-12-17
09:17:55 -0700)
----------------------------------------------------------------
linux-kselftest-4.21-rc1
This Kselftest update for Linux 4.21-rc1 consists of:
- fixes, and improvements to the framework, and individual tests.
- a new media test for IR encoders from Sean Young.
- a new watchdog test option to find time left on a timer.
----------------------------------------------------------------
Colin Ian King (1):
selftests: watchdog: fix spelling mistake "experies" -> "expires"
Dan Rue (2):
selftests: firmware: remove use of non-standard diff -Z option
selftests: firmware: add CONFIG_FW_LOADER_USER_HELPER_FALLBACK to
config
Daniel Díaz (1):
selftests: gpio: Find libmount with pkg-config if available
Dmitry V. Levin (1):
selftests: do not macro-expand failed assertion expressions
Jerry Hoemann (1):
selftests: watchdog: Add gettimeleft command line arg
Sean Young (1):
media: rc: self test for IR encoders and decoders
Shuah Khan (1):
selftests: Fix test errors related to lib.mk khdr target
Thomas Gleixner (1):
selftests/ftrace: Fix invalid SPDX identifiers
Tom Murphy (1):
fix dma-buf/udmabuf selftest
tools/testing/selftests/Makefile | 2 +
tools/testing/selftests/android/Makefile | 2 +-
tools/testing/selftests/drivers/dma-buf/Makefile | 2 +
tools/testing/selftests/drivers/dma-buf/udmabuf.c | 11 +-
tools/testing/selftests/firmware/config | 1 +
tools/testing/selftests/firmware/fw_filesystem.sh | 9 +-
.../ftrace/test.d/ftrace/func-filter-stacktrace.tc | 2 +-
.../selftests/ftrace/test.d/ftrace/func_cpumask.tc | 2 +-
tools/testing/selftests/ftrace/test.d/template | 2 +-
.../selftests/ftrace/test.d/tracer/wakeup.tc | 2 +-
.../selftests/ftrace/test.d/tracer/wakeup_rt.tc | 2 +-
tools/testing/selftests/futex/functional/Makefile | 1 +
tools/testing/selftests/gpio/Makefile | 16 +-
tools/testing/selftests/ir/.gitignore | 1 +
tools/testing/selftests/ir/Makefile | 5 +
tools/testing/selftests/ir/ir_loopback.c | 199
+++++++++++++++++++++
tools/testing/selftests/ir/ir_loopback.sh | 20 +++
tools/testing/selftests/kselftest_harness.h | 42 ++---
tools/testing/selftests/kvm/Makefile | 2 +-
tools/testing/selftests/lib.mk | 8 +-
.../selftests/networking/timestamping/Makefile | 1 +
tools/testing/selftests/tc-testing/bpf/Makefile | 1 +
tools/testing/selftests/vm/Makefile | 1 +
tools/testing/selftests/watchdog/watchdog-test.c | 13 +-
24 files changed, 301 insertions(+), 46 deletions(-)
create mode 100644 tools/testing/selftests/ir/.gitignore
create mode 100644 tools/testing/selftests/ir/Makefile
create mode 100644 tools/testing/selftests/ir/ir_loopback.c
create mode 100755 tools/testing/selftests/ir/ir_loopback.sh
----------------------------------------------------------------
At present this exposes a bug in do_proc_dointvec_minmax_conv() (it
fails to check for values that are too wide to fit in an int).
Signed-off-by: Zev Weiss <zev(a)bewilderbeest.net>
---
tools/testing/selftests/sysctl/sysctl.sh | 37 ++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh
index 584eb8ea780a..a7d0da25975c 100755
--- a/tools/testing/selftests/sysctl/sysctl.sh
+++ b/tools/testing/selftests/sysctl/sysctl.sh
@@ -290,6 +290,40 @@ run_numerictests()
test_rc
}
+check_failure()
+{
+ echo -n "Testing that $1 fails as expected..."
+ reset_vals
+ TEST_STR="$1"
+ orig="$(cat $TARGET)"
+ echo -n "$TEST_STR" > $TARGET 2> /dev/null
+
+ # write should fail and $TARGET should retain its original value
+ if [ $? = 0 ] || [ "$(cat $TARGET)" != "$orig" ]; then
+ echo "FAIL" >&2
+ rc=1
+ else
+ echo "ok"
+ fi
+ test_rc
+}
+
+run_wideint_tests()
+{
+ # check negative and positive 64-bit values, with and without
+ # bits set in the lower 31, and with and without bit 31 (sign
+ # bit of a 32-bit int) set. None of these are representable
+ # in 32 bits, and hence all should fail.
+ check_failure 0x0000010000000000
+ check_failure 0x0000010080000000
+ check_failure 0x000001ff7fffffff
+ check_failure 0x000001ffffffffff
+ check_failure 0xffffffff7fffffff
+ check_failure 0xffffffffffffffff
+ check_failure 0xffffff0000000000
+ check_failure 0xffffff0080000000
+}
+
# Your test must accept digits 3 and 4 to use this
run_limit_digit()
{
@@ -556,6 +590,7 @@ sysctl_test_0001()
TEST_STR=$(( $ORIG + 1 ))
run_numerictests
+ run_wideint_tests
run_limit_digit
}
@@ -580,6 +615,7 @@ sysctl_test_0003()
TEST_STR=$(( $ORIG + 1 ))
run_numerictests
+ run_wideint_tests
run_limit_digit
run_limit_digit_int
}
@@ -592,6 +628,7 @@ sysctl_test_0004()
TEST_STR=$(( $ORIG + 1 ))
run_numerictests
+ run_wideint_tests
run_limit_digit
run_limit_digit_uint
}
--
2.20.1
Test files created by test_create*() tests will stay in the $efivarfs_mount
directory until next reboot.
When the tester tries to run this efivarfs test again on the same system, the
immutable characteristics in that directory with those previously generated
files will cause some "Permission denied" noises and a false-positive test
result to the test_create_read() test.
Remove those test files in the end of each test to solve this issue.
Link: https://bugs.launchpad.net/bugs/1809704
Signed-off-by: Po-Hsu Lin <po-hsu.lin(a)canonical.com>
---
tools/testing/selftests/efivarfs/efivarfs.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh
index a47029a..ea2e2a0 100755
--- a/tools/testing/selftests/efivarfs/efivarfs.sh
+++ b/tools/testing/selftests/efivarfs/efivarfs.sh
@@ -60,6 +60,12 @@ test_create()
echo "$file has invalid size" >&2
exit 1
fi
+
+ rm $file 2>/dev/null
+ if [ $? -ne 0 ]; then
+ chattr -i $file
+ rm $file
+ fi
}
test_create_empty()
@@ -72,12 +78,24 @@ test_create_empty()
echo "$file can not be created without writing" >&2
exit 1
fi
+
+ rm $file 2>/dev/null
+ if [ $? -ne 0 ]; then
+ chattr -i $file
+ rm $file
+ fi
}
test_create_read()
{
local file=$efivarfs_mount/$FUNCNAME-$test_guid
./create-read $file
+
+ rm $file 2>/dev/null
+ if [ $? -ne 0 ]; then
+ chattr -i $file
+ rm $file
+ fi
}
test_delete()
--
2.7.4
Hi Sean,
I started to see compile errors on ir test. Could you please take a look
and see if you can fix them.
ir_loopback.c:32:16: error: field ‘proto’ has incomplete type
enum rc_proto proto;
^~~~~
ir_loopback.c:37:4: error: ‘RC_PROTO_RC5’ undeclared here (not in a
function)
{ RC_PROTO_RC5, "rc-5", 0x1f7f, "rc-5" },
^~~~~~~~~~~~
ir_loopback.c:38:4: error: ‘RC_PROTO_RC5X_20’ undeclared here (not in a
function); did you mean ‘RC_PROTO_RC5’?
{ RC_PROTO_RC5X_20, "rc-5x-20", 0x1f7f3f, "rc-5" },
^~~~~~~~~~~~~~~~
RC_PROTO_RC5
ir_loopback.c:39:4: error: ‘RC_PROTO_RC5_SZ’ undeclared here (not in a
function); did you mean ‘RC_PROTO_RC5X_20’?
{ RC_PROTO_RC5_SZ, "rc-5-sz", 0x2fff, "rc-5-sz" },
^~~~~~~~~~~~~~~
RC_PROTO_RC5X_20
ir_loopback.c:40:4: error: ‘RC_PROTO_JVC’ undeclared here (not in a
function); did you mean ‘RC_PROTO_RC5’?
{ RC_PROTO_JVC, "jvc", 0xffff, "jvc" },
^~~~~~~~~~~~
RC_PROTO_RC5
ir_loopback.c:41:4: error: ‘RC_PROTO_SONY12’ undeclared here (not in a
function); did you mean ‘RC_PROTO_JVC’?
{ RC_PROTO_SONY12, "sony-12", 0x1f007f, "sony" },
^~~~~~~~~~~~~~~
RC_PROTO_JVC
ir_loopback.c:42:4: error: ‘RC_PROTO_SONY15’ undeclared here (not in a
function); did you mean ‘RC_PROTO_SONY12’?
{ RC_PROTO_SONY15, "sony-15", 0xff007f, "sony" },
^~~~~~~~~~~~~~~
RC_PROTO_SONY12
ir_loopback.c:43:4: error: ‘RC_PROTO_SONY20’ undeclared here (not in a
function); did you mean ‘RC_PROTO_SONY15’?
{ RC_PROTO_SONY20, "sony-20", 0x1fff7f, "sony" },
^~~~~~~~~~~~~~~
RC_PROTO_SONY15
ir_loopback.c:44:4: error: ‘RC_PROTO_NEC’ undeclared here (not in a
function); did you mean ‘RC_PROTO_JVC’?
{ RC_PROTO_NEC, "nec", 0xffff, "nec" },
^~~~~~~~~~~~
RC_PROTO_JVC
ir_loopback.c:45:4: error: ‘RC_PROTO_NECX’ undeclared here (not in a
function); did you mean ‘RC_PROTO_NEC’?
{ RC_PROTO_NECX, "nec-x", 0xffffff, "nec" },
^~~~~~~~~~~~~
RC_PROTO_NEC
ir_loopback.c:46:4: error: ‘RC_PROTO_NEC32’ undeclared here (not in a
function); did you mean ‘RC_PROTO_NECX’?
{ RC_PROTO_NEC32, "nec-32", 0xffffffff, "nec" },
^~~~~~~~~~~~~~
RC_PROTO_NECX
ir_loopback.c:47:4: error: ‘RC_PROTO_SANYO’ undeclared here (not in a
function); did you mean ‘RC_PROTO_SONY20’?
{ RC_PROTO_SANYO, "sanyo", 0x1fffff, "sanyo" },
^~~~~~~~~~~~~~
RC_PROTO_SONY20
ir_loopback.c:48:4: error: ‘RC_PROTO_RC6_0’ undeclared here (not in a
function); did you mean ‘RC_PROTO_RC5_SZ’?
{ RC_PROTO_RC6_0, "rc-6-0", 0xffff, "rc-6" },
^~~~~~~~~~~~~~
RC_PROTO_RC5_SZ
ir_loopback.c:49:4: error: ‘RC_PROTO_RC6_6A_20’ undeclared here (not in
a function); did you mean ‘RC_PROTO_RC6_0’?
{ RC_PROTO_RC6_6A_20, "rc-6-6a-20", 0xfffff, "rc-6" },
^~~~~~~~~~~~~~~~~~
RC_PROTO_RC6_0
ir_loopback.c:50:4: error: ‘RC_PROTO_RC6_6A_24’ undeclared here (not in
a function); did you mean ‘RC_PROTO_RC6_6A_20’?
{ RC_PROTO_RC6_6A_24, "rc-6-6a-24", 0xffffff, "rc-6" },
^~~~~~~~~~~~~~~~~~
RC_PROTO_RC6_6A_20
ir_loopback.c:51:4: error: ‘RC_PROTO_RC6_6A_32’ undeclared here (not in
a function); did you mean ‘RC_PROTO_RC6_6A_24’?
{ RC_PROTO_RC6_6A_32, "rc-6-6a-32", 0xffffffff, "rc-6" },
^~~~~~~~~~~~~~~~~~
RC_PROTO_RC6_6A_24
ir_loopback.c:52:4: error: ‘RC_PROTO_RC6_MCE’ undeclared here (not in a
function); did you mean ‘RC_PROTO_RC6_0’?
{ RC_PROTO_RC6_MCE, "rc-6-mce", 0x00007fff, "rc-6" },
^~~~~~~~~~~~~~~~
RC_PROTO_RC6_0
ir_loopback.c:53:4: error: ‘RC_PROTO_SHARP’ undeclared here (not in a
function); did you mean ‘RC_PROTO_SANYO’?
{ RC_PROTO_SHARP, "sharp", 0x1fff, "sharp" },
^~~~~~~~~~~~~~
RC_PROTO_SANYO
ir_loopback.c: In function ‘main’:
ir_loopback.c:101:9: error: ‘LIRC_MODE_SCANCODE’ undeclared (first use
in this function); did you mean ‘LIRC_MODE_LIRCCODE’?
mode = LIRC_MODE_SCANCODE;
^~~~~~~~~~~~~~~~~~
LIRC_MODE_LIRCCODE
ir_loopback.c:101:9: note: each undeclared identifier is reported only
once for each function it appears in
thanks,
-- Shuah
If the cgroup destruction races with an exit() of a belonging
process(es), cg_kill_all() may fail. It's not a good reason to make
cg_destroy() fail and leave the cgroup in place, potentially causing
next test runs to fail.
Signed-off-by: Roman Gushchin <guro(a)fb.com>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: Tejun Heo <tj(a)kernel.org>
Cc: kernel-team(a)fb.com
Cc: linux-kselftest(a)vger.kernel.org
---
tools/testing/selftests/cgroup/cgroup_util.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index 14c9fe284806..eba06f94433b 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -227,9 +227,7 @@ int cg_destroy(const char *cgroup)
retry:
ret = rmdir(cgroup);
if (ret && errno == EBUSY) {
- ret = cg_killall(cgroup);
- if (ret)
- return ret;
+ cg_killall(cgroup);
usleep(100);
goto retry;
}
--
2.19.2
Shuah,
I was recently investigating some errors coming out of our functional
tests and we, Dan and I, came up with a discussion that might not be new
for you, but, interests us, in defining how to better use kselftests as
a regression mechanism/tool in our LKFT (https://lkft.linaro.org).
David / Willem,
I'm only using udpgso as an example for what I'd like to ask Shuah. Feel
free to jump in in the discussion if you think its worth.
All,
Regarding: udpgso AND https://bugs.linaro.org/show_bug.cgi?id=3980
udpgso tests are failing in kernels bellow 4.18 because of 2 main reasons:
1) udp4_ufo_fragment does not seem to demand the GSO SKB to be > than
the MTU for older kernels (4th test case in udpgso.c).
2) setsockopt(...UDP_SEGMENT) support is not present for older kernels.
(commits "udp: generate gso with UDP_SEGMENT" and its fixes seem to be
needed).
With that explained, finally the question/discussion:
Shouldn't we enforce a versioning mechanism for tests that are testing
recently added features ? I mean, some of the tests inside udpgso
selftest are good enough for older kernels...
But, because we have no control over "kernel features" and "supported
test cases", we, Linaro, have to end up blacklisting all selftests that
have new feature oriented tests, because one or two test cases only.
This has already been solved in other functional tests projects:
allowing to check the running kernel version and deciding which test
cases to run.
Would that be something we should pursue ? (We could try to make patches
here and there, like this case, whenever we face this). Or... should we
stick with mainline/next only when talking about kselftest and forget
about LTS kernels ?
OBS: Situations like this are very time consuming before we can tell if
there was a regression or the older kernel did not support the test case.
Thank you for the attention.
Rafael
--
Rafael D. Tinoco
Linaro - Kernel Validation