summaryrefslogtreecommitdiff
path: root/tests/lib
diff options
context:
space:
mode:
authorjruoho <jruoho@NetBSD.org>2011-07-07 11:04:30 +0000
committerjruoho <jruoho@NetBSD.org>2011-07-07 11:04:30 +0000
commite67dbecf26353ecd86ebebf28e3e045c32044b9f (patch)
tree69d9617d2ce1d0a06c520735a81df5493b47c61b /tests/lib
parentf5b97f94b5b3aaa5d5bfeb6c79adf2742415f50f (diff)
Improve the QEMU/amd64 detection.
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/libc/stdlib/t_strtod.c29
-rw-r--r--tests/lib/libm/t_floor.c16
-rw-r--r--tests/lib/libm/t_infinity.c14
3 files changed, 45 insertions, 14 deletions
diff --git a/tests/lib/libc/stdlib/t_strtod.c b/tests/lib/libc/stdlib/t_strtod.c
index 76c8322444d..8077c27cfe4 100644
--- a/tests/lib/libc/stdlib/t_strtod.c
+++ b/tests/lib/libc/stdlib/t_strtod.c
@@ -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 <otto@drijf.net>, 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 @@ ATF_TC_BODY(strtold_inf, tc)
{
#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 @@ ATF_TC_BODY(strtold_nan, tc)
{
#ifndef __vax__
# ifdef __HAVE_LONG_DOUBLE
+
+ struct utsname utsname;
char *end;
/*
@@ -236,7 +246,10 @@ ATF_TC_BODY(strtold_nan, tc)
*
* 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_HEAD(strtod_round, tc)
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 =
diff --git a/tests/lib/libm/t_floor.c b/tests/lib/libm/t_floor.c
index 09e897c15e9..dd5cfadb4d3 100644
--- a/tests/lib/libm/t_floor.c
+++ b/tests/lib/libm/t_floor.c
@@ -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_HEAD(floor, tc)
ATF_TC_BODY(floor, tc)
{
+ struct utsname utsname;
const int n = 10240;
double x, y;
int i;
@@ -58,7 +61,10 @@ ATF_TC_BODY(floor, tc)
/*
* 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++) {
diff --git a/tests/lib/libm/t_infinity.c b/tests/lib/libm/t_infinity.c
index 3ac2f5f3f77..d1959cf632a 100644
--- a/tests/lib/libm/t_infinity.c
+++ b/tests/lib/libm/t_infinity.c
@@ -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_HEAD(infinity_long_double, tc)
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");