Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2017 04:49:07 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r313722 - stable/11/lib/libc/tests/stdio
Message-ID:  <201702140449.v1E4n7fs037841@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Feb 14 04:49:06 2017
New Revision: 313722
URL: https://svnweb.freebsd.org/changeset/base/313722

Log:
  MFC r313378,r313379:
  
  r313378:
  
  Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use
  
  The reasoning here was the same as what was done in r313376:
  - Gather as many results as possible instead of failing early and
    not testing the rest of the cases.
  - Simplify logic when checking test inputs vs outputs and printing
    test result.
  
  r313379:
  
  Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type
  
  The %t{d,u} (ptrdiff_t) tests fail for the following reasons:
  - ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on
    LP64 architectures.
  - intmax_t is by definition fixed to int64_t on all architectures.
  - Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t
    when parsing/representing the value.
  
  PR:		191674

Modified:
  stable/11/lib/libc/tests/stdio/printbasic_test.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/tests/stdio/printbasic_test.c
==============================================================================
--- stable/11/lib/libc/tests/stdio/printbasic_test.c	Tue Feb 14 04:47:13 2017	(r313721)
+++ stable/11/lib/libc/tests/stdio/printbasic_test.c	Tue Feb 14 04:49:06 2017	(r313722)
@@ -78,22 +78,19 @@ _testfmt(const char *result, const char 
 	va_copy(ap2, ap);
 	smash_stack();
 	vsnprintf(s, sizeof(s), fmt, ap);
-	if (strcmp(result, s) != 0) {
-		atf_tc_fail(
-		    "printf(\"%s\", %s) ==> [%s], expected [%s]",
-		    fmt, argstr, s, result);
-	}
+	ATF_CHECK_MSG(strcmp(result, s) == 0,
+	    "printf(\"%s\", %s) ==> [%s], expected [%s]",
+	    fmt, argstr, s, result);
 
 	smash_stack();
 	mbstowcs(ws, s, BUF - 1);
 	mbstowcs(wfmt, fmt, BUF - 1);
 	mbstowcs(wresult, result, BUF - 1);
 	vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2);
-	if (wcscmp(wresult, ws) != 0) {
-		atf_tc_fail(
-		    "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]",
-		    wfmt, argstr, ws, wresult);
-	}
+	ATF_CHECK_MSG(wcscmp(wresult, ws) == 0,
+	    "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]",
+	    wfmt, argstr, ws, wresult);
+
 	va_end(ap);
 	va_end(ap2);
 }
@@ -114,6 +111,11 @@ ATF_TC_BODY(int_within_limits, tc)
 	testfmt("-1", "%jd", (intmax_t)-1);
 	testfmt(S_UINT64MAX, "%ju", UINT64_MAX);
 
+	if (sizeof(ptrdiff_t) != sizeof(uintmax_t))
+		atf_tc_expect_fail("the %%t qualifier is broken on 32-bit "
+		    "platforms where there's a mismatch between ptrdiff_t and "
+		    "uintmax_t's type width; bug # 191674");
+
 	testfmt("-1", "%td", (ptrdiff_t)-1);
 	testfmt(S_SIZEMAX, "%tu", (size_t)-1);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702140449.v1E4n7fs037841>