summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2014-10-13 03:55:47 +0000
committerngie <ngie@FreeBSD.org>2014-10-13 03:55:47 +0000
commit1d5071689271b21013e6aeffbbcaf7130a2c2694 (patch)
tree4e29345402fc6c8cd3c36e84cafa65d40e05eee3
parent56e7f9c5eb57f41bff12067ab49a3a56a274f6cd (diff)
downloadFreeBSD-src-1d5071689271b21013e6aeffbbcaf7130a2c2694.zip
FreeBSD-src-1d5071689271b21013e6aeffbbcaf7130a2c2694.tar.gz
Change ATF_REQUIRE_MSG calls to ATF_CHECK_MSG to get as many errors as possible
t_strptime:common.. - Expect the testcase body as a whole to fail. Multiple PRs will be filed to track the issues (there are 18 check failures) t_strptime:day.. - %EA and %OA seem to be case insensitive on FreeBSD
-rw-r--r--contrib/netbsd-tests/lib/libc/time/t_strptime.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/time/t_strptime.c b/contrib/netbsd-tests/lib/libc/time/t_strptime.c
index c0f9cdf..7808891 100644
--- a/contrib/netbsd-tests/lib/libc/time/t_strptime.c
+++ b/contrib/netbsd-tests/lib/libc/time/t_strptime.c
@@ -49,6 +49,17 @@ h_pass(const char *buf, const char *fmt, int len,
exp = buf + len;
ret = strptime(buf, fmt, &tm);
+#if defined(__FreeBSD__)
+ ATF_CHECK_MSG(ret == exp,
+ "strptime(\"%s\", \"%s\", tm): incorrect return code: "
+ "expected: %p, got: %p", buf, fmt, exp, ret);
+
+#define H_REQUIRE_FIELD(field) \
+ ATF_CHECK_MSG(tm.field == field, \
+ "strptime(\"%s\", \"%s\", tm): incorrect %s: " \
+ "expected: %d, but got: %d", buf, fmt, \
+ ___STRING(field), field, tm.field)
+#else
ATF_REQUIRE_MSG(ret == exp,
"strptime(\"%s\", \"%s\", tm): incorrect return code: "
"expected: %p, got: %p", buf, fmt, exp, ret);
@@ -58,6 +69,7 @@ h_pass(const char *buf, const char *fmt, int len,
"strptime(\"%s\", \"%s\", tm): incorrect %s: " \
"expected: %d, but got: %d", buf, fmt, \
___STRING(field), field, tm.field)
+#endif
H_REQUIRE_FIELD(tm_sec);
H_REQUIRE_FIELD(tm_min);
@@ -76,8 +88,13 @@ h_fail(const char *buf, const char *fmt)
{
struct tm tm = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, NULL };
+#if defined(__FreeBSD__)
+ ATF_CHECK_MSG(strptime(buf, fmt, &tm) == NULL, "strptime(\"%s\", "
+ "\"%s\", &tm) should fail, but it didn't", buf, fmt);
+#else
ATF_REQUIRE_MSG(strptime(buf, fmt, &tm) == NULL, "strptime(\"%s\", "
"\"%s\", &tm) should fail, but it didn't", buf, fmt);
+#endif
}
ATF_TC(common);
@@ -91,6 +108,10 @@ ATF_TC_HEAD(common, tc)
ATF_TC_BODY(common, tc)
{
+#if defined(__FreeBSD__)
+ atf_tc_expect_fail("There are various issues with strptime on FreeBSD");
+#endif
+
h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %T %Y",
24, 46, 27, 23, 20, 0, 98, 2, -1);
h_pass("Tue Jan 20 23:27:46 1998", "%a %b %d %H:%M:%S %Y",
@@ -168,9 +189,17 @@ ATF_TC_BODY(day, tc)
h_pass("mon", "%a", 3, -1, -1, -1, -1, -1, -1, 1, -1);
h_pass("tueSDay", "%A", 7, -1, -1, -1, -1, -1, -1, 2, -1);
h_pass("sunday", "%A", 6, -1, -1, -1, -1, -1, -1, 0, -1);
+#if defined(__NetBSD__)
h_fail("sunday", "%EA");
+#else
+ h_pass("Sunday", "%EA", 6, -1, -1, -1, -1, -1, -1, 0, -1);
+#endif
h_pass("SaturDay", "%A", 8, -1, -1, -1, -1, -1, -1, 6, -1);
+#if defined(__NetBSD__)
h_fail("SaturDay", "%OA");
+#else
+ h_pass("SaturDay", "%OA", 8, -1, -1, -1, -1, -1, -1, 6, -1);
+#endif
}
ATF_TC(month);
OpenPOWER on IntegriCloud