summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-27 01:44:05 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-27 01:44:05 +0000
commit8e31aa28dc8d1e557233f322398535f5ebba47e3 (patch)
treea238d063cff8f65c6addba557b16d5b3f1948857 /test
parent7d3c3aab45e7fd6b6f5c24341885ed41bce8db91 (diff)
add a basic errno test based on one from ltp
Diffstat (limited to 'test')
-rw-r--r--test/unistd/Makefile2
-rw-r--r--test/unistd/errno.c27
2 files changed, 28 insertions, 1 deletions
diff --git a/test/unistd/Makefile b/test/unistd/Makefile
index d684f0690..4db50174d 100644
--- a/test/unistd/Makefile
+++ b/test/unistd/Makefile
@@ -1,7 +1,7 @@
# uClibc unistd tests
# Licensed under the GNU Library General Public License, see COPYING.LIB
-TESTS = clone fork getcwd getopt getopt_long preadwrite vfork
+TESTS = clone errno fork getcwd getopt getopt_long preadwrite vfork
include ../Test.mak
diff --git a/test/unistd/errno.c b/test/unistd/errno.c
new file mode 100644
index 000000000..746c21d89
--- /dev/null
+++ b/test/unistd/errno.c
@@ -0,0 +1,27 @@
+/* based originally on one the clone tests in the LTP */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sched.h>
+
+int child_fn(void *arg)
+{
+ fprintf(stderr, "in child_fn\n");
+ exit(1);
+}
+
+int main(void)
+{
+ int r_clone, ret_errno;
+
+ r_clone = clone(child_fn, NULL, (int) NULL, NULL);
+ ret_errno = errno;
+ if (ret_errno != EINVAL) {
+ fprintf(stderr, "clone: res=%d (%d) errno=%d %m\n",
+ r_clone, (int) NULL, errno);
+ return 1;
+ }
+
+ return 0;
+}