Module Name:    src
Committed By:   christos
Date:           Fri Dec  6 19:28:11 UTC 2019

Modified Files:
        src/tests/lib/libutil: t_snprintb.c

Log Message:
Fix broken tests in big endian machines. Internally field values are
stored as uint64_t/uintmax_t so printing them with %d on big endian
ends up being 0.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libutil/t_snprintb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libutil/t_snprintb.c
diff -u src/tests/lib/libutil/t_snprintb.c:1.6 src/tests/lib/libutil/t_snprintb.c:1.7
--- src/tests/lib/libutil/t_snprintb.c:1.6	Mon Apr 29 03:55:38 2019
+++ src/tests/lib/libutil/t_snprintb.c	Fri Dec  6 14:28:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: t_snprintb.c,v 1.6 2019/04/29 07:55:38 kre Exp $ */
+/* $NetBSD: t_snprintb.c,v 1.7 2019/12/06 19:28:11 christos Exp $ */
 
 /*
  * Copyright (c) 2002, 2004, 2008, 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_snprintb.c,v 1.6 2019/04/29 07:55:38 kre Exp $");
+__RCSID("$NetBSD: t_snprintb.c,v 1.7 2019/12/06 19:28:11 christos Exp $");
 
 #include <string.h>
 #include <util.h>
@@ -82,9 +82,9 @@ ATF_TC_BODY(snprintb, tc)
 
 	h_snprintb("\177\20f\0\4FOO\0=\1ONE\0=\2TWO\0*=OTHER\0\0", 3,
 	    "0x3<FOO=0x3=OTHER>");
-	h_snprintb("\177\20f\0\4X\0=\1ONE\0=\2TWO\0*=Other(%d)\0\0", 3,
+	h_snprintb("\177\20f\0\4X\0=\1ONE\0=\2TWO\0*=Other(%jd)\0\0", 3,
 	    "0x3<X=0x3=Other(3)>");
-	h_snprintb("\177\20f\0\x8X\0=\1ONE\0=\2TWO\0*=other(%o)\0\0", 0x20,
+	h_snprintb("\177\20f\0\x8X\0=\1ONE\0=\2TWO\0*=other(%jo)\0\0", 0x20,
 	    "0x20<X=0x20=other(40)>");
 	h_snprintb("\177\020F\0\4\0:\1ONE\0:\2TWO\0\0", 3,
 	    "0x3<>");
@@ -94,7 +94,7 @@ ATF_TC_BODY(snprintb, tc)
 	    "0x12<Field_1=0x2=TWO,Field_2=0x1=ONE>");
 
 	h_snprintb("\177\20f\0\4Field_1\0=\1ONE\0=\2TWO\0"
-		   "F\x8\4\0*Field_3=%d\0"
+		   "F\x8\4\0*Field_3=%jd\0"
 		   "f\4\4Field_2\0:\1:ONE\0:\2:TWO\0\0", 0xD12,
 	    "0xd12<Field_1=0x2=TWO,Field_3=13,Field_2=0x1:ONE>");
 }

Reply via email to