History log of /linux-master/tools/testing/selftests/timens/Makefile
Revision Date Author Comments
# af4fddff 13-Oct-2022 Andrei Vagin <avagin@gmail.com>

selftests/timens: add a test for vfork+exit

* check that a child process is in parent's time namespace after vfork.
* check that a child process is in the target namespace after exec.

Output on success:
1..4
ok 1 parent before vfork
ok 2 child after exec
ok 3 wait for child
ok 4 parent after vfork
# Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221013173154.291597-1-avagin@google.com


# 2b1e8921 13-Sep-2022 Andrei Vagin <avagin@google.com>

Revert "selftests/timens: add a test for vfork+exit"

The next patch reverts the code that this test verified.

This reverts commit 6342140db6609a0c7d34f68c52b2947468e0e630.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220913102551.1121611-2-avagin@google.com


# 6342140d 13-Jun-2022 Andrei Vagin <avagin@gmail.com>

selftests/timens: add a test for vfork+exit

* check that a child process is in parent's time namespace after vfork.
* check that a child process is in the target namespace after exec.

Output on success:
$ ./vfork_exec
1..1
ok 1 exec

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220613060723.197407-2-avagin@gmail.com


# a4fd8414 15-Oct-2020 Andrei Vagin <avagin@gmail.com>

selftests/timens: Add a test for futex()

Output on success:
1..2
ok 1 futex with the 0 clockid
ok 2 futex with the 1 clockid
# Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201015160020.293748-2-avagin@gmail.com


# 3e839363 12-Feb-2020 Dmitry Safonov <0x7f454c46@gmail.com>

selftests: use LDLIBS for libraries instead of LDFLAGS

While building selftests, the following errors were observed:
> tools/testing/selftests/timens'
> gcc -Wall -Werror -pthread -lrt -ldl timens.c -o tools/testing/selftests/timens/timens
> /usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers':
> timens.c:(.text+0x65a): undefined reference to `timer_create'
> collect2: error: ld returned 1 exit status

Quoting commit 870f193d48c2 ("selftests: net: use LDLIBS instead of
LDFLAGS"):

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

While at here, correct other selftests, not only timens ones.

Reported-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>


# a750c747 11-Nov-2019 Andrei Vagin <avagin@gmail.com>

selftests/timens: Check for right timens offsets after fork and exec

Output on success:
1..1
ok 1 exec
# Pass 1 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

Output on failure:
1..1
not ok 1 36016 16
Bail out!

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

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

Co-developed-by: Dmitry Safonov <dima@arista.com>
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-35-dima@arista.com


# 1854b97e 11-Nov-2019 Andrei Vagin <avagin@gmail.com>

selftests/timens: Add a simple perf test for clock_gettime()

Output on success:
1..4
ok 1 host: clock: monotonic cycles: 148323947
ok 2 host: clock: boottime cycles: 148577503
ok 3 ns: clock: monotonic cycles: 137659217
ok 4 ns: clock: boottime cycles: 137959154
# Pass 4 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

Output with lack of permissions:
1..4
ok 1 host: clock: monotonic cycles: 145671139
ok 2 host: clock: boottime cycles: 146958357
not ok 3 # SKIP need to run as root

Output without support of time namespaces:
1..4
ok 1 host: clock: monotonic cycles: 145671139
ok 2 host: clock: boottime cycles: 146958357
not ok 3 # SKIP Time namespaces are not supported

Co-developed-by: Dmitry Safonov <dima@arista.com>
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-34-dima@arista.com


# d5b0117d 11-Nov-2019 Andrei Vagin <avagin@openvz.org>

selftests/timens: Add timer offsets test

Check that timer_create() takes into account clock offsets.

Output on success:
1..3
ok 1 clockid=7
ok 2 clockid=1
ok 3 clockid=9
# Pass 3 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

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

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

Co-developed-by: Dmitry Safonov <dima@arista.com>
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-33-dima@arista.com


# 9d1f5a8c 11-Nov-2019 Dmitry Safonov <0x7f454c46@gmail.com>

selftests/timens: Add procfs selftest

Check that /proc/uptime is correct inside a new time namespace.

Output on success:
1..1
ok 1 Passed for /proc/uptime
# Pass 1 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

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

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

Co-developed-by: Andrei Vagin <avagin@gmail.com>
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-32-dima@arista.com


# 46e00343 11-Nov-2019 Andrei Vagin <avagin@gmail.com>

selftests/timens: Add a test for clock_nanosleep()

Check that clock_nanosleep() takes into account clock offsets.

Output on success:
1..4
ok 1 clockid: 1 abs:0
ok 2 clockid: 1 abs:1
ok 3 clockid: 9 abs:0
ok 4 clockid: 9 abs:1

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

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

Co-developed-by: Dmitry Safonov <dima@arista.com>
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-31-dima@arista.com


# 11873de3 11-Nov-2019 Andrei Vagin <avagin@gmail.com>

selftests/timens: Add a test for timerfd

Check that timerfd_create() takes into account clock offsets.

Output on success:
1..3
ok 1 clockid=7
ok 2 clockid=1
ok 3 clockid=9
# Pass 3 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

Output on failure:
1..3
not ok 1 clockid: 7 elapsed: 0
not ok 2 clockid: 1 elapsed: 0
not ok 3 clockid: 9 elapsed: 0
Bail out!

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

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

Co-developed-by: Dmitry Safonov <dima@arista.com>
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-30-dima@arista.com


# 61c57676 11-Nov-2019 Dmitry Safonov <0x7f454c46@gmail.com>

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