Module Name:    src
Committed By:   pgoyette
Date:           Tue Jan  4 22:30:41 UTC 2011

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/lib/libc: Makefile
        src/tests/lib/libc/ieeefp: t_except.c t_round.c t_subnormal.c
Removed Files:
        src/distrib/sets/lists/tests: ad.arm ad.armeb ad.hppa ad.m68k
            ad.mips64eb ad.mips64el ad.mipseb ad.mipsel ad.powerpc ad.powerpc64
            ad.sh3eb ad.sh3el ad.x86_64 md.alpha md.i386 md.ia64 md.sparc
            md.sparc64

Log Message:
Update the ieeefp tests so that they can be built on all architectures.
This enables us to avoid the set-list mess.

Build tested on amd64, i386, sun2, and vax!


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/distrib/sets/lists/tests/ad.arm \
    src/distrib/sets/lists/tests/ad.armeb \
    src/distrib/sets/lists/tests/ad.hppa src/distrib/sets/lists/tests/ad.m68k \
    src/distrib/sets/lists/tests/ad.mips64eb \
    src/distrib/sets/lists/tests/ad.mips64el \
    src/distrib/sets/lists/tests/ad.mipseb \
    src/distrib/sets/lists/tests/ad.mipsel \
    src/distrib/sets/lists/tests/ad.powerpc \
    src/distrib/sets/lists/tests/ad.powerpc64 \
    src/distrib/sets/lists/tests/ad.sh3eb \
    src/distrib/sets/lists/tests/ad.sh3el \
    src/distrib/sets/lists/tests/ad.x86_64 \
    src/distrib/sets/lists/tests/md.alpha \
    src/distrib/sets/lists/tests/md.i386 src/distrib/sets/lists/tests/md.ia64 \
    src/distrib/sets/lists/tests/md.sparc \
    src/distrib/sets/lists/tests/md.sparc64
cvs rdiff -u -r1.205 -r1.206 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.19 -r1.20 src/tests/lib/libc/Makefile
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/ieeefp/t_except.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/ieeefp/t_round.c \
    src/tests/lib/libc/ieeefp/t_subnormal.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.205 src/distrib/sets/lists/tests/mi:1.206
--- src/distrib/sets/lists/tests/mi:1.205	Mon Jan  3 19:01:47 2011
+++ src/distrib/sets/lists/tests/mi	Tue Jan  4 22:30:41 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.205 2011/01/03 19:01:47 pgoyette Exp $
+# $NetBSD: mi,v 1.206 2011/01/04 22:30:41 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -336,6 +336,10 @@
 ./usr/libdata/debug/usr/tests/lib/libc/hash/h_hash.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/hash/t_sha2.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/ieeefp				tests-lib-debug
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_except.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_nan_inf.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_round.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/ieeefp/t_subnormal.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/setjmp				tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/setjmp/t_setjmp.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/ssp				tests-lib-debug
@@ -1614,6 +1618,11 @@
 ./usr/tests/lib/libc/hash/t_hash		tests-lib-tests		atf
 ./usr/tests/lib/libc/hash/t_sha2		tests-lib-tests		atf
 ./usr/tests/lib/libc/ieeefp			tests-lib-tests
+./usr/tests/lib/libc/ieeefp/Atffile		tests-lib-tests		atf
+./usr/tests/lib/libc/ieeefp/t_except		tests-lib-tests		atf
+./usr/tests/lib/libc/ieeefp/t_nan_inf		tests-lib-tests		atf
+./usr/tests/lib/libc/ieeefp/t_round		tests-lib-tests		atf
+./usr/tests/lib/libc/ieeefp/t_subnormal		tests-lib-tests		atf
 ./usr/tests/lib/libc/stdlib			tests-lib-tests
 ./usr/tests/lib/libc/stdlib/Atffile		tests-lib-tests		atf
 ./usr/tests/lib/libc/stdlib/h_getopt		tests-lib-tests		atf

Index: src/tests/lib/libc/Makefile
diff -u src/tests/lib/libc/Makefile:1.19 src/tests/lib/libc/Makefile:1.20
--- src/tests/lib/libc/Makefile:1.19	Mon Jan  3 19:25:48 2011
+++ src/tests/lib/libc/Makefile	Tue Jan  4 22:30:40 2011
@@ -1,13 +1,9 @@
-# $NetBSD: Makefile,v 1.19 2011/01/03 19:25:48 pgoyette Exp $
+# $NetBSD: Makefile,v 1.20 2011/01/04 22:30:40 pgoyette Exp $
 
 .include <bsd.own.mk>
 .include <bsd.sys.mk>
 
-TESTS_SUBDIRS+=	gen hash setjmp stdlib stdio string
-
-.if ${MACHINE_ARCH} != "vax" && ${MACHINE_ARCH} != "m68000"
-TESTS_SUBDIRS+=	ieeefp
-.endif
+TESTS_SUBDIRS+=	gen hash ieeefp setjmp stdlib stdio string
 
 .if ${HAS_SSP} == "yes"
 TESTS_SUBDIRS+=	ssp

Index: src/tests/lib/libc/ieeefp/t_except.c
diff -u src/tests/lib/libc/ieeefp/t_except.c:1.5 src/tests/lib/libc/ieeefp/t_except.c:1.6
--- src/tests/lib/libc/ieeefp/t_except.c:1.5	Mon Jan  3 20:51:26 2011
+++ src/tests/lib/libc/ieeefp/t_except.c	Tue Jan  4 22:30:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_except.c,v 1.5 2011/01/03 20:51:26 pgoyette Exp $	*/
+/*	$NetBSD: t_except.c,v 1.6 2011/01/04 22:30:41 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -27,17 +27,34 @@
  */
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
 #include <stdio.h>
 #include <signal.h>
-#include <assert.h>
-#include <ieeefp.h>
 #include <float.h>
 #include <setjmp.h>
 #include <stdlib.h>
 #include <string.h>
 
+#if defined(__mc68000__) || defined(__vax__)
+
+ATF_TC(no_test);
+
+ATF_TC_HEAD(no_test, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "Dummy test case");
+}
+
+ATF_TC_BODY(no_test, tc)
+{
+
+	atf_tc_skip("Test not available on this architecture.");
+}
+
+#else /* defined(__mc68000__) || defined(__vax__) */
+
+#include <ieeefp.h>
+
 const char *skip_mesg;
 const char *skip_arch;
 
@@ -45,15 +62,6 @@
 volatile sig_atomic_t signal_caught;
 volatile int sicode;
 
-#ifdef USE_FLOAT
-#define FPTYPE float
-#else
-#ifdef USE_LONGDOUBLE
-#define FPTYPE long double
-#else
-#define FPTYPE double
-#endif
-#endif
 static volatile const float	f_one   = 1.0;
 static volatile const float	f_zero  = 0.0;
 static volatile const double	d_one   = 1.0;
@@ -285,8 +293,8 @@
 	ATF_TC_BODY(m##_##t, tc)					\
 	{								\
 									\
-		if (skip_mesg != NULL)					\
-			atf_tc_skip(skip_mesg, skip_arch);		\
+		if (system("cpuctl identify 0 | grep -q QEMU") == 0)	\
+			atf_tc_skip("Test not applicable on QEMU");	\
 		m(t##_ops);						\
 	}
 
@@ -297,24 +305,21 @@
 TEST(unmasked, double)
 TEST(unmasked, long_double)
 
+#endif /* defined(__mc68000__) || defined(__vax__) */
+
 ATF_TP_ADD_TCS(tp)
 {
 
-	skip_arch = atf_config_get("atf_machine");
-	if (strcmp("vax", skip_arch) == 0 || strcmp("m68000", skip_arch) == 0)
-		skip_mesg = "Test not applicable on %s";
-	else if (system("cpuctl identify 0 | grep -q QEMU") == 0) {
-		skip_mesg = "Test does not run correctly under %s";
-		skip_arch = "QEMU";
-	} else
-		skip_mesg = NULL;
-
+#if defined(__mc68000__) || defined(__vax__)
+	ATF_TP_ADD_TC(tp, no_test);
+#else
 	ATF_TP_ADD_TC(tp, masked_float);
 	ATF_TP_ADD_TC(tp, masked_double);
 	ATF_TP_ADD_TC(tp, masked_long_double);
 	ATF_TP_ADD_TC(tp, unmasked_float);
 	ATF_TP_ADD_TC(tp, unmasked_double);
 	ATF_TP_ADD_TC(tp, unmasked_long_double);
+#endif
 
 	return atf_no_error();
 }

Index: src/tests/lib/libc/ieeefp/t_round.c
diff -u src/tests/lib/libc/ieeefp/t_round.c:1.1 src/tests/lib/libc/ieeefp/t_round.c:1.2
--- src/tests/lib/libc/ieeefp/t_round.c:1.1	Sun Jan  2 03:51:21 2011
+++ src/tests/lib/libc/ieeefp/t_round.c	Tue Jan  4 22:30:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_round.c,v 1.1 2011/01/02 03:51:21 pgoyette Exp $	*/
+/*	$NetBSD: t_round.c,v 1.2 2011/01/04 22:30:41 pgoyette Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 18, 1995
@@ -6,13 +6,15 @@
  */
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
-#include <ieeefp.h>
 #include <float.h>
 #include <stdlib.h>
 #include <string.h>
 
+#if !defined(__mc68000__) && !defined(__vax__)
+#include <ieeefp.h>
+#endif
+
 ATF_TC(fpround);
 
 ATF_TC_HEAD(fpround, tc)
@@ -25,6 +27,9 @@
 ATF_TC_BODY(fpround, tc)
 {
 
+#if defined(__mc68000__) || defined(__vax__)
+	atf_tc_skip("Test not applicable on this architecture.");
+#else
 	/*
 	 * This test would be better if it actually performed some
 	 * calculations to verify the selected rounding mode.  But
@@ -61,18 +66,13 @@
 
 	ATF_CHECK_EQ(fpgetround(), FP_RN);
 	ATF_CHECK_EQ(FLT_ROUNDS, 1);
+#endif /* defined(__mc68000__) || defined(__vax__) */
 }
 
 ATF_TP_ADD_TCS(tp)
 {
-	const char *arch;
 
-	arch = atf_config_get("atf_machine");
-	if (strcmp("vax", arch) == 0 || strcmp("m68000", arch) == 0)
-		atf_tc_skip("Test not applicable on %s", arch);
-	else {
-		ATF_TP_ADD_TC(tp, fpround);
-	}
+	ATF_TP_ADD_TC(tp, fpround);
 
 	return atf_no_error();
 }
Index: src/tests/lib/libc/ieeefp/t_subnormal.c
diff -u src/tests/lib/libc/ieeefp/t_subnormal.c:1.1 src/tests/lib/libc/ieeefp/t_subnormal.c:1.2
--- src/tests/lib/libc/ieeefp/t_subnormal.c:1.1	Sun Jan  2 03:51:21 2011
+++ src/tests/lib/libc/ieeefp/t_subnormal.c	Tue Jan  4 22:30:41 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_subnormal.c,v 1.1 2011/01/02 03:51:21 pgoyette Exp $ */
+/* $NetBSD: t_subnormal.c,v 1.2 2011/01/04 22:30:41 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,14 +30,30 @@
  */
 
 #include <atf-c.h>
-#include <atf-c/config.h>
 
-#include <assert.h>
 #include <float.h>
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
 
+#if defined(__vax__)
+
+ATF_TC(no_test);
+
+ATF_TC_HEAD(no_test, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr", "Dummy test");
+}
+
+ATF_TC_BODY(no_test,tc)
+{
+
+	atf_tc_skip("Test not available on this architecture");
+}
+
+#else /* defined(__vax__) */
+
 ATF_TC(test_float);
 
 ATF_TC_HEAD(test_float, tc)
@@ -180,21 +196,20 @@
 	ATF_REQUIRE_EQ(f, 0);
 }
 #endif /* TEST_LONG_DOUBLE */
+#endif /* defined(__vax__) */
 
 ATF_TP_ADD_TCS(tp)
 {
-	const char *arch;
 
-	arch = atf_config_get("atf_arch");
-	if (strcmp("vax", arch) == 0 || strcmp("m68000", arch) == 0)
-		printf("Test not applicable on %s\n", arch);
-	else {
-		ATF_TP_ADD_TC(tp, test_float);
-		ATF_TP_ADD_TC(tp, test_double);
+#if defined(__vax__)
+	ATF_TP_ADD_TC(tp, no_test);
+#else
+	ATF_TP_ADD_TC(tp, test_float);
+	ATF_TP_ADD_TC(tp, test_double);
 #ifdef TEST_LONG_DOUBLE
-		ATF_TP_ADD_TC(tp, test_long_double);
+	ATF_TP_ADD_TC(tp, test_long_double);
 #endif /* TEST_LONG_DOUBLE */
-	}
+#endif
 
 	return atf_no_error();
 }

Reply via email to