Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libutil Fix broken tests in big endian machines. I...



details:   https://anonhg.NetBSD.org/src/rev/d25bdba832d6
branches:  trunk
changeset: 465899:d25bdba832d6
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Dec 06 19:28:11 2019 +0000

description:
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.

diffstat:

 tests/lib/libutil/t_snprintb.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 9a04eed10131 -r d25bdba832d6 tests/lib/libutil/t_snprintb.c
--- a/tests/lib/libutil/t_snprintb.c    Fri Dec 06 18:33:19 2019 +0000
+++ b/tests/lib/libutil/t_snprintb.c    Fri Dec 06 19:28:11 2019 +0000
@@ -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 @@
 
        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 @@
            "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>");
 }



Home | Main Index | Thread Index | Old Index