selftests/timens: Add Time Namespace test for supported clocks
authorDmitry Safonov <dima@arista.com>
Tue, 12 Nov 2019 01:27:17 +0000 (01:27 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 14 Jan 2020 11:21:00 +0000 (12:21 +0100)
commit61c57676035df29a0a61991f4389e884ba0b68d7
tree3124d5cc777473a03c406deb4c3aa9ffc57e6409
parent04a8682a71becdb639ec9c0d82b315a2baef7a5d
selftests/timens: Add Time Namespace test for supported clocks

A test to check that all supported clocks work on host and inside
a new time namespace. Use both ways to get time: through VDSO and
by entering the kernel with implicit syscall.

Introduce a new timens directory in selftests framework for
the next timens tests.

Output on success:
 1..10
 ok 1 Passed for CLOCK_BOOTTIME (syscall)
 ok 2 Passed for CLOCK_BOOTTIME (vdso)
 ok 3 Passed for CLOCK_BOOTTIME_ALARM (syscall)
 ok 4 Passed for CLOCK_BOOTTIME_ALARM (vdso)
 ok 5 Passed for CLOCK_MONOTONIC (syscall)
 ok 6 Passed for CLOCK_MONOTONIC (vdso)
 ok 7 Passed for CLOCK_MONOTONIC_COARSE (syscall)
 ok 8 Passed for CLOCK_MONOTONIC_COARSE (vdso)
 ok 9 Passed for CLOCK_MONOTONIC_RAW (syscall)
 ok 10 Passed for CLOCK_MONOTONIC_RAW (vdso)
 # Pass 10 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

Output with lack of permissions:
 1..10
 not ok 1 # SKIP need to run as root

Output without support of time namespaces:
 1..10
 not ok 1 # SKIP Time namespaces are not supported

Co-developed-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20191112012724.250792-29-dima@arista.com
tools/testing/selftests/Makefile
tools/testing/selftests/timens/.gitignore [new file with mode: 0644]
tools/testing/selftests/timens/Makefile [new file with mode: 0644]
tools/testing/selftests/timens/config [new file with mode: 0644]
tools/testing/selftests/timens/log.h [new file with mode: 0644]
tools/testing/selftests/timens/timens.c [new file with mode: 0644]
tools/testing/selftests/timens/timens.h [new file with mode: 0644]