Skip to contentSkip to conversation

Add basic time namespace testcases

PATCH New Cyril Hrubis 3 participants 16 messages Mar 18, 2020 – Mar 30, 2020 Library code

lore
Share & tools
lore
#0 lore raw

v2 cover Add basic time namespace testcases

This is a set of test for the time namespaces that are going to be part of 5.6 kernel.

v2:

* Added git has into sysinfo03, as requested by ritchie

* Included description for the timens01 test as requsted by ritchie

* Added SAFE_NETNS() which fixed compilation problems reported by pvorel as well

Cyril Hrubis (9):
lapi/namespace_constants.h: Add CLONE_NEWTIME
lapi: Add a configure check and fallback for setns
safe_macros: Add SAFE_SETNS() include/tst_timer: Fix normalization syscalls/sysinfo03: Add time namespace test syscalls/clock_nanosleep03: Add test for time namespace syscalls/clock_gettime03: Add basic time namespace test containers/timens: Add basic error test syscalls/timerfd04: Add time namespace test

 configure.ac                                  |   1 +
 include/lapi/namespaces_constants.h           |   3 +
 include/lapi/setns.h                          |  20 ++++
 include/tst_safe_macros.h                     |   4 +
 include/tst_timer.h                           |  35 +++---
 lib/tst_safe_macros.c                         |  12 ++
 runtest/containers                            |   7 ++
 runtest/syscalls                              |   4 +
 testcases/kernel/containers/timens/.gitignore |   1 +
 testcases/kernel/containers/timens/Makefile   |   6 +
 testcases/kernel/containers/timens/timens01.c |  68 +++++++++++
 .../kernel/syscalls/clock_gettime/.gitignore  |   1 +
 .../syscalls/clock_gettime/clock_gettime03.c  | 112 ++++++++++++++++++
 .../syscalls/clock_nanosleep/.gitignore       |   1 +
 .../clock_nanosleep/clock_nanosleep03.c       |  71 +++++++++++
 testcases/kernel/syscalls/sysinfo/.gitignore  |   1 +
 testcases/kernel/syscalls/sysinfo/sysinfo03.c |  81 +++++++++++++
 testcases/kernel/syscalls/timerfd/.gitignore  |   1 +
 testcases/kernel/syscalls/timerfd/timerfd04.c |  98 +++++++++++++++
 19 files changed, 510 insertions(+), 17 deletions(-)
 create mode 100644 include/lapi/setns.h
 create mode 100644 testcases/kernel/containers/timens/.gitignore
 create mode 100644 testcases/kernel/containers/timens/Makefile
 create mode 100644 testcases/kernel/containers/timens/timens01.c
 create mode 100644 testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
 create mode 100644 testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
 create mode 100644 testcases/kernel/syscalls/sysinfo/sysinfo03.c
 create mode 100644 testcases/kernel/syscalls/timerfd/timerfd04.c
Signature · 1 line
2.24.1
#1 lore raw

PATCH v2 1/9 lapi/namespace_constants.h: Add CLONE_NEWTIME

---
 include/lapi/namespaces_constants.h | 3 +++
 1 file changed, 3 insertions(+)
include/lapi/namespaces_constants.h +3 -0
index da4a7a4a1..8f73c4302 100644
@@ -24,5 +24,8 @@
 #ifndef CLONE_NEWUTS
 #  define CLONE_NEWUTS	0x04000000
 #endif
+#ifndef CLONE_NEWTIME
+#  define CLONE_NEWTIME 0x00000080
+#endif
 
 #endif /* __NAMESPACES_CONSTANTS_H__ */
Signature · 1 line
2.24.1
#2 lore raw

PATCH v2 2/9 lapi: Add a configure check and fallback for setns

In reply to Cyril Hrubis
---
 configure.ac         |  1 +
 include/lapi/setns.h | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 include/lapi/setns.h
configure.ac +1 -0
index 238d1cde8..ce03b3a55 100644
@@ -111,6 +111,7 @@ AC_CHECK_FUNCS([ \
     renameat2 \
     sched_getcpu \
     sendmmsg \
+    setns \
     sigpending \
     splice \
     statx \
include/lapi/setns.h new file +20 -0
new file mode 100644
index 000000000..7b0a7afc4
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+  Copyright (c) 2020 Cyril Hrubis <[email protected]>
+ */
+
+#ifndef LAPI_SETNS_H__
+#define LAPI_SETNS_H__
+
+#include "config.h"
+#include "lapi/syscalls.h"
+#include <sched.h>
+
+#ifndef HAVE_SETNS
+int setns(int fd, int nstype)
+{
+	return tst_syscall(__NR_setns, fd, nstype);
+}
+#endif
+
+#endif /* LAPI_SETNS_H__ */
Signature · 1 line
2.24.1
#3 lore raw

PATCH v2 3/9 safe_macros: Add SAFE_SETNS()

In reply to Cyril Hrubis

From: Cyril Hrubis <[email protected]>

---
 include/tst_safe_macros.h |  4 ++++
 lib/tst_safe_macros.c     | 12 ++++++++++++
 2 files changed, 16 insertions(+)
include/tst_safe_macros.h +4 -0
index 80c4d9cb9..291f2a722 100644
@@ -547,4 +547,8 @@ int safe_personality(const char *filename, unsigned int lineno,
 void safe_unshare(const char *file, const int lineno, int flags);
 #define SAFE_UNSHARE(flags) safe_unshare(__FILE__, __LINE__, (flags))
 
+
+void safe_setns(const char *file, const int lineno, int fd, int nstype);
+#define SAFE_SETNS(fd, nstype) safe_setns(__FILE__, __LINE__, (fd), (nstype));
+
 #endif /* SAFE_MACROS_H__ */
lib/tst_safe_macros.c +12 -0
index f5413a18e..353ef5b1d 100644
@@ -6,6 +6,7 @@
 #define _GNU_SOURCE
 #include <unistd.h>
 #include <errno.h>
+#include "lapi/setns.h"
 #include <sched.h>
 #include "config.h"
 #ifdef HAVE_SYS_FANOTIFY_H
@@ -202,3 +203,14 @@ void safe_unshare(const char *file, const int lineno, int flags)
 		}
 	}
 }
+
+void safe_setns(const char *file, const int lineno, int fd, int nstype)
+{
+	int ret;
+
+	ret = setns(fd, nstype);
+	if (ret == -1) {
+		tst_brk_(file, lineno, TBROK | TERRNO, "setns(%i, %i) failed",
+		         fd, nstype);
+	}
+}
Signature · 1 line
2.24.1
#4 lore raw

PATCH v2 3/9 safe_macros: Add SAFE_SETNS()

Hi Cyril,

...

lib/tst_safe_macros.c line 9

Quoted 9 lines
lib/tst_safe_macros.c +1 -0
index f5413a18e..353ef5b1d 100644
@@ -6,6 +6,7 @@
 #define _GNU_SOURCE
 #include <unistd.h>
 #include <errno.h>
+#include "lapi/setns.h"

One more fix needed: lapi file needs to be loaded later:

tst_safe_macros.c +1 -1
index 353ef5b1d..7d33f2b79 100644
@@ -6,7 +6,6 @@
 #define _GNU_SOURCE
 #include <unistd.h>
 #include <errno.h>
-#include "lapi/setns.h"
 #include <sched.h>
 #include "config.h"
 #ifdef HAVE_SYS_FANOTIFY_H
@@ -14,6 +13,7 @@
 #endif
 #define TST_NO_DEFAULT_MAIN
 #include "tst_test.h"
+#include "lapi/setns.h"
 #include "tst_safe_macros.h"
 #include "lapi/personality.h"
 

to prevent failure:
In file included from /usr/src/ltp/lib/tst_safe_macros.c:9:
/usr/src/ltp/include/lapi/setns.h: In function 'setns':
/usr/src/ltp/include/lapi/setns.h:16: error: implicit declaration of function 'tst_brk' /usr/src/ltp/include/lapi/setns.h:16: error: 'TCONF' undeclared (first use in this function) /usr/src/ltp/include/lapi/setns.h:16: error: (Each undeclared identifier is reported only once

The rest of the patchset looks ok to me:

Kind regards,
Petr

#5 lore raw

PATCH v2 3/9 safe_macros: Add SAFE_SETNS()

Hi!
I've fixed up problems pointed out by you and Li and pushed.

Peter, Li thanks a lot for the review.

Signature · 2 lines
Cyril Hrubis
[email protected]
#6 lore raw

PATCH v2 4/9 include/tst_timer: Fix normalization

In reply to Cyril Hrubis

The timespec_add and timespec_sub functions were producing incorrect results when passed negative input. We have to normalize the result in both cases for nseconds < 0 && nseconds > 1s.

---
 include/tst_timer.h | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
include/tst_timer.h +18 -17
index de60bc62a..b091137dc 100644
@@ -134,6 +134,21 @@ static inline int tst_timespec_lt(struct timespec t1, struct timespec t2)
 	return t1.tv_sec < t2.tv_sec;
 }
 
+static inline struct timespec tst_timespec_normalize(struct timespec t)
+{
+	if (t.tv_nsec >= 1000000000) {
+		t.tv_sec++;
+		t.tv_nsec -= 1000000000;
+	}
+
+	if (t.tv_nsec < 0) {
+		t.tv_sec--;
+		t.tv_nsec += 1000000000;
+	}
+
+	return t;
+}
+
 /*
  * Adds us microseconds to t.
  */
@@ -143,12 +158,8 @@ static inline struct timespec tst_timespec_add_us(struct timespec t,
 	t.tv_sec += us / 1000000;
 	t.tv_nsec += (us % 1000000) * 1000;
 
-	if (t.tv_nsec >= 1000000000) {
-		t.tv_sec++;
-		t.tv_nsec -= 1000000000;
-	}
 
-	return t;
+	return tst_timespec_normalize(t);
 }
 
 /*
@@ -162,12 +173,7 @@ static inline struct timespec tst_timespec_add(struct timespec t1,
 	res.tv_sec = t1.tv_sec + t2.tv_sec;
 	res.tv_nsec = t1.tv_nsec + t2.tv_nsec;
 
-	if (res.tv_nsec >= 1000000000) {
-		res.tv_sec++;
-		res.tv_nsec -= 1000000000;
-	}
-
-	return res;
+	return tst_timespec_normalize(res);
 }
 
 /*
@@ -179,12 +185,7 @@ static inline struct timespec tst_timespec_sub_us(struct timespec t,
 	t.tv_sec -= us / 1000000;
 	t.tv_nsec -= (us % 1000000) * 1000;
 
-	if (t.tv_nsec < 0) {
-		t.tv_sec--;
-		t.tv_nsec += 1000000000;
-	}
-
-	return t;
+	return tst_timespec_normalize(t);
 }
 
 /*
Signature · 1 line
2.24.1
#7 lore raw

PATCH v2 5/9 syscalls/sysinfo03: Add time namespace test

In reply to Cyril Hrubis

This tests that the uptime in sysinfo() is adjusted correctly by the namespace offset.

Also check that /proc/uptime is consistent with the uptime from the sysinfo() syscall.

---
 runtest/containers                            |  3 +
 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/sysinfo/.gitignore  |  1 +
 testcases/kernel/syscalls/sysinfo/sysinfo03.c | 81 +++++++++++++++++++
 4 files changed, 86 insertions(+)
 create mode 100644 testcases/kernel/syscalls/sysinfo/sysinfo03.c
runtest/containers +3 -0
index 871cd2a42..4dc05af93 100644
@@ -85,3 +85,6 @@ userns04 userns04
 userns05 userns05
 userns06 userns06
 userns07 userns07
+
+# time namespaces
+sysinfo03 sysinfo03
runtest/syscalls +1 -0
index 6f2dcd82a..fb0b9e539 100644
@@ -1465,6 +1465,7 @@ sysfs06 sysfs06
 
 sysinfo01 sysinfo01
 sysinfo02 sysinfo02
+sysinfo03 sysinfo03
 
 syslog01 syslog01
 syslog02 syslog02
testcases/kernel/syscalls/sysinfo/.gitignore +1 -0
index aa7c26946..8ad2279a4 100644
@@ -1,2 +1,3 @@
 /sysinfo01
 /sysinfo02
+/sysinfo03
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.24.1
#8 lore raw

PATCH v2 5/9 syscalls/sysinfo03: Add time namespace test

Quoted 130 lines · Cyril Hrubis

This tests that the uptime in sysinfo() is adjusted correctly by the namespace offset.

Also check that /proc/uptime is consistent with the uptime from the sysinfo() syscall.

---
 runtest/containers                            |  3 +
 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/sysinfo/.gitignore  |  1 +
 testcases/kernel/syscalls/sysinfo/sysinfo03.c | 81 +++++++++++++++++++
 4 files changed, 86 insertions(+)
 create mode 100644 testcases/kernel/syscalls/sysinfo/sysinfo03.c
runtest/containers +3 -0
index 871cd2a42..4dc05af93 100644
@@ -85,3 +85,6 @@ userns04 userns04
 userns05 userns05
 userns06 userns06
 userns07 userns07
+
+# time namespaces
+sysinfo03 sysinfo03
runtest/syscalls +1 -0
index 6f2dcd82a..fb0b9e539 100644
@@ -1465,6 +1465,7 @@ sysfs06 sysfs06
 
 sysinfo01 sysinfo01
 sysinfo02 sysinfo02
+sysinfo03 sysinfo03
 
 syslog01 syslog01
 syslog02 syslog02
testcases/kernel/syscalls/sysinfo/.gitignore +1 -0
index aa7c26946..8ad2279a4 100644
@@ -1,2 +1,3 @@
 /sysinfo01
 /sysinfo02
+/sysinfo03
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +7 -0
new file mode 100644
index 000000000..af1024915
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+  Copyright (c) 2020 Cyril Hrubis <[email protected]>
+ */
+/*
+
+  Test if CLOCK_BOOTTIME namespace offset is applied to sysinfo uptime

and that

testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +3 -0
+  it's consistent with /proc/uptime as well.
+
+  After a call to unshare(CLONE_NEWTIME) a new timer namespace is

created, the
+ process that has called the unshare() can adjust offsets for CLOCK_MONOTONIC
+ and CLOCK_BOOTTIME for its children by writing to the '/proc/self/timens_offsets'.

testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +45 -0
+
+ */
+
+#include <sys/sysinfo.h>
+#include "lapi/namespaces_constants.h"
+#include "tst_test.h"
+
+static int offsets[] = {
+       10,
+       -10,
+       3600,
+};
+
+static long read_proc_uptime(void)
+{
+       long sec, sec_rem;
+
+       SAFE_FILE_SCANF("/proc/uptime", "%li.%li", &sec, &sec_rem);
+
+       return sec + (sec_rem ? 1 : 0);
+}
+
+static void verify_sysinfo(unsigned int n)
+{
+       struct sysinfo si;
+       long uptime;
+       int off = offsets[n];
+
+       SAFE_UNSHARE(CLONE_NEWTIME);
+
+        SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
+                        CLOCK_BOOTTIME, off);
+
+       sysinfo(&si);
+
+       uptime = si.uptime;
+
+       if (!SAFE_FORK()) {
+               sysinfo(&si);
+               long proc_uptime = read_proc_uptime();
+
+               long diff = si.uptime - uptime;
+
+               if (diff < off || diff > off + 1)
+                       tst_res(TFAIL, "Wrong sysinfo uptime offset %li",

diff);

testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +2 -0
+               else
+                       tst_res(TPASS, "Correct sysinfo uptime offset %i",

off);

testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +2 -0
+
+               if (si.uptime < proc_uptime || si.uptime > proc_uptime +

1) {
+ tst_res(TFAIL, "/proc/uptime %li differs from
sysinfo %li",

testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +3 -0
+                               proc_uptime, si.uptime);
+               } else {
+                       tst_res(TPASS, "/proc/uptime is consistent with

sysinfo");

testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +1 -0
+               }

testcases/kernel/syscalls/sysinfo/sysinfo03.c line 76

Quoted 10 lines
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +10 -0
+       }
+}
+
+static struct tst_test test = {
+       .tcnt = ARRAY_SIZE(offsets),
+       .test = verify_sysinfo,
+       .needs_root = 1,
+       .forks_child = 1,
+       .needs_kconfigs = (const char *[]) {
+               "CONFIG_TIME_NS=y"

Shouldn't end with 'NULL' in kconfig struct?
If not that will mislead arrary_len to recognise wrong number of arrry(cnt) and caused segmentation fault in test.

Quoted 2 lines

+ }

A comma is required here ^, otherwise it'd be failing in the build phase.

+ .tags = (const struct tst_tag[]) {

Quoted 2 lines

+ {"linux-git", "ecc421e05bab"},

Ending with '{}' in tags struct?

Quoted 10 lines
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +2 -1
+       }
+};
--

2.24.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200319/f8c9a0de/attachment.htm>
#9 lore raw

PATCH v2 5/9 syscalls/sysinfo03: Add time namespace test

Hi!

Quoted 18 lines

testcases/kernel/syscalls/sysinfo/sysinfo03.c line 76

Quoted 8 lines
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +7 -0
+static struct tst_test test = {
+       .tcnt = ARRAY_SIZE(offsets),
+       .test = verify_sysinfo,
+       .needs_root = 1,
+       .forks_child = 1,
+       .needs_kconfigs = (const char *[]) {
+               "CONFIG_TIME_NS=y"

Shouldn't end with 'NULL' in kconfig struct?
If not that will mislead arrary_len to recognise wrong number of arrry(cnt) and caused segmentation fault in test.

Quoted 2 lines

+ }

Quoted 7 lines

A comma is required here ^, otherwise it'd be failing in the build phase.

+ .tags = (const struct tst_tag[]) {

Quoted 2 lines

+ {"linux-git", "ecc421e05bab"},

Ending with '{}' in tags struct?

Of course, thanks for catching that!

I will fix these before applying, if the patchset is acked otherwise.

Signature · 2 lines
Cyril Hrubis
[email protected]
#10 lore raw

PATCH v2 5/9 syscalls/sysinfo03: Add time namespace test

Hi Cyril,

Quoted 5 lines · Cyril Hrubis

...

Quoted 1 line

Ending with '{}' in tags struct?

Of course, thanks for catching that!

Thanks, and don't forget to fix in rest patches too.

Quoted 3 lines

I will fix these before applying, if the patchset is acked otherwise.

I have finished all the patches' reviews. Nice patchset! LGTM.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200320/b9c6088f/attachment.htm>
#11 lore raw

PATCH v2 5/9 syscalls/sysinfo03: Add time namespace test

In reply to Cyril Hrubis

Hi Cyril,

Quoted 1 line

+++ b/testcases/kernel/syscalls/sysinfo/sysinfo03.c

...

Quoted 3 lines
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +3 -0
+#include <sys/sysinfo.h>
+#include "lapi/namespaces_constants.h"
+#include "tst_test.h"

...

testcases/kernel/syscalls/sysinfo/sysinfo03.c line 44

Quoted 10 lines
testcases/kernel/syscalls/sysinfo/sysinfo03.c new file +10 -0
+static void verify_sysinfo(unsigned int n)
+{
+	struct sysinfo si;
+	long uptime;
+	int off = offsets[n];
+
+	SAFE_UNSHARE(CLONE_NEWTIME);
+
+        SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
+	                 CLOCK_BOOTTIME, off);

One more fix needed for CentOS 6 to get missing definition: CLOCK_BOOTTIME

#include "lapi/posix_clocks.h"

Or do we want to finally drop CentOS 6 ? (see [1]).

Kind regards,
Petr

[1] https://lists.linux.it/pipermail/ltp/2020-March/016164.html

#12 lore raw

PATCH v2 6/9 syscalls/clock_nanosleep03: Add test for time namespace

In reply to Cyril Hrubis

Test that absolute timeout for clock nanosleep is adjusted by the offset correctly inside of a time namespace.

---
 runtest/containers                            |  1 +
 runtest/syscalls                              |  1 +
 .../syscalls/clock_nanosleep/.gitignore       |  1 +
 .../clock_nanosleep/clock_nanosleep03.c       | 71 +++++++++++++++++++
 4 files changed, 74 insertions(+)
 create mode 100644 testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
runtest/containers +1 -0
index 4dc05af93..8100cd2bc 100644
@@ -88,3 +88,4 @@ userns07 userns07
 
 # time namespaces
 sysinfo03 sysinfo03
+clock_nanosleep03 clock_nanosleep03
runtest/syscalls +1 -0
index fb0b9e539..eac4eeffc 100644
@@ -87,6 +87,7 @@ clock_getres01 clock_getres01
 clock_nanosleep01 clock_nanosleep01
 clock_nanosleep02 clock_nanosleep02
 clock_nanosleep2_01 clock_nanosleep2_01
+clock_nanosleep03 clock_nanosleep03
 
 clock_gettime01 clock_gettime01
 clock_gettime02 clock_gettime02
testcases/kernel/syscalls/clock_nanosleep/.gitignore +1 -0
index 6714ff468..406897cde 100644
@@ -1,2 +1,3 @@
 /clock_nanosleep01
 /clock_nanosleep02
+/clock_nanosleep03
testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
2.24.1
#13 lore raw

PATCH v2 7/9 syscalls/clock_gettime03: Add basic time namespace test

In reply to Cyril Hrubis
---
 runtest/containers                            |   1 +
 runtest/syscalls                              |   1 +
 .../kernel/syscalls/clock_gettime/.gitignore  |   1 +
 .../syscalls/clock_gettime/clock_gettime03.c  | 112 ++++++++++++++++++
 4 files changed, 115 insertions(+)
 create mode 100644 testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
runtest/containers +1 -0
index 8100cd2bc..1006d8d35 100644
@@ -89,3 +89,4 @@ userns07 userns07
 # time namespaces
 sysinfo03 sysinfo03
 clock_nanosleep03 clock_nanosleep03
+clock_gettime03 clock_gettime03
runtest/syscalls +1 -0
index eac4eeffc..4949b5d36 100644
@@ -91,6 +91,7 @@ clock_nanosleep03 clock_nanosleep03
 
 clock_gettime01 clock_gettime01
 clock_gettime02 clock_gettime02
+clock_gettime03 clock_gettime03
 leapsec01 leapsec01
 
 clock_settime01 clock_settime01
testcases/kernel/syscalls/clock_gettime/.gitignore +1 -0
index ba471c859..9d06613b6 100644
@@ -1,3 +1,4 @@
 clock_gettime01
 clock_gettime02
+clock_gettime03
 leapsec01
testcases/kernel/syscalls/clock_gettime/clock_gettime03.c new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
2.24.1
#14 lore raw

PATCH v2 8/9 containers/timens: Add basic error test

In reply to Cyril Hrubis

Add basic error handling test for the /proc/$PID/timens_offsets file.

---
 runtest/containers                            |  1 +
 testcases/kernel/containers/timens/.gitignore |  1 +
 testcases/kernel/containers/timens/Makefile   |  6 ++
 testcases/kernel/containers/timens/timens01.c | 68 +++++++++++++++++++
 4 files changed, 76 insertions(+)
 create mode 100644 testcases/kernel/containers/timens/.gitignore
 create mode 100644 testcases/kernel/containers/timens/Makefile
 create mode 100644 testcases/kernel/containers/timens/timens01.c
runtest/containers +1 -0
index 1006d8d35..23e4a533d 100644
@@ -90,3 +90,4 @@ userns07 userns07
 sysinfo03 sysinfo03
 clock_nanosleep03 clock_nanosleep03
 clock_gettime03 clock_gettime03
+timens01 timens01
testcases/kernel/containers/timens/.gitignore new file +1 -0
new file mode 100644
index 000000000..bcd2dd9dd
@@ -0,0 +1 @@
+timens01
testcases/kernel/containers/timens/Makefile new file +6 -0
new file mode 100644
index 000000000..5ea7d67db
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/containers/timens/timens01.c new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.24.1
#15 lore raw

PATCH v2 9/9 syscalls/timerfd04: Add time namespace test

In reply to Cyril Hrubis
---
 runtest/containers                            |  1 +
 runtest/syscalls                              |  1 +
 testcases/kernel/syscalls/timerfd/.gitignore  |  1 +
 testcases/kernel/syscalls/timerfd/timerfd04.c | 98 +++++++++++++++++++
 4 files changed, 101 insertions(+)
 create mode 100644 testcases/kernel/syscalls/timerfd/timerfd04.c
runtest/containers +1 -0
index 23e4a533d..276096709 100644
@@ -91,3 +91,4 @@ sysinfo03 sysinfo03
 clock_nanosleep03 clock_nanosleep03
 clock_gettime03 clock_gettime03
 timens01 timens01
+timerfd04 timerfd04
runtest/syscalls +1 -0
index 4949b5d36..16ed8d8ec 100644
@@ -1497,6 +1497,7 @@ times03 times03
 timerfd01 timerfd01
 timerfd02 timerfd02
 timerfd03 timerfd03
+timerfd04 timerfd04
 timerfd_create01 timerfd_create01
 timerfd_gettime01 timerfd_gettime01
 timerfd_settime01 timerfd_settime01
testcases/kernel/syscalls/timerfd/.gitignore +1 -0
index 1c5329966..ef388685d 100644
@@ -1,6 +1,7 @@
 /timerfd01
 /timerfd02
 /timerfd03
+/timerfd04
 /timerfd_create01
 /timerfd_gettime01
 /timerfd_settime01
testcases/kernel/syscalls/timerfd/timerfd04.c new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.24.1