summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Test.mak1
-rw-r--r--test/dlopen/libtest.c1
-rw-r--r--test/dlopen/libtest1.c13
-rw-r--r--test/dlopen/libtest2.c11
-rw-r--r--test/inet/if_nameindex.c6
-rw-r--r--test/misc/bug-glob2.c4
-rw-r--r--test/misc/stdarg.c2
-rw-r--r--test/pthread/ex1.c2
-rw-r--r--test/pthread/ex2.c10
-rw-r--r--test/pthread/ex4.c6
-rw-r--r--test/pthread/ex5.c10
-rw-r--r--test/pthread/ex6.c2
-rw-r--r--test/pthread/ex7.c2
-rw-r--r--test/setjmp/tst-vfork-longjmp.c4
-rw-r--r--test/signal/sigchld.c12
-rw-r--r--test/signal/signal.c10
-rw-r--r--test/signal/tst-raise.c2
-rw-r--r--test/stat/memcmp-stat.c4
-rw-r--r--test/stat/stat.c2
-rw-r--r--test/stdlib/qsort.c66
-rw-r--r--test/unistd/clone.c4
-rw-r--r--test/unistd/errno.c2
-rw-r--r--test/unistd/fork.c2
23 files changed, 93 insertions, 85 deletions
diff --git a/test/Test.mak b/test/Test.mak
index f3c61479b..a5bc968c7 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -36,6 +36,7 @@ endif
CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS)
test check all: $(TARGETS)
+ @true
$(TARGETS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
$(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
diff --git a/test/dlopen/libtest.c b/test/dlopen/libtest.c
index e37f77981..a306e4bf7 100644
--- a/test/dlopen/libtest.c
+++ b/test/dlopen/libtest.c
@@ -4,6 +4,7 @@
extern int __pthread_once(void);
+void dltest(uint32_t **value1, uint32_t **value2);
void dltest(uint32_t **value1, uint32_t **value2)
{
*value1 = (uint32_t *) __pthread_once;
diff --git a/test/dlopen/libtest1.c b/test/dlopen/libtest1.c
index f0dc9f537..a2f7dcdc0 100644
--- a/test/dlopen/libtest1.c
+++ b/test/dlopen/libtest1.c
@@ -2,28 +2,31 @@
extern int libtest2_func(const char *s);
-
-void __attribute__((constructor)) libtest1_ctor(void)
+void __attribute__((constructor)) libtest1_ctor(void);
+void libtest1_ctor(void)
{
printf("libtest1: constructor!\n");
}
-void __attribute__((destructor)) libtest1_dtor(void)
+void __attribute__((destructor)) libtest1_dtor(void);
+void libtest1_dtor(void)
{
printf("libtest1: destructor!\n");
}
-void __attribute__((weak)) function1(void)
+void __attribute__((weak)) function1(void);
+void function1(void)
{
printf("libtest1: I am weak function1!\n");
}
+void function2(void);
void function2(void)
{
printf("libtest1: I am function2!\n");
}
-
+int dltest(const char *s);
int dltest(const char *s)
{
printf( "libtest1: function1 = %p\n"
diff --git a/test/dlopen/libtest2.c b/test/dlopen/libtest2.c
index 529f8bb66..526150666 100644
--- a/test/dlopen/libtest2.c
+++ b/test/dlopen/libtest2.c
@@ -1,27 +1,32 @@
#include <stdio.h>
#include <pthread.h>
-void __attribute__((constructor)) libtest2_ctor(void)
+void __attribute__((constructor)) libtest2_ctor(void);
+void libtest2_ctor(void)
{
printf("libtest2: constructor!\n");
}
-void __attribute__((destructor)) libtest2_dtor(void)
+void __attribute__((destructor)) libtest2_dtor(void);
+void libtest2_dtor(void)
{
printf("libtest2: destructor!\n");
}
+void function1(void);
void function1(void)
{
printf("libtest2: I am function1!\n");
}
-void __attribute__((weak)) function2(void)
+void __attribute__((weak)) function2(void);
+void function2(void)
{
printf("libtest2: I am weak function2!\n");
}
+int libtest2_func(const char *s);
int libtest2_func(const char *s)
{
printf( "libtest2: function1 = %p\n"
diff --git a/test/inet/if_nameindex.c b/test/inet/if_nameindex.c
index 069d96d99..126c5bab4 100644
--- a/test/inet/if_nameindex.c
+++ b/test/inet/if_nameindex.c
@@ -11,7 +11,7 @@
static char ifname[IF_NAMESIZE];
-void test_if_nameindex(void)
+static void test_if_nameindex(void)
{
size_t i;
struct if_nameindex *ret;
@@ -30,7 +30,7 @@ void test_if_nameindex(void)
if_freenameindex(ret);
}
-void test_if_indextoname(void)
+static void test_if_indextoname(void)
{
if (if_indextoname(1, ifname) == NULL) {
perror("if_nameindex()");
@@ -40,7 +40,7 @@ void test_if_indextoname(void)
printf("if_indextoname(1) = %s\n", ifname);
}
-void test_if_nametoindex(void)
+static void test_if_nametoindex(void)
{
int ifindex = if_nametoindex(ifname);
diff --git a/test/misc/bug-glob2.c b/test/misc/bug-glob2.c
index 424ff4f48..9e8be983b 100644
--- a/test/misc/bug-glob2.c
+++ b/test/misc/bug-glob2.c
@@ -264,7 +264,7 @@ init_glob_altdirfuncs (glob_t *pglob)
}
-int
+static int
do_test (void)
{
glob_t gl;
@@ -295,7 +295,7 @@ do_test (void)
return 0;
}
#else
-int do_test (void) { return 0; }
+static int do_test (void) { return 0; }
#endif
#define TEST_FUNCTION do_test ()
diff --git a/test/misc/stdarg.c b/test/misc/stdarg.c
index 561fd2c3b..1566e0ce8 100644
--- a/test/misc/stdarg.c
+++ b/test/misc/stdarg.c
@@ -5,7 +5,7 @@
#include <string.h>
#include <sys/types.h>
#include <stdarg.h>
-int foo(const char *format, ...)
+static int foo(const char *format, ...)
{
va_list ap;
size_t len;
diff --git a/test/pthread/ex1.c b/test/pthread/ex1.c
index a1b24c31a..4d9de03d8 100644
--- a/test/pthread/ex1.c
+++ b/test/pthread/ex1.c
@@ -7,7 +7,7 @@
#include <unistd.h>
#include "pthread.h"
-void *process(void * arg)
+static void *process(void * arg)
{
int i;
printf("Starting process %s\n", (char *)arg);
diff --git a/test/pthread/ex2.c b/test/pthread/ex2.c
index 70cb6b398..98bd4b347 100644
--- a/test/pthread/ex2.c
+++ b/test/pthread/ex2.c
@@ -20,7 +20,7 @@ struct prodcons {
/* Initialize a buffer */
-void init(struct prodcons * b)
+static void init(struct prodcons * b)
{
pthread_mutex_init(&b->lock, NULL);
pthread_cond_init(&b->notempty, NULL);
@@ -31,7 +31,7 @@ void init(struct prodcons * b)
/* Store an integer in the buffer */
-void put(struct prodcons * b, int data)
+static void put(struct prodcons * b, int data)
{
pthread_mutex_lock(&b->lock);
/* Wait until buffer is not full */
@@ -50,7 +50,7 @@ void put(struct prodcons * b, int data)
/* Read and remove an integer from the buffer */
-int get(struct prodcons * b)
+static int get(struct prodcons * b)
{
int data;
pthread_mutex_lock(&b->lock);
@@ -75,7 +75,7 @@ int get(struct prodcons * b)
struct prodcons buffer;
-void * producer(void * data)
+static void * producer(void * data)
{
int n;
for (n = 0; n < 10000; n++) {
@@ -86,7 +86,7 @@ void * producer(void * data)
return NULL;
}
-void * consumer(void * data)
+static void * consumer(void * data)
{
int d;
while (1) {
diff --git a/test/pthread/ex4.c b/test/pthread/ex4.c
index 11a09f013..cf4cf1d69 100644
--- a/test/pthread/ex4.c
+++ b/test/pthread/ex4.c
@@ -14,7 +14,7 @@
#if 0
-char * str_accumulate(char * s)
+static char * str_accumulate(char * s)
{
static char accu[1024] = { 0 };
strcat(accu, s);
@@ -40,7 +40,7 @@ static void str_alloc_destroy_accu(void * accu);
/* Thread-safe version of str_accumulate */
-char * str_accumulate(const char * s)
+static char * str_accumulate(const char * s)
{
char * accu;
@@ -81,7 +81,7 @@ static void str_alloc_destroy_accu(void * accu)
/* Test program */
-void * process(void * arg)
+static void * process(void * arg)
{
char * res;
res = str_accumulate("Result of ");
diff --git a/test/pthread/ex5.c b/test/pthread/ex5.c
index 475de0e0c..7a293eb01 100644
--- a/test/pthread/ex5.c
+++ b/test/pthread/ex5.c
@@ -19,7 +19,7 @@ struct prodcons {
/* Initialize a buffer */
-void init(struct prodcons * b)
+static void init(struct prodcons * b)
{
sem_init(&b->sem_write, 0, BUFFER_SIZE - 1);
sem_init(&b->sem_read, 0, 0);
@@ -29,7 +29,7 @@ void init(struct prodcons * b)
/* Store an integer in the buffer */
-void put(struct prodcons * b, int data)
+static void put(struct prodcons * b, int data)
{
/* Wait until buffer is not full */
sem_wait(&b->sem_write);
@@ -43,7 +43,7 @@ void put(struct prodcons * b, int data)
/* Read and remove an integer from the buffer */
-int get(struct prodcons * b)
+static int get(struct prodcons * b)
{
int data;
/* Wait until buffer is not empty */
@@ -64,7 +64,7 @@ int get(struct prodcons * b)
struct prodcons buffer;
-void * producer(void * data)
+static void * producer(void * data)
{
int n;
for (n = 0; n < 10000; n++) {
@@ -75,7 +75,7 @@ void * producer(void * data)
return NULL;
}
-void * consumer(void * data)
+static void * consumer(void * data)
{
int d;
while (1) {
diff --git a/test/pthread/ex6.c b/test/pthread/ex6.c
index 15914ce85..bb96ca5fa 100644
--- a/test/pthread/ex6.c
+++ b/test/pthread/ex6.c
@@ -4,7 +4,7 @@
#include <pthread.h>
#include <unistd.h>
-void *
+static void *
test_thread (void *v_param)
{
return NULL;
diff --git a/test/pthread/ex7.c b/test/pthread/ex7.c
index bda2ca9eb..93fc34a8c 100644
--- a/test/pthread/ex7.c
+++ b/test/pthread/ex7.c
@@ -22,7 +22,7 @@ typedef struct {
event_t main_event;
-void *
+static void *
test_thread (void *ms_param)
{
unsigned long status = 0;
diff --git a/test/setjmp/tst-vfork-longjmp.c b/test/setjmp/tst-vfork-longjmp.c
index c64e80559..278442472 100644
--- a/test/setjmp/tst-vfork-longjmp.c
+++ b/test/setjmp/tst-vfork-longjmp.c
@@ -16,7 +16,7 @@
int verbose = 0;
-int execute_child(const char *prog)
+static int execute_child(const char *prog)
{
int status;
pid_t child;
@@ -33,7 +33,7 @@ int execute_child(const char *prog)
sigset_t orig_mask;
-int check_sig_mask(void)
+static int check_sig_mask(void)
{
int status;
pid_t child;
diff --git a/test/signal/sigchld.c b/test/signal/sigchld.c
index 60ddf4b3c..d53165419 100644
--- a/test/signal/sigchld.c
+++ b/test/signal/sigchld.c
@@ -7,16 +7,15 @@
#include <unistd.h>
-void test_handler(int signo)
+#ifdef __ARCH_USE_MMU__
+
+static void test_handler(int signo)
{
write(1, "caught SIGCHLD\n", 15);
return;
}
-
-#ifdef __ARCH_USE_MMU__
-
-int main(void)
+int main(void)
{
pid_t mypid;
struct sigaction siga;
@@ -31,7 +30,6 @@ int main(void)
fprintf(stderr, "sigaction choked: %s!", strerror(errno));
exit(EXIT_FAILURE);
}
-
/* Setup a child process to exercise the sig handling for us */
mypid = getpid();
@@ -52,7 +50,7 @@ int main(void)
sleep(10);
if (waitpid(-1, NULL, WNOHANG | WUNTRACED) > 0)
break;
- write(1, "after sleep\n", 12);
+ write(1, "after sleep\n", 12);
}
printf("Bye-bye! All done!\n");
diff --git a/test/signal/signal.c b/test/signal/signal.c
index 6e6f04a7a..01d1a785f 100644
--- a/test/signal/signal.c
+++ b/test/signal/signal.c
@@ -24,7 +24,7 @@
const char *it = "<UNSET>"; /* Routine name for message routines. */
size_t errors = 0;
-void check(int thing, int number)
+static void check(int thing, int number)
{
if (!thing) {
printf("%s: flunked test %d\n", it, number);
@@ -32,10 +32,12 @@ void check(int thing, int number)
}
}
-void equal(const char *a, const char *b, int number)
+#if 0
+static void equal(const char *a, const char *b, int number)
{
check(a != NULL && b != NULL && (strcmp(a, b) == 0), number);
}
+#endif
/* -------------------------------------------------*/
@@ -44,14 +46,14 @@ void equal(const char *a, const char *b, int number)
int global_int = 0;
-void set_global_int_to_one(int signum)
+static void set_global_int_to_one(int signum)
{
printf ("Received signal %d (%s).\n", signum, strsignal(signum));
global_int = 1;
return;
}
-void signal_test_1(void)
+static void signal_test_1(void)
{
global_int = 0;
diff --git a/test/signal/tst-raise.c b/test/signal/tst-raise.c
index 9e8e472be..d24c316cf 100644
--- a/test/signal/tst-raise.c
+++ b/test/signal/tst-raise.c
@@ -26,7 +26,7 @@
volatile int count;
-void
+static void
sh (int sig)
{
++count;
diff --git a/test/stat/memcmp-stat.c b/test/stat/memcmp-stat.c
index 3e0143e94..c38e3ff88 100644
--- a/test/stat/memcmp-stat.c
+++ b/test/stat/memcmp-stat.c
@@ -18,7 +18,7 @@
#include <assert.h>
#include <time.h>
-void show_stat(struct stat *st)
+static void show_stat(struct stat *st)
{
printf(
"------------------\n"
@@ -66,7 +66,7 @@ void show_stat(struct stat *st)
);
}
-int main()
+int main(void)
{
int ret;
int fd;
diff --git a/test/stat/stat.c b/test/stat/stat.c
index c9e063f27..4980cdd78 100644
--- a/test/stat/stat.c
+++ b/test/stat/stat.c
@@ -5,7 +5,7 @@
#include <unistd.h>
#include <stdlib.h>
-void print_struct_stat(char *msg, struct stat *s)
+static void print_struct_stat(char *msg, struct stat *s)
{
printf("%s\n", msg);
/* The casts are because glibc thinks it's cool */
diff --git a/test/stdlib/qsort.c b/test/stdlib/qsort.c
index 9e706c78d..abc505e2d 100644
--- a/test/stdlib/qsort.c
+++ b/test/stdlib/qsort.c
@@ -3,45 +3,43 @@
#include <stdlib.h>
#include <unistd.h>
-int select_files(const struct dirent *dirbuf)
+static int select_files(const struct dirent *dirbuf)
{
- if (dirbuf->d_name[0] == '.')
- return 0;
- else
- return 1;
+ if (dirbuf->d_name[0] == '.')
+ return 0;
+ else
+ return 1;
}
-
int main(void)
{
- struct dirent **array;
- struct dirent *dirbuf;
+ struct dirent **array;
+ struct dirent *dirbuf;
- int i, numdir;
+ int i, numdir;
- chdir("/");
- numdir = scandir(".", &array, select_files, NULL);
- printf("\nGot %d entries from scandir().\n", numdir);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- free(array[i]);
- }
- free(array);
- numdir = scandir(".", &array, select_files, alphasort);
- printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- }
- printf("\nCalling qsort()\n");
- qsort(array, numdir, sizeof(struct dirent *), alphasort);
- for (i = 0; i < numdir; ++i) {
- dirbuf = array[i];
- printf("[%d] %s\n", i, dirbuf->d_name);
- free(array[i]);
- }
- free(array);
- return(0);
+ chdir("/");
+ numdir = scandir(".", &array, select_files, NULL);
+ printf("\nGot %d entries from scandir().\n", numdir);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ free(array[i]);
+ }
+ free(array);
+ numdir = scandir(".", &array, select_files, alphasort);
+ printf("\nGot %d entries from scandir() using alphasort().\n", numdir);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ }
+ printf("\nCalling qsort()\n");
+ qsort(array, numdir, sizeof(struct dirent *), alphasort);
+ for (i = 0; i < numdir; ++i) {
+ dirbuf = array[i];
+ printf("[%d] %s\n", i, dirbuf->d_name);
+ free(array[i]);
+ }
+ free(array);
+ return (0);
}
-
diff --git a/test/unistd/clone.c b/test/unistd/clone.c
index bc08c94bf..ea7e6ac64 100644
--- a/test/unistd/clone.c
+++ b/test/unistd/clone.c
@@ -19,12 +19,12 @@
#define GOT3 (1 << 3)
#define ALLGOT (GOT1|GOT2|GOT3)
-void child_handler(int sig)
+static void child_handler(int sig)
{
printf("I got a SIGCHLD\n");
}
-int clone_main(void *arg)
+static int clone_main(void *arg)
{
unsigned long input = (unsigned long)arg;
int secs = (input / 10) * 4;
diff --git a/test/unistd/errno.c b/test/unistd/errno.c
index c77f58aa2..b9e0f5216 100644
--- a/test/unistd/errno.c
+++ b/test/unistd/errno.c
@@ -6,7 +6,7 @@
#include <sched.h>
#include "clone_cruft.h"
-int child_fn(void *arg)
+static int child_fn(void *arg)
{
fprintf(stderr, "in child_fn\n");
exit(1);
diff --git a/test/unistd/fork.c b/test/unistd/fork.c
index b163c0ef9..6d132d6d8 100644
--- a/test/unistd/fork.c
+++ b/test/unistd/fork.c
@@ -18,7 +18,7 @@
#ifdef __ARCH_USE_MMU__
-void child_handler(int sig)
+static void child_handler(int sig)
{
fprintf(stderr, "I got a SIGCHLD\n");
}