[linux] 09/12: tests: Add error messages to timers/nanosleep selftest

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Thu Aug 13 13:23:27 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch benh/autopkgtest
in repository linux.

commit b93b1f9f045836f9878411bb68fd5a592353c8b8
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Thu Aug 13 11:01:42 2015 +0200

    tests: Add error messages to timers/nanosleep selftest
---
 .../selftests-timers-nanosleep-show-errors.patch   | 74 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 75 insertions(+)

diff --git a/debian/patches/bugfix/all/selftests-timers-nanosleep-show-errors.patch b/debian/patches/bugfix/all/selftests-timers-nanosleep-show-errors.patch
new file mode 100644
index 0000000..db3e669
--- /dev/null
+++ b/debian/patches/bugfix/all/selftests-timers-nanosleep-show-errors.patch
@@ -0,0 +1,74 @@
+--- a/tools/testing/selftests/timers/nanosleep.c
++++ b/tools/testing/selftests/timers/nanosleep.c
+@@ -111,30 +111,63 @@ struct timespec timespec_add(struct time
+ int nanosleep_test(int clockid, long long ns)
+ {
+ 	struct timespec now, target, rel;
++	int err;
+ 
+ 	/* First check abs time */
+-	if (clock_gettime(clockid, &now))
++	if (clock_gettime(clockid, &now)) {
++		printf("[abs] clock_gettime(%d) failed: %m ", clockid);
+ 		return UNSUPPORTED;
++	}
+ 	target = timespec_add(now, ns);
+ 
+-	if (clock_nanosleep(clockid, TIMER_ABSTIME, &target, NULL))
++	err = clock_nanosleep(clockid, TIMER_ABSTIME, &target, NULL);
++	if (err) {
++		printf("[abs] clock_nanosleep(%d) failed: %s ",
++		       clockid, strerror(err));
+ 		return UNSUPPORTED;
+-	clock_gettime(clockid, &now);
++	}
++	if (clock_gettime(clockid, &now)) {
++		printf("[abs] clock_gettime(%d) failed: %m ", clockid);
++		return UNSUPPORTED;
++	}
+ 
+-	if (!in_order(target, now))
++	if (!in_order(target, now)) {
++		printf("[abs] target=%lu.%09lu > now=%lu.%09lu ",
++		       (unsigned long)target.tv_sec,
++		       (unsigned long)target.tv_nsec,
++		       (unsigned long)now.tv_sec,
++		       (unsigned long)now.tv_nsec);
+ 		return -1;
++	}
+ 
+ 	/* Second check reltime */
+-	clock_gettime(clockid, &now);
++	if (clock_gettime(clockid, &now)) {
++		printf("[rel] clock_gettime(%d) failed: %m ", clockid);
++		return -1;
++	}
+ 	rel.tv_sec = 0;
+ 	rel.tv_nsec = 0;
+ 	rel = timespec_add(rel, ns);
+ 	target = timespec_add(now, ns);
+-	clock_nanosleep(clockid, 0, &rel, NULL);
+-	clock_gettime(clockid, &now);
++	err = clock_nanosleep(clockid, 0, &rel, NULL);
++	if (err) {
++		printf("[rel] clock_nanosleep(%d) failed: %s ",
++		       clockid, strerror(err));
++		return -1;
++	}
++	if (clock_gettime(clockid, &now)) {
++		printf("[rel] clock_gettime(%d) failed: %m ", clockid);
++		return -1;
++	}
+ 
+-	if (!in_order(target, now))
++	if (!in_order(target, now)) {
++		printf("[rel] target=%lu.%09lu > now=%lu.%09lu ",
++		       (unsigned long)target.tv_sec,
++		       (unsigned long)target.tv_nsec,
++		       (unsigned long)now.tv_sec,
++		       (unsigned long)now.tv_nsec);
+ 		return -1;
++	}
+ 	return 0;
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index b6c1074..fe562e6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -84,3 +84,4 @@ features/all/grsecurity/grsecurity-kconfig.patch
 # Disabled until we add code into the grsecurity/ directory
 #features/all/grsecurity/grsecurity-kbuild.patch
 features/all/grsecurity/grkernsec_perf_harden.patch
+bugfix/all/selftests-timers-nanosleep-show-errors.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list