summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Rules.mak1
-rw-r--r--test/math/libm-test-ulps-nds32145
-rw-r--r--test/pthread/Makefile.in3
-rw-r--r--test/test-skeleton.c65
4 files changed, 199 insertions, 15 deletions
diff --git a/test/Rules.mak b/test/Rules.mak
index 4e76ed3..b81eb19 100644
--- a/test/Rules.mak
+++ b/test/Rules.mak
@@ -21,6 +21,7 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
-e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \
-e 's/sa110/arm/' -e 's/arm.*/arm/g' \
-e 's/m68k.*/m68k/' \
+ -e 's/nds32.*/nds32/' \
-e 's/parisc.*/hppa/' \
-e 's/ppc/powerpc/g' \
-e 's/sh[234].*/sh/' \
diff --git a/test/math/libm-test-ulps-nds32 b/test/math/libm-test-ulps-nds32
new file mode 100644
index 0000000..46b2ac5
--- /dev/null
+++ b/test/math/libm-test-ulps-nds32
@@ -0,0 +1,145 @@
+# Begin of automatic generation
+
+# cos
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+idouble: 1
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+# erf
+Test "erf (0.75) == 0.711155633653515131598937834591410777":
+double: 1
+idouble: 1
+Test "erf (1.25) == 0.922900128256458230136523481197281140":
+double: 1
+idouble: 1
+
+# erfc
+Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
+double: 1
+idouble: 1
+
+# exp
+Test "exp (1) == e":
+double: 1
+idouble: 1
+
+# expm1
+Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
+double: 1
+idouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# lgamma
+Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# log10
+Test "log10 (0.75) == -0.124938736608299953132449886193870744":
+double: 1
+idouble: 1
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+idouble: 1
+Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# Maximal error of functions:
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+idouble: 1
+
+Function: "exp":
+double: 1
+idouble: 1
+
+Function: "expm1":
+double: 1
+idouble: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "log":
+float: 1
+ifloat: 1
+
+Function: "log10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# end of automatic generation
diff --git a/test/pthread/Makefile.in b/test/pthread/Makefile.in
index b989334..c989b58 100644
--- a/test/pthread/Makefile.in
+++ b/test/pthread/Makefile.in
@@ -6,6 +6,9 @@ TESTS_DISABLED += cancellation-points
ifeq ($(TARGET_ARCH),microblaze)
TESTS_DISABLED += ex3
endif
+ifeq ($(TARGET_ARCH),nds32)
+TESTS_DISABLED += ex3
+endif
ifeq ($(TARGET_ARCH),sh)
TESTS_DISABLED += ex2 ex7
endif
diff --git a/test/test-skeleton.c b/test/test-skeleton.c
index 557996d..323a9c6 100644
--- a/test/test-skeleton.c
+++ b/test/test-skeleton.c
@@ -222,18 +222,15 @@ handler_killpid(int sig)
/* We provide the entry point here. */
int
-main (int argc, char *argv[])
+main (int argc, char *argv[], char *envp[])
{
-#ifdef __ARCH_USE_MMU__
int direct = 0; /* Directly call the test function? */
-#else
- int direct = 1;
-#endif
int status;
int opt;
unsigned int timeoutfactor = 1;
pid_t termpid;
char *envstr_timeoutfactor;
+ char **argv1;
/* Make uses of freed and uninitialized memory known. */
#ifdef __MALLOC_STANDARD__
@@ -303,19 +300,21 @@ main (int argc, char *argv[])
/* make sure temporary files are deleted. */
atexit (delete_temp_files);
- /* Correct for the possible parameters. */
- argv[optind - 1] = argv[0];
- argv += optind - 1;
- argc -= optind - 1;
+ /* If we are not expected to fork run the function immediately. */
+ if (direct)
+ {
+ /* Correct for the possible parameters. */
+ argv[optind - 1] = argv[0];
+ argv += optind - 1;
+ argc -= optind - 1;
- /* Call the initializing function, if one is available. */
+ /* Call the initializing function, if one is available. */
#ifdef PREPARE
- PREPARE (argc, argv);
+ PREPARE (argc, argv);
#endif
- /* If we are not expected to fork run the function immediately. */
- if (direct)
- return TEST_FUNCTION;
+ return TEST_FUNCTION;
+ }
/* Set up the test environment:
- prevent core dumps
@@ -340,15 +339,51 @@ main (int argc, char *argv[])
if (setpgid (0, 0) != 0)
printf ("Failed to set the process group ID: %m\n");
+ /* Correct for the possible parameters. */
+ argv[optind - 1] = argv[0];
+ argv += optind - 1;
+ argc -= optind - 1;
+
+ /* Call the initializing function, if one is available. */
+#ifdef PREPARE
+ PREPARE (argc, argv);
+#endif
+
/* Execute the test function and exit with the return value. */
exit (TEST_FUNCTION);
}
else if (pid < 0)
-#endif
{
perror ("Cannot fork test program");
exit (1);
}
+#else
+ argv1 = malloc ((argc + 2) * sizeof(void *));
+ argv1[0] = argv[0];
+ argv1[1] = "-d";
+ memcpy(argv1 + 2, argv + 1, argc * sizeof(void *));
+
+ pid = vfork ();
+ if (pid == 0)
+ {
+ /* This is the child. */
+ /* We put the test process in its own pgrp so that if it bogusly
+ generates any job control signals, they won't hit the whole build. */
+ if (setpgid (0, 0) != 0)
+ printf ("Failed to set the process group ID: %m\n");
+
+ if (execve (argv1[0], argv1, envp) < 0)
+ {
+ perror ("Cannot exec test program");
+ _exit (1);
+ }
+ }
+ else if (pid < 0)
+ {
+ perror ("Cannot vfork test program");
+ exit (1);
+ }
+#endif
#ifdef __XXX_HANDLE_CTRL_C
signal (SIGTERM, handler_killpid);