Module Name: src
Committed By: jruoho
Date: Thu Jul 7 11:04:30 UTC 2011
Modified Files:
src/tests/include/sys: t_bitops.c
src/tests/lib/libc/stdlib: t_strtod.c
src/tests/lib/libm: t_floor.c t_infinity.c
Log Message:
Improve the QEMU/amd64 detection.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/include/sys/t_bitops.c
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libc/stdlib/t_strtod.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libm/t_floor.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libm/t_infinity.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/include/sys/t_bitops.c
diff -u src/tests/include/sys/t_bitops.c:1.7 src/tests/include/sys/t_bitops.c:1.8
--- src/tests/include/sys/t_bitops.c:1.7 Wed Mar 30 08:34:20 2011
+++ src/tests/include/sys/t_bitops.c Thu Jul 7 11:04:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_bitops.c,v 1.7 2011/03/30 08:34:20 jruoho Exp $ */
+/* $NetBSD: t_bitops.c,v 1.8 2011/07/07 11:04:30 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,15 +29,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_bitops.c,v 1.7 2011/03/30 08:34:20 jruoho Exp $");
+__RCSID("$NetBSD: t_bitops.c,v 1.8 2011/07/07 11:04:30 jruoho Exp $");
#include <atf-c.h>
#include <sys/cdefs.h>
#include <sys/bitops.h>
+#include <sys/utsname.h>
#include <math.h>
#include <stdlib.h>
+#include <string.h>
static const struct {
uint32_t val;
@@ -137,13 +139,13 @@
}
}
-ATF_TC(ilog2_1);
-ATF_TC_HEAD(ilog2_1, tc)
+ATF_TC(ilog2_basic);
+ATF_TC_HEAD(ilog2_basic, tc)
{
atf_tc_set_md_var(tc, "descr", "Test ilog2(3) for correctness");
}
-ATF_TC_BODY(ilog2_1, tc)
+ATF_TC_BODY(ilog2_basic, tc)
{
uint64_t i, x;
@@ -155,21 +157,25 @@
}
}
-ATF_TC(ilog2_2);
-ATF_TC_HEAD(ilog2_2, tc)
+ATF_TC(ilog2_log2);
+ATF_TC_HEAD(ilog2_log2, tc)
{
atf_tc_set_md_var(tc, "descr", "Test log2(3) vs. ilog2(3)");
}
-ATF_TC_BODY(ilog2_2, tc)
+ATF_TC_BODY(ilog2_log2, tc)
{
+ struct utsname utsname;
double x, y;
uint64_t i;
/*
* This may fail under QEMU; see PR misc/44767.
*/
- if (system("cpuctl identify 0 | grep -q QEMU") == 0)
+ ATF_REQUIRE(uname(&utsname) == 0);
+
+ if (strcmp(utsname.machine, "amd64") == 0 &&
+ system("cpuctl identify 0 | grep -q QEMU") == 0)
atf_tc_expect_fail("PR misc/44767");
for (i = 1; i < UINT32_MAX; i += UINT16_MAX) {
@@ -187,8 +193,8 @@
ATF_TP_ADD_TC(tp, fast_divide32);
ATF_TP_ADD_TC(tp, ffsfls);
- ATF_TP_ADD_TC(tp, ilog2_1);
- ATF_TP_ADD_TC(tp, ilog2_2);
+ ATF_TP_ADD_TC(tp, ilog2_basic);
+ ATF_TP_ADD_TC(tp, ilog2_log2);
return atf_no_error();
}
Index: src/tests/lib/libc/stdlib/t_strtod.c
diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.22 src/tests/lib/libc/stdlib/t_strtod.c:1.23
--- src/tests/lib/libc/stdlib/t_strtod.c:1.22 Mon Jul 4 22:33:29 2011
+++ src/tests/lib/libc/stdlib/t_strtod.c Thu Jul 7 11:04:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strtod.c,v 1.22 2011/07/04 22:33:29 mrg Exp $ */
+/* $NetBSD: t_strtod.c,v 1.23 2011/07/07 11:04:30 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,9 @@
/* Public domain, Otto Moerbeek <[email protected]>, 2006. */
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strtod.c,v 1.22 2011/07/04 22:33:29 mrg Exp $");
+__RCSID("$NetBSD: t_strtod.c,v 1.23 2011/07/07 11:04:30 jruoho Exp $");
+
+#include <sys/utsname.h>
#include <errno.h>
#include <math.h>
@@ -161,12 +163,18 @@
{
#ifndef __vax__
# ifdef __HAVE_LONG_DOUBLE
+
+ struct utsname utsname;
+
/*
* See the closed PR lib/33262.
*
* This may also fail under QEMU; cf. PR misc/44767.
*/
- if (system("cpuctl identify 0 | grep -q QEMU") == 0)
+ ATF_REQUIRE(uname(&utsname) == 0);
+
+ if (strcmp(utsname.machine, "amd64") == 0 &&
+ system("cpuctl identify 0 | grep -q QEMU") == 0)
atf_tc_expect_fail("PR misc/44767");
for (size_t i = 0; i < __arraycount(inf_strings); i++) {
@@ -229,6 +237,8 @@
{
#ifndef __vax__
# ifdef __HAVE_LONG_DOUBLE
+
+ struct utsname utsname;
char *end;
/*
@@ -236,7 +246,10 @@
*
* This may also fail under QEMU; cf. PR misc/44767.
*/
- if (system("cpuctl identify 0 | grep -q QEMU") == 0)
+ ATF_REQUIRE(uname(&utsname) == 0);
+
+ if (strcmp(utsname.machine, "amd64") == 0 &&
+ system("cpuctl identify 0 | grep -q QEMU") == 0)
atf_tc_expect_fail("PR misc/44767");
long double ld = strtold(nan_string, &end);
@@ -260,13 +273,19 @@
ATF_TC_BODY(strtod_round, tc)
{
#if defined(__i386__) || defined(__amd64__) || defined(__sparc__)
+
+ struct utsname utsname;
+
/*
* Test that strtod(3) honors the current rounding mode.
* The used value is somewhere near 1 + DBL_EPSILON + FLT_EPSILON.
*
* May fail under QEMU; cf. PR misc/44767.
*/
- if (system("cpuctl identify 0 | grep -q QEMU") == 0)
+ ATF_REQUIRE(uname(&utsname) == 0);
+
+ if (strcmp(utsname.machine, "amd64") == 0 &&
+ system("cpuctl identify 0 | grep -q QEMU") == 0)
atf_tc_expect_fail("PR misc/44767");
const char *val =
Index: src/tests/lib/libm/t_floor.c
diff -u src/tests/lib/libm/t_floor.c:1.5 src/tests/lib/libm/t_floor.c:1.6
--- src/tests/lib/libm/t_floor.c:1.5 Mon Jul 4 22:33:29 2011
+++ src/tests/lib/libm/t_floor.c Thu Jul 7 11:04:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_floor.c,v 1.5 2011/07/04 22:33:29 mrg Exp $ */
+/* $NetBSD: t_floor.c,v 1.6 2011/07/07 11:04:30 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,13 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_floor.c,v 1.5 2011/07/04 22:33:29 mrg Exp $");
+__RCSID("$NetBSD: t_floor.c,v 1.6 2011/07/07 11:04:30 jruoho Exp $");
+#include <sys/utsname.h>
+
+#include <atf-c.h>
#include <math.h>
#include <limits.h>
#include <stdlib.h>
-
-#include <atf-c.h>
+#include <string.h>
ATF_TC(floor);
ATF_TC_HEAD(floor, tc)
@@ -51,6 +53,7 @@
ATF_TC_BODY(floor, tc)
{
+ struct utsname utsname;
const int n = 10240;
double x, y;
int i;
@@ -58,7 +61,10 @@
/*
* This may fail under QEMU; see PR misc/44767.
*/
- if (system("cpuctl identify 0 | grep -q QEMU") == 0)
+ ATF_REQUIRE(uname(&utsname) == 0);
+
+ if (strcmp(utsname.machine, "amd64") == 0 &&
+ system("cpuctl identify 0 | grep -q QEMU") == 0)
atf_tc_expect_fail("PR misc/44767");
for (i = 0; i < n; i++) {
Index: src/tests/lib/libm/t_infinity.c
diff -u src/tests/lib/libm/t_infinity.c:1.3 src/tests/lib/libm/t_infinity.c:1.4
--- src/tests/lib/libm/t_infinity.c:1.3 Tue May 31 22:40:35 2011
+++ src/tests/lib/libm/t_infinity.c Thu Jul 7 11:04:30 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_infinity.c,v 1.3 2011/05/31 22:40:35 alnsn Exp $ */
+/* $NetBSD: t_infinity.c,v 1.4 2011/07/07 11:04:30 jruoho Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -29,12 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_infinity.c,v 1.3 2011/05/31 22:40:35 alnsn Exp $");
+__RCSID("$NetBSD: t_infinity.c,v 1.4 2011/07/07 11:04:30 jruoho Exp $");
+
+#include <sys/utsname.h>
#include <atf-c.h>
#include <math.h>
#include <float.h>
#include <stdlib.h>
+#include <string.h>
ATF_TC(infinity_float);
ATF_TC_HEAD(infinity_float, tc)
@@ -89,13 +92,16 @@
ATF_TC_BODY(infinity_long_double, tc)
{
+ struct utsname utsname;
/*
* May fail under QEMU; cf. PR misc/44767.
*/
- if (system("cpuctl identify 0 | grep -q QEMU") == 0)
- atf_tc_expect_fail("PR misc/44767");
+ ATF_REQUIRE(uname(&utsname) == 0);
+ if (strcmp(utsname.machine, "amd64") == 0 &&
+ system("cpuctl identify 0 | grep -q QEMU") == 0)
+ atf_tc_expect_fail("PR misc/44767");
#ifndef LDBL_MAX
atf_tc_skip("no long double support on this architecture");