Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests Use compiler builtins instead of atf_arch and atf_mach...
details: https://anonhg.NetBSD.org/src/rev/8825e7f6f546
branches: trunk
changeset: 326652:8825e7f6f546
user: jmmv <jmmv%NetBSD.org@localhost>
date: Sun Feb 09 21:26:07 2014 +0000
description:
Use compiler builtins instead of atf_arch and atf_machine.
The atf_arch and atf_machine configuration variables were removed from
atf-0.19 without me realizing that some tests were querying them directly.
Instead of reintroducing those variables, just rely on compiler builtins
as many other tests already do.
Should fix PR bin/48582.
diffstat:
tests/include/t_paths.c | 12 ++++-----
tests/lib/libc/gen/t_fpsetmask.c | 6 +++-
tests/lib/libc/gen/t_isnan.c | 23 +++++++++--------
tests/lib/libc/gen/t_siginfo.c | 41 +++++++++++++++-----------------
tests/lib/libm/t_ldexp.c | 13 ++++-----
tests/lib/libm/t_log.c | 19 ++++++++------
tests/lib/libpthread/t_mutex.c | 50 +++++++++++++++++++--------------------
7 files changed, 81 insertions(+), 83 deletions(-)
diffs (truncated from 404 to 300 lines):
diff -r 3af07b575466 -r 8825e7f6f546 tests/include/t_paths.c
--- a/tests/include/t_paths.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/include/t_paths.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_paths.c,v 1.12 2012/06/03 21:42:47 joerg Exp $ */
+/* $NetBSD: t_paths.c,v 1.13 2014/02/09 21:26:07 jmmv Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_paths.c,v 1.12 2012/06/03 21:42:47 joerg Exp $");
+__RCSID("$NetBSD: t_paths.c,v 1.13 2014/02/09 21:26:07 jmmv Exp $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -121,17 +121,15 @@
ATF_TC_BODY(paths, tc)
{
- const char *arch;
struct stat st;
uid_t uid;
mode_t m;
size_t i;
int fd;
- arch = atf_config_get("atf_arch");
-
- if (strcmp(arch, "sparc") == 0)
- atf_tc_skip("PR port-sparc/45580");
+#if defined(__sparc__)
+ atf_tc_skip("PR port-sparc/45580");
+#endif
uid = getuid();
diff -r 3af07b575466 -r 8825e7f6f546 tests/lib/libc/gen/t_fpsetmask.c
--- a/tests/lib/libc/gen/t_fpsetmask.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/lib/libc/gen/t_fpsetmask.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fpsetmask.c,v 1.12 2013/04/14 16:03:06 martin Exp $ */
+/* $NetBSD: t_fpsetmask.c,v 1.13 2014/02/09 21:26:07 jmmv Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -26,6 +26,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h>
+
#include <atf-c.h>
#include <atf-c/config.h>
@@ -295,7 +297,7 @@
\
ATF_TC_BODY(m##_##t, tc) \
{ \
- if (strcmp(atf_config_get("atf_arch"), "macppc") == 0) \
+ if (strcmp(MACHINE, "macppc") == 0) \
atf_tc_expect_fail("PR port-macppc/46319"); \
\
if (isQEMU()) \
diff -r 3af07b575466 -r 8825e7f6f546 tests/lib/libc/gen/t_isnan.c
--- a/tests/lib/libc/gen/t_isnan.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/lib/libc/gen/t_isnan.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_isnan.c,v 1.3 2013/09/16 15:33:24 martin Exp $ */
+/* $NetBSD: t_isnan.c,v 1.4 2014/02/09 21:26:07 jmmv Exp $ */
/*
* This file is in the Public Domain.
@@ -7,6 +7,8 @@
* test by Ben Harris.
*/
+#include <sys/param.h>
+
#include <atf-c.h>
#include <atf-c/config.h>
@@ -21,6 +23,10 @@
ATF_TC_BODY(isnan_basic, tc)
{
+#if defined(__m68k__)
+ atf_tc_skip("Test not applicable on " MACHINE_ARCH);
+#endif
+
#ifdef NAN
/* NAN is meant to be a (float)NaN. */
ATF_CHECK(isnan(NAN) != 0);
@@ -38,6 +44,9 @@
ATF_TC_BODY(isinf_basic, tc)
{
+#if defined(__m68k__)
+ atf_tc_skip("Test not applicable on " MACHINE_ARCH);
+#endif
/* HUGE_VAL is meant to be an infinity. */
ATF_CHECK(isinf(HUGE_VAL) != 0);
@@ -51,16 +60,8 @@
ATF_TP_ADD_TCS(tp)
{
- const char *arch;
-
- arch = atf_config_get("atf_arch");
-
- if (strcmp("m68000", arch) == 0)
- atf_tc_skip("Test not applicable on %s", arch);
- else {
- ATF_TP_ADD_TC(tp, isnan_basic);
- ATF_TP_ADD_TC(tp, isinf_basic);
- }
+ ATF_TP_ADD_TC(tp, isnan_basic);
+ ATF_TP_ADD_TC(tp, isinf_basic);
return atf_no_error();
}
diff -r 3af07b575466 -r 8825e7f6f546 tests/lib/libc/gen/t_siginfo.c
--- a/tests/lib/libc/gen/t_siginfo.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/lib/libc/gen/t_siginfo.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.22 2014/01/26 21:04:46 matt Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.23 2014/02/09 21:26:07 jmmv Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -309,8 +309,9 @@
if (isQEMU())
atf_tc_skip("Test does not run correctly under QEMU");
- if (strcmp(atf_config_get("atf_arch"),"powerpc") == 0)
- atf_tc_skip("Test not valid on powerpc");
+#if defined(__powerpc__)
+ atf_tc_skip("Test not valid on powerpc");
+#endif
if (sigsetjmp(sigfpe_flt_env, 0) == 0) {
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = sigfpe_flt_action;
@@ -359,8 +360,9 @@
struct sigaction sa;
long l = strtol("0", NULL, 10);
- if (strcmp(atf_config_get("atf_arch"),"powerpc") == 0)
- atf_tc_skip("Test not valid on powerpc");
+#if defined(__powerpc__)
+ atf_tc_skip("Test not valid on powerpc");
+#endif
if (sigsetjmp(sigfpe_int_env, 0) == 0) {
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = sigfpe_int_action;
@@ -424,11 +426,10 @@
ATF_REQUIRE_EQ(info->si_errno, 0);
ATF_REQUIRE_EQ(info->si_code, BUS_ADRALN);
- if (strcmp(atf_config_get("atf_arch"), "i386") == 0 ||
- strcmp(atf_config_get("atf_arch"), "x86_64") == 0) {
- atf_tc_expect_fail("x86 architecture does not correctly "
- "report the address where the unaligned access occured");
- }
+#if defined(__i386__) || defined(__x86_64__)
+ atf_tc_expect_fail("x86 architecture does not correctly "
+ "report the address where the unaligned access occured");
+#endif
ATF_REQUIRE_EQ(info->si_addr, (volatile void *)addr);
atf_tc_pass();
@@ -446,20 +447,16 @@
ATF_TC_BODY(sigbus_adraln, tc)
{
- const char *arch = atf_config_get("atf_arch");
struct sigaction sa;
- if (strcmp(arch, "alpha") == 0) {
- int rv, val;
- size_t len = sizeof(val);
- rv = sysctlbyname("machdep.unaligned_sigbus", &val, &len,
- NULL, 0);
- ATF_REQUIRE(rv == 0);
- if (val == 0)
- atf_tc_skip("SIGBUS signal not enabled for"
- " unaligned accesses");
-
- }
+#if defined(__alpha__)
+ int rv, val;
+ size_t len = sizeof(val);
+ rv = sysctlbyname("machdep.unaligned_sigbus", &val, &len, NULL, 0);
+ ATF_REQUIRE(rv == 0);
+ if (val == 0)
+ atf_tc_skip("SIGBUS signal not enabled for unaligned accesses");
+#endif
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = sigbus_action;
diff -r 3af07b575466 -r 8825e7f6f546 tests/lib/libm/t_ldexp.c
--- a/tests/lib/libm/t_ldexp.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/lib/libm/t_ldexp.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ldexp.c,v 1.10 2011/09/19 05:40:38 jruoho Exp $ */
+/* $NetBSD: t_ldexp.c,v 1.11 2014/02/09 21:26:07 jmmv Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ldexp.c,v 1.10 2011/09/19 05:40:38 jruoho Exp $");
+__RCSID("$NetBSD: t_ldexp.c,v 1.11 2014/02/09 21:26:07 jmmv Exp $");
+
+#include <sys/param.h>
#include <atf-c.h>
#include <atf-c/config.h>
@@ -457,11 +459,8 @@
} \
ATF_TC_BODY(name, tc) \
{ \
- const char *machine; \
- \
- machine = atf_config_get("atf_machine"); \
- if (strcmp("vax", machine) == 0) \
- atf_tc_skip("Test not valid for %s", machine); \
+ if (strcmp("vax", MACHINE_ARCH) == 0) \
+ atf_tc_skip("Test not valid for " MACHINE_ARCH); \
run_test(name); \
}
diff -r 3af07b575466 -r 8825e7f6f546 tests/lib/libm/t_log.c
--- a/tests/lib/libm/t_log.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/lib/libm/t_log.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_log.c,v 1.8 2012/04/08 09:36:04 jruoho Exp $ */
+/* $NetBSD: t_log.c,v 1.9 2014/02/09 21:26:07 jmmv Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_log.c,v 1.8 2012/04/08 09:36:04 jruoho Exp $");
+__RCSID("$NetBSD: t_log.c,v 1.9 2014/02/09 21:26:07 jmmv Exp $");
#include <atf-c.h>
#include <atf-c/config.h>
@@ -204,8 +204,9 @@
#ifndef __vax__
const float x = 1.0L / 0.0L;
- if (strcmp(atf_config_get("atf_arch"), "alpha") == 0)
- atf_tc_expect_fail("PR port-alpha/46301");
+#if defined(__alpha__)
+ atf_tc_expect_fail("PR port-alpha/46301");
+#endif
ATF_CHECK(log10f(x) == x);
#endif
@@ -627,8 +628,9 @@
#ifndef __vax__
const float x = 1.0L / 0.0L;
- if (strcmp(atf_config_get("atf_arch"), "alpha") == 0)
- atf_tc_expect_fail("PR port-alpha/46301");
+#if defined(__alpha__)
+ atf_tc_expect_fail("PR port-alpha/46301");
+#endif
ATF_CHECK(log2f(x) == x);
#endif
@@ -854,8 +856,9 @@
#ifndef __vax__
const float x = 1.0L / 0.0L;
- if (strcmp(atf_config_get("atf_arch"), "alpha") == 0)
- atf_tc_expect_fail("PR port-alpha/46301");
+#if defined(__alpha__)
+ atf_tc_expect_fail("PR port-alpha/46301");
+#endif
ATF_CHECK(logf(x) == x);
#endif
diff -r 3af07b575466 -r 8825e7f6f546 tests/lib/libpthread/t_mutex.c
--- a/tests/lib/libpthread/t_mutex.c Sun Feb 09 19:42:04 2014 +0000
+++ b/tests/lib/libpthread/t_mutex.c Sun Feb 09 21:26:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.5 2011/04/04 14:47:22 martin Exp $ */
+/* $NetBSD: t_mutex.c,v 1.6 2014/02/09 21:26:07 jmmv Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
Home |
Main Index |
Thread Index |
Old Index