From 067637375658047d70c296606ae17ef0bc86499d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 12 Dec 2014 16:18:12 +0100 Subject: unistd: allow to turn off getopt_long The GNU variant of getopt() previously had no way to turn off getopt_long() support. --- test/test-skeleton.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test/test-skeleton.c') diff --git a/test/test-skeleton.c b/test/test-skeleton.c index 6d4a8b636..743339f8d 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -18,7 +18,6 @@ . */ #include -#include #include #include #include @@ -46,6 +45,7 @@ #define OPT_DIRECT 1000 #define OPT_TESTDIR 1001 +#if 0 /* Not used in uClibc */ static struct option options[] = { #ifdef CMDLINE_OPTIONS @@ -55,6 +55,7 @@ static struct option options[] = { "test-dir", required_argument, NULL, OPT_TESTDIR }, { NULL, 0, NULL, 0 } }; +#endif /* PID of the test itself. */ static pid_t pid; @@ -234,7 +235,14 @@ main (int argc, char *argv[]) setbuf (stdout, NULL); #endif +#if 0 /* Not used in uClibc */ while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1) +#else +# ifndef CMDLINE_OPTIONS +# define CMDLINE_OPTIONS "" +# endif + while ((opt = getopt (argc, argv, "+" CMDLINE_OPTIONS)) >= 0) +#endif switch (opt) { case '?': -- cgit v1.2.3 From bff3a664e6a2a367bf159c3089df1fe6f093bfb1 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 15 Dec 2014 17:32:57 +0100 Subject: test: Some more tests under conditionals Signed-off-by: Bernhard Reutner-Fischer --- test/test-skeleton.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/test-skeleton.c') diff --git a/test/test-skeleton.c b/test/test-skeleton.c index 743339f8d..69ef99f76 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -145,7 +145,9 @@ signal_handler (int sig __attribute__ ((unused))) /* Wait for it to terminate. */ for (i = 0; i < 5; ++i) { +#ifdef __UCLIBC_HAS_REALTIME__ struct timespec ts; +#endif killed = waitpid (pid, &status, WNOHANG|WUNTRACED); if (killed != 0) break; @@ -154,9 +156,14 @@ signal_handler (int sig __attribute__ ((unused))) nanosleep() call return prematurely, all the better. We won't restart it since this probably means the child process finally died. */ +#ifdef __UCLIBC_HAS_REALTIME__ ts.tv_sec = 0; ts.tv_nsec = 100000000; nanosleep (&ts, NULL); +#else + /* No nanosleep, just sleep 1s instead of 0.1s */ + sleep(1); +#endif } if (killed != 0 && killed != pid) { -- cgit v1.2.3