Module Name:    src
Committed By:   pgoyette
Date:           Mon Jan  3 20:51:26 UTC 2011

Modified Files:
        src/tests/lib/libc/gen: t_ldexp.c t_siginfo.c
        src/tests/lib/libc/ieeefp: t_except.c

Log Message:
Don't run FP Exception tests under qemu - they don't work.

While here, properly skip certain tests on vax architecture.  (It is
not legal to have a test-program with zero test cases, so each test
case needs to check-and-skip.)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/gen/t_ldexp.c
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/gen/t_siginfo.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/ieeefp/t_except.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/lib/libc/gen/t_ldexp.c
diff -u src/tests/lib/libc/gen/t_ldexp.c:1.2 src/tests/lib/libc/gen/t_ldexp.c:1.3
--- src/tests/lib/libc/gen/t_ldexp.c:1.2	Sat Jan  1 23:45:01 2011
+++ src/tests/lib/libc/gen/t_ldexp.c	Mon Jan  3 20:51:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ldexp.c,v 1.2 2011/01/01 23:45:01 pgoyette Exp $ */
+/* $NetBSD: t_ldexp.c,v 1.3 2011/01/03 20:51:26 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -182,7 +182,11 @@
 	}								\
 	ATF_TC_BODY(name, tc)						\
 	{								\
+		const char *arch;					\
 									\
+		arch = atf_config_get("atf_arch");			\
+		if (strcmp("vax", arch) == 0)				\
+			atf_tc_skip("Test not valid for %s", arch);	\
 		run_test(name);						\
 	}
 
@@ -196,19 +200,14 @@
 
 ATF_TP_ADD_TCS(tp)
 {
-	const char *arch;
 
-	arch = atf_config_get("atf_arch");
-	if (strcmp("vax", arch) != 0) {
-		ATF_TP_ADD_TC(tp, basics);
-		ATF_TP_ADD_TC(tp, zero);
-		ATF_TP_ADD_TC(tp, infinity);
-		ATF_TP_ADD_TC(tp, overflow);
-		ATF_TP_ADD_TC(tp, denormal);
-		ATF_TP_ADD_TC(tp, underflow);
-		ATF_TP_ADD_TC(tp, denormal_large_exp);
-	} else
-		printf("Test not valid for %s\n", arch);
+	ATF_TP_ADD_TC(tp, basics);
+	ATF_TP_ADD_TC(tp, zero);
+	ATF_TP_ADD_TC(tp, infinity);
+	ATF_TP_ADD_TC(tp, overflow);
+	ATF_TP_ADD_TC(tp, denormal);
+	ATF_TP_ADD_TC(tp, underflow);
+	ATF_TP_ADD_TC(tp, denormal_large_exp);
 
 	return atf_no_error();
 }

Index: src/tests/lib/libc/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.7 src/tests/lib/libc/gen/t_siginfo.c:1.8
--- src/tests/lib/libc/gen/t_siginfo.c:1.7	Sun Jan  2 21:39:24 2011
+++ src/tests/lib/libc/gen/t_siginfo.c	Mon Jan  3 20:51:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.7 2011/01/02 21:39:24 pgoyette Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.8 2011/01/03 20:51:26 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -296,6 +296,8 @@
 	struct sigaction sa;
 	double d = strtod("0", NULL);
 
+	if (system("cpuctl identify 0 | grep -q QEMU") == 0)
+		atf_tc_skip("Test does not run correctly under qemu");
 	if (sigsetjmp(sigfpe_flt_env, 0) == 0) {
 		sa.sa_flags = SA_SIGINFO;
 		sa.sa_sigaction = sigfpe_flt_action;

Index: src/tests/lib/libc/ieeefp/t_except.c
diff -u src/tests/lib/libc/ieeefp/t_except.c:1.4 src/tests/lib/libc/ieeefp/t_except.c:1.5
--- src/tests/lib/libc/ieeefp/t_except.c:1.4	Mon Jan  3 09:14:21 2011
+++ src/tests/lib/libc/ieeefp/t_except.c	Mon Jan  3 20:51:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_except.c,v 1.4 2011/01/03 09:14:21 dholland Exp $	*/
+/*	$NetBSD: t_except.c,v 1.5 2011/01/03 20:51:26 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -38,6 +38,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+const char *skip_mesg;
+const char *skip_arch;
+
 void sigfpe(int, siginfo_t *, void *);
 volatile sig_atomic_t signal_caught;
 volatile int sicode;
@@ -282,6 +285,8 @@
 	ATF_TC_BODY(m##_##t, tc)					\
 	{								\
 									\
+		if (skip_mesg != NULL)					\
+			atf_tc_skip(skip_mesg, skip_arch);		\
 		m(t##_ops);						\
 	}
 
@@ -294,19 +299,22 @@
 
 ATF_TP_ADD_TCS(tp)
 {
-	const char *arch;
 
-	arch = atf_config_get("atf_machine");
-	if (strcmp("vax", arch) == 0 || strcmp("m68000", arch) == 0)
-		printf("Test not applicable on %s", arch);
-	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);
-	}
+	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;
+
+	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);
 
 	return atf_no_error();
 }

Reply via email to