Module Name: src Committed By: jmmv Date: Sun Feb 9 21:26:07 UTC 2014
Modified Files: src/tests/include: t_paths.c src/tests/lib/libc/gen: t_fpsetmask.c t_isnan.c t_siginfo.c src/tests/lib/libm: t_ldexp.c t_log.c src/tests/lib/libpthread: t_mutex.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/include/t_paths.c cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libc/gen/t_fpsetmask.c cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/t_isnan.c cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libc/gen/t_siginfo.c cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libm/t_ldexp.c cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libm/t_log.c cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libpthread/t_mutex.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/t_paths.c diff -u src/tests/include/t_paths.c:1.12 src/tests/include/t_paths.c:1.13 --- src/tests/include/t_paths.c:1.12 Sun Jun 3 21:42:47 2012 +++ src/tests/include/t_paths.c Sun Feb 9 21:26:07 2014 @@ -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_HEAD(paths, tc) 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(); Index: src/tests/lib/libc/gen/t_fpsetmask.c diff -u src/tests/lib/libc/gen/t_fpsetmask.c:1.12 src/tests/lib/libc/gen/t_fpsetmask.c:1.13 --- src/tests/lib/libc/gen/t_fpsetmask.c:1.12 Sun Apr 14 16:03:06 2013 +++ src/tests/lib/libc/gen/t_fpsetmask.c Sun Feb 9 21:26:07 2014 @@ -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 @@ sigfpe(int s, siginfo_t *si, void *c) \ 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()) \ Index: src/tests/lib/libc/gen/t_isnan.c diff -u src/tests/lib/libc/gen/t_isnan.c:1.3 src/tests/lib/libc/gen/t_isnan.c:1.4 --- src/tests/lib/libc/gen/t_isnan.c:1.3 Mon Sep 16 15:33:24 2013 +++ src/tests/lib/libc/gen/t_isnan.c Sun Feb 9 21:26:07 2014 @@ -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_HEAD(isnan_basic, tc) 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_HEAD(isinf_basic, tc) 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_TC_BODY(isinf_basic, tc) 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(); } Index: src/tests/lib/libc/gen/t_siginfo.c diff -u src/tests/lib/libc/gen/t_siginfo.c:1.22 src/tests/lib/libc/gen/t_siginfo.c:1.23 --- src/tests/lib/libc/gen/t_siginfo.c:1.22 Sun Jan 26 21:04:46 2014 +++ src/tests/lib/libc/gen/t_siginfo.c Sun Feb 9 21:26:07 2014 @@ -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 @@ ATF_TC_BODY(sigfpe_flt, tc) 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 @@ ATF_TC_BODY(sigfpe_int, tc) 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 @@ sigbus_action(int signo, siginfo_t *info 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_HEAD(sigbus_adraln, tc) 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; Index: src/tests/lib/libm/t_ldexp.c diff -u src/tests/lib/libm/t_ldexp.c:1.10 src/tests/lib/libm/t_ldexp.c:1.11 --- src/tests/lib/libm/t_ldexp.c:1.10 Mon Sep 19 05:40:38 2011 +++ src/tests/lib/libm/t_ldexp.c Sun Feb 9 21:26:07 2014 @@ -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(ldexpf_zero_pos, tc) } \ 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); \ } Index: src/tests/lib/libm/t_log.c diff -u src/tests/lib/libm/t_log.c:1.8 src/tests/lib/libm/t_log.c:1.9 --- src/tests/lib/libm/t_log.c:1.8 Sun Apr 8 09:36:04 2012 +++ src/tests/lib/libm/t_log.c Sun Feb 9 21:26:07 2014 @@ -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 @@ ATF_TC_BODY(log10f_inf_pos, tc) #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 @@ ATF_TC_BODY(log2f_inf_pos, tc) #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 @@ ATF_TC_BODY(logf_inf_pos, tc) #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 Index: src/tests/lib/libpthread/t_mutex.c diff -u src/tests/lib/libpthread/t_mutex.c:1.5 src/tests/lib/libpthread/t_mutex.c:1.6 --- src/tests/lib/libpthread/t_mutex.c:1.5 Mon Apr 4 14:47:22 2011 +++ src/tests/lib/libpthread/t_mutex.c Sun Feb 9 21:26:07 2014 @@ -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 @@ #include <sys/cdefs.h> __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_mutex.c,v 1.5 2011/04/04 14:47:22 martin Exp $"); +__RCSID("$NetBSD: t_mutex.c,v 1.6 2014/02/09 21:26:07 jmmv Exp $"); #include <pthread.h> #include <stdio.h> @@ -118,22 +118,21 @@ ATF_TC(mutex2); ATF_TC_HEAD(mutex2, tc) { atf_tc_set_md_var(tc, "descr", "Checks mutexes"); - if (strcmp(atf_config_get("atf_arch"), "powerpc") == 0) - atf_tc_set_md_var(tc, "timeout", "40"); +#if defined(__powerpc__) + atf_tc_set_md_var(tc, "timeout", "40"); +#endif } ATF_TC_BODY(mutex2, tc) { - const char *m_arch; int count, count2; pthread_t new; void *joinval; printf("1: Mutex-test 2\n"); - m_arch = atf_config_get("atf_arch"); - if (strcmp(m_arch, "powerpc") == 0) { - atf_tc_expect_timeout("PR port-powerpc/44387"); - } +#if defined(__powerpc__) + atf_tc_expect_timeout("PR port-powerpc/44387"); +#endif PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); @@ -160,13 +159,13 @@ ATF_TC_BODY(mutex2, tc) global_x, (long)joinval); ATF_REQUIRE_EQ(global_x, 20000000); +#if defined(__powerpc__) /* XXX force a timeout in ppc case since an un-triggered race otherwise looks like a "failure" */ - if (strcmp(m_arch, "powerpc") == 0) { - /* We sleep for longer than the timeout to make ATF not - complain about unexpected success */ - sleep(41); - } + /* We sleep for longer than the timeout to make ATF not + complain about unexpected success */ + sleep(41); +#endif } static void * @@ -190,22 +189,21 @@ ATF_TC_HEAD(mutex3, tc) { atf_tc_set_md_var(tc, "descr", "Checks mutexes using a static " "initializer"); - if (strcmp(atf_config_get("atf_arch"), "powerpc") == 0) - atf_tc_set_md_var(tc, "timeout", "40"); +#if defined(__powerpc__) + atf_tc_set_md_var(tc, "timeout", "40"); +#endif } ATF_TC_BODY(mutex3, tc) { - const char *m_arch; int count, count2; pthread_t new; void *joinval; printf("1: Mutex-test 3\n"); - m_arch = atf_config_get("atf_arch"); - if (strcmp(m_arch, "powerpc") == 0) { - atf_tc_expect_timeout("PR port-powerpc/44387"); - } +#if defined(__powerpc__) + atf_tc_expect_timeout("PR port-powerpc/44387"); +#endif global_x = 0; count = count2 = 10000000; @@ -230,13 +228,13 @@ ATF_TC_BODY(mutex3, tc) global_x, (long)joinval); ATF_REQUIRE_EQ(global_x, 20000000); +#if defined(__powerpc__) /* XXX force a timeout in ppc case since an un-triggered race otherwise looks like a "failure" */ - if (strcmp(m_arch, "powerpc") == 0) { - /* We sleep for longer than the timeout to make ATF not - complain about unexpected success */ - sleep(41); - } + /* We sleep for longer than the timeout to make ATF not + complain about unexpected success */ + sleep(41); +#endif } static void *