From 99ef2719fb3d703fe38c4113cd7f5adec516dd3a Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 28 Oct 2016 20:29:21 +0200 Subject: test: remove test suite The test suite is now a developed in a separate git repository. See here: http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng-test.git The test suite should be just like every other software compiled with the cross-toolchain. In the past strange problems where found when the test suite got build in the toolchain creation step. --- test/unistd/Makefile | 8 -- test/unistd/Makefile.in | 44 ------- test/unistd/clone.c | 101 --------------- test/unistd/clone_cruft.h | 24 ---- test/unistd/errno.c | 29 ----- test/unistd/exec-null.c | 13 -- test/unistd/fork.c | 91 -------------- test/unistd/getcwd.c | 39 ------ test/unistd/getopt.c | 69 ----------- test/unistd/getopt_long.c | 93 -------------- test/unistd/tst-fallocate.c | 166 ------------------------- test/unistd/tst-fallocate64.c | 2 - test/unistd/tst-getconf.sh | 240 ------------------------------------ test/unistd/tst-posix_fallocate.c | 127 ------------------- test/unistd/tst-posix_fallocate64.c | 2 - test/unistd/tst-preadwrite.c | 104 ---------------- test/unistd/tst-preadwrite64.c | 23 ---- test/unistd/tst-pselect.c | 51 -------- test/unistd/tstgetopt.c | 76 ------------ test/unistd/vfork.c | 53 -------- 20 files changed, 1355 deletions(-) delete mode 100644 test/unistd/Makefile delete mode 100644 test/unistd/Makefile.in delete mode 100644 test/unistd/clone.c delete mode 100644 test/unistd/clone_cruft.h delete mode 100644 test/unistd/errno.c delete mode 100644 test/unistd/exec-null.c delete mode 100644 test/unistd/fork.c delete mode 100644 test/unistd/getcwd.c delete mode 100644 test/unistd/getopt.c delete mode 100644 test/unistd/getopt_long.c delete mode 100644 test/unistd/tst-fallocate.c delete mode 100644 test/unistd/tst-fallocate64.c delete mode 100755 test/unistd/tst-getconf.sh delete mode 100644 test/unistd/tst-posix_fallocate.c delete mode 100644 test/unistd/tst-posix_fallocate64.c delete mode 100644 test/unistd/tst-preadwrite.c delete mode 100644 test/unistd/tst-preadwrite64.c delete mode 100644 test/unistd/tst-pselect.c delete mode 100644 test/unistd/tstgetopt.c delete mode 100644 test/unistd/vfork.c (limited to 'test/unistd') diff --git a/test/unistd/Makefile b/test/unistd/Makefile deleted file mode 100644 index 796d7ccea..000000000 --- a/test/unistd/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# uClibc unistd tests -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - -top_builddir=../../ -top_srcdir=../../ -include ../Rules.mak --include Makefile.in -include ../Test.mak diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in deleted file mode 100644 index 5b65c13c6..000000000 --- a/test/unistd/Makefile.in +++ /dev/null @@ -1,44 +0,0 @@ -# uClibc unistd tests -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - -TESTS_DISABLED := -# If LFS is not set, get rid of all *64 tests up front -ifeq ($(UCLIBC_HAS_LFS),) -TESTS_DISABLED += tst-preadwrite64 -endif - -# If we don't have LINUX_SPECIFIC, then get rid of tst-fallocate -ifeq ($(UCLIBC_LINUX_SPECIFIC),) -TESTS_DISABLED += tst-fallocate -endif - -ifeq ($(TARGET_avr32),y) -TESTS_DISABLED += tst-fallocate tst-posix_fallocate tst-fallocate64 -endif - -# The logic is similar for HAS_ADVANCED_REALTIME and -# tst-posix_fallocate/tst-posix_fallocate64 -ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),) -TESTS_DISABLED += tst-posix_fallocate -endif - -OPTS_getopt := -abcXXX -9 -OPTS_getopt_long := --add XXX --delete YYY --verbose -ifeq ($(UCLIBC_HAS_GNU_GETOPT),y) -OPTS_tstgetopt := -a -b -cfoobar --required foobar --optional=bazbug --none random --col --color --colour -else -# reordering is not supported, behaves as if POSIXLY_CORRECT would be set -OPTS_tstgetopt := -a -b -cfoobar --required foobar --optional=bazbug --none --colou --color --colour random -endif - -# for embedded systems 4 GB disk space is not available -TESTS_DISABLED += tst-posix_fallocate64 tst-fallocate64 - -# getconf.c lives in utils/ -# Testsuite cannot currently be built with O= anyway, so hardcode path here -getconf.c: - $(LN_S) ../../utils/$(@F) . -EXTRA_CLEAN += getconf.c -TESTS_DISABLED += getconf -CFLAGS_getconf = -DGETCONF_DIR='"$(CURDIR)"' -shell_tst-getconf: getconf getconf_glibc diff --git a/test/unistd/clone.c b/test/unistd/clone.c deleted file mode 100644 index ea7e6ac64..000000000 --- a/test/unistd/clone.c +++ /dev/null @@ -1,101 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * clone test for uClibc - * Copyright (C) 2000-2006 by Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include -#include -#include -#include -#include -#include -#include "clone_cruft.h" - -#define GOT1 (1 << 1) -#define GOT2 (1 << 2) -#define GOT3 (1 << 3) -#define ALLGOT (GOT1|GOT2|GOT3) - -static void child_handler(int sig) -{ - printf("I got a SIGCHLD\n"); -} - -static int clone_main(void *arg) -{ - unsigned long input = (unsigned long)arg; - int secs = (input / 10) * 4; - printf("Clone got %lu, sleeping for %i secs\n", input, secs); - sleep(secs); - return input + 20; -} - -int main(void) -{ - int clone1, clone2, clone3; - char clone1_stack[8192], clone2_stack[8192], clone3_stack[8192]; - int status, nostatus, result, wpid; - - signal(SIGCHLD, child_handler); - - if ((clone1 = do_clone(clone_main, clone1_stack, 0, (void*)11)) == -1) { - perror("Clone 1 failed"); - exit(-1); - } - if ((clone2 = do_clone(clone_main, clone2_stack, 0, (void*)22)) == -1) { - perror("Clone 2 failed"); - exit(-2); - } - if ((clone3 = do_clone(clone_main, clone3_stack, 0, (void*)33)) == -1) { - perror("Clone 3 failed"); - exit(-3); - } - - sleep(1); - printf("Parent: waiting for the clones to die.\n"); - nostatus = status = 0; - while (1) { - if ((wpid = waitpid(clone1, &result, WNOHANG|__WCLONE)) == -1) - nostatus |= GOT1; - if (wpid == clone1) { - status |= GOT1; - printf("Clone1 gave back %i\n", WEXITSTATUS(result)); - } - - if ((wpid = waitpid(clone2, &result, WNOHANG|__WCLONE)) == -1) - nostatus |= GOT2; - if (wpid == clone2) { - status |= GOT2; - printf("Clone2 gave back %i\n", WEXITSTATUS(result)); - } - - if ((wpid = waitpid(clone3, &result, WNOHANG|__WCLONE)) == -1) - nostatus |= GOT3; - if (wpid == clone3) { - status |= GOT3; - printf("Clone3 gave back %i\n", WEXITSTATUS(result)); - } - - if (status == ALLGOT || nostatus == ALLGOT) - break; - } - - if (status == ALLGOT) { - printf("Clones exited.\nGoodbye.\n"); - return EXIT_SUCCESS; - } else { - perror("Waiting for clones failed"); - return EXIT_FAILURE; - } -} - -/* -Local Variables: -c-file-style: "linux" -c-basic-offset: 4 -tab-width: 4 -End: -*/ diff --git a/test/unistd/clone_cruft.h b/test/unistd/clone_cruft.h deleted file mode 100644 index b6a395d06..000000000 --- a/test/unistd/clone_cruft.h +++ /dev/null @@ -1,24 +0,0 @@ -/* because people like to make things difficult */ - -#undef do_clone - -#define crappy_sizeof(s) (s == NULL ? 0 : sizeof(s)) - -#if defined __ia64__ - -extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, - size_t __child_stack_size, int __flags, void *__arg, ...); -# define do_clone(fn, stack, flags, arg) \ - __clone2(fn, stack, crappy_sizeof(stack), flags, arg, NULL, NULL, NULL) - -#elif defined __hppa__ - -# define do_clone(fn, stack, flags, arg) \ - clone(fn, stack, flags, arg) - -#else - -# define do_clone(fn, stack, flags, arg) \ - clone(fn, stack+crappy_sizeof(stack), flags, arg) - -#endif diff --git a/test/unistd/errno.c b/test/unistd/errno.c deleted file mode 100644 index 5d4fc726a..000000000 --- a/test/unistd/errno.c +++ /dev/null @@ -1,29 +0,0 @@ -/* based originally on one the clone tests in the LTP */ - -#include -#include -#include -#include -#include "clone_cruft.h" - -__attribute__ ((__noreturn__)) -static int child_fn(void *arg) -{ - fprintf(stderr, "in child_fn\n"); - exit(1); -} - -int main(void) -{ - int r_clone, ret_errno; - - r_clone = do_clone(child_fn, NULL, 0, NULL); - ret_errno = errno; - if (ret_errno != EINVAL || r_clone != -1) { - fprintf(stderr, "clone: res=%d (wanted -1) errno=%d (wanted %d)\n", - r_clone, errno, EINVAL); - return 1; - } - - return 0; -} diff --git a/test/unistd/exec-null.c b/test/unistd/exec-null.c deleted file mode 100644 index 3df99f3ce..000000000 --- a/test/unistd/exec-null.c +++ /dev/null @@ -1,13 +0,0 @@ -/* make sure we handle argv[0] == NULL */ - -#include - -int main(int argc, char *argv[]) -{ - if (argc == 0) - return 0; - - char *exec_argv[1], *exec_envp[1]; - exec_argv[0] = exec_envp[0] = NULL; - return execve("./exec-null", exec_argv, exec_envp); -} diff --git a/test/unistd/fork.c b/test/unistd/fork.c deleted file mode 100644 index 6d132d6d8..000000000 --- a/test/unistd/fork.c +++ /dev/null @@ -1,91 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * fork test for uClibc - * Copyright (C) 2000-2006 by Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include -#include -#include -#include -#include - -#define GOT1 (1 << 1) -#define GOT2 (1 << 2) -#define GOT3 (1 << 3) - -#ifdef __ARCH_USE_MMU__ - -static void child_handler(int sig) -{ - fprintf(stderr, "I got a SIGCHLD\n"); -} - -int main(void) -{ - pid_t pid1, pid2, pid3; - int status, result, wpid; - - signal(SIGCHLD, child_handler); - - if ((pid1 = fork()) == 0) { - fprintf(stderr, "The child process sleeps 2 seconds...\n"); - sleep(4); - fprintf(stderr, "Child exiting.\n"); - exit(-1); - } - if ((pid2 = fork()) == 0) { - fprintf(stderr, "The child process sleeps 3 seconds...\n"); - sleep(3); - fprintf(stderr, "Child exiting.\n"); - exit(-1); - } - if ((pid3 = fork()) == 0) { - fprintf(stderr, "The child process sleeps 4 seconds...\n"); - sleep(2); - fprintf(stderr, "Child exiting.\n"); - exit(-1); - } - - fprintf(stderr, "Parent: waiting for the child to die.\n"); - status = 0; - while (1) { - wpid = waitpid(pid1, &result, WNOHANG); - if (wpid == pid1) - status |= GOT1; - - wpid = waitpid(pid2, &result, WNOHANG); - if (wpid == pid2) - status |= GOT2; - - wpid = waitpid(pid3, &result, WNOHANG); - if (wpid == pid3) - status |= GOT3; - - if (status == (GOT1 | GOT2 | GOT3)) - break; - } - - fprintf(stderr, "Child process exited.\nGoodbye.\n"); - return EXIT_SUCCESS; -} - -#else - -int main(void) -{ - printf("Skipping test on non-mmu host!\n"); - return EXIT_SUCCESS; -} - -#endif - -/* -Local Variables: -c-file-style: "linux" -c-basic-offset: 4 -tab-width: 4 -End: -*/ diff --git a/test/unistd/getcwd.c b/test/unistd/getcwd.c deleted file mode 100644 index bcecec7be..000000000 --- a/test/unistd/getcwd.c +++ /dev/null @@ -1,39 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * fork test for uClibc - * Copyright (C) 2000-2006 by Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include -#include -#include - -int main(void) -{ - char *foo; - char junk[12]; - char crap[100]; - foo = getcwd(NULL, 0); - printf("getcwd(NULL, 0)='%s'\n", foo); - if (foo) { free(foo); } - foo = getcwd(NULL, 100); - printf("\ngetcwd(NULL, 100)='%s'\n", foo); - if (foo) { free(foo); } - foo = getcwd(junk, sizeof(junk)); - printf("\nchar junk[12];\n"); - printf("getcwd(junk, sizeof(junk))='%s'\n", foo); - foo = getcwd(crap, sizeof(crap)); - printf("\nchar crap[100];\n"); - printf("getcwd(crap, sizeof(crap))='%s'\n", foo); - return EXIT_SUCCESS; -} - -/* -Local Variables: -c-file-style: "linux" -c-basic-offset: 4 -tab-width: 4 -End: -*/ diff --git a/test/unistd/getopt.c b/test/unistd/getopt.c deleted file mode 100644 index 401765cc8..000000000 --- a/test/unistd/getopt.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Getopt tests */ - -#include -#include -#include -#include - - -int main (int argc, char **argv) -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == EOF) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - exit (0); -} - diff --git a/test/unistd/getopt_long.c b/test/unistd/getopt_long.c deleted file mode 100644 index 4064e224d..000000000 --- a/test/unistd/getopt_long.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Getopt tests */ - -#include -#include -#include -#include - - -int main (int argc, char **argv) -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == EOF) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - diff --git a/test/unistd/tst-fallocate.c b/test/unistd/tst-fallocate.c deleted file mode 100644 index fc81781bb..000000000 --- a/test/unistd/tst-fallocate.c +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include - -#ifndef TST_FALLOCATE64 -# define stat64 stat -# define fstat64 fstat -# else -# ifndef O_LARGEFILE -# error no O_LARGEFILE but you want to test with LFS enabled -# endif -#endif - -static void do_prepare(void); -static int do_test(void); -#define PREPARE(argc, argv) do_prepare () -#define TEST_FUNCTION do_test () -#include - -static int fd; -static void -do_prepare (void) -{ - fd = create_temp_file ("tst-fallocate.", NULL); - if (fd == -1) - { - printf ("cannot create temporary file: %m\n"); - exit (1); - } -} - - -static int -do_test (void) -{ - struct stat64 st; - int c; - char garbage[4096]; - blkcnt_t blksb4; - - if (fstat64 (fd, &st) != 0) - { - puts ("1st fstat failed"); - return 1; - } - - if (st.st_size != 0) - { - puts ("file not created with size 0"); - return 1; - } - - /* This is the default mode which is identical to posix_fallocate(). - Note: we need a few extra blocks for FALLOC_FL_PUNCH_HOLE below. - While block sizes vary, we'll assume eight 4K blocks for good measure. */ - if (fallocate (fd, 0, 8 * 4096, 128) != 0) - { - puts ("1st fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("2nd fstat failed"); - return 1; - } - - if (st.st_size != 8 * 4096 + 128) - { - printf ("file size after 1st fallocate call is %llu, expected %u\n", - (unsigned long long int) st.st_size, 8u * 4096u + 128u); - return 1; - } - - /* Without FALLOC_FL_KEEP_SIZE, this would increaste the size of the file. */ - if (fallocate (fd, FALLOC_FL_KEEP_SIZE, 0, 16 * 4096) != 0) - { - puts ("2nd fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("3rd fstat failed"); - return 1; - } - - if (st.st_size != 8 * 4096 + 128) - { - printf ("file size changed in 2nd fallocate call to %llu, expected %u\n", - (unsigned long long int) st.st_size, 8u * 4096u + 128u); - return 1; - } - - /* Let's fill up the first eight 4k blocks with 'x' to force some allocations. */ - - memset(garbage, 'x', 4096); - for(c=0; c < 8; c++) - if(write(fd, garbage, 4096) == -1) - { - puts ("write failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("4th fstat failed"); - return 1; - } - - blksb4 = st.st_blocks; - - /* Let's punch a hole in the entire file, turning it effectively into a sparse file. */ - if (fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 8 * 4096 + 128) != 0) - { - puts ("3rd fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("5th fstat failed"); - return 1; - } - - if (st.st_size != 8 * 4096 + 128) - { - printf ("file size after 3rd fallocate call is %llu, expected %u\n", - (unsigned long long int) st.st_size, 8u * 4096u + 128u); - return 1; - } - - /* The number of allocated blocks should decrease. I hope this works on - all filesystems! */ - if (st.st_blocks >= blksb4) - { - printf ("number of blocks after 3rd fallocate call is %lu, expected less than %lu\n", - (unsigned long int) st.st_blocks, blksb4); - return 1; - } - -#ifdef TST_FALLOCATE64 - /* We'll just do a mode = 0 test for fallocate64() */ - if (fallocate64 (fd, 0, 4097ULL, 4294967295ULL + 2ULL) != 0) - { - puts ("1st fallocate64 call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("6th fstat failed"); - return 1; - } - - if (st.st_size != 4097ULL + 4294967295ULL + 2ULL) - { - printf ("file size after 1st fallocate64 call is %llu, expected %llu\n", - (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL); - return 1; - } -#endif - close (fd); - - return 0; -} - diff --git a/test/unistd/tst-fallocate64.c b/test/unistd/tst-fallocate64.c deleted file mode 100644 index 720428f8f..000000000 --- a/test/unistd/tst-fallocate64.c +++ /dev/null @@ -1,2 +0,0 @@ -#define TST_FALLOCATE64 -#include "tst-fallocate.c" diff --git a/test/unistd/tst-getconf.sh b/test/unistd/tst-getconf.sh deleted file mode 100755 index 3a2aa4ea7..000000000 --- a/test/unistd/tst-getconf.sh +++ /dev/null @@ -1,240 +0,0 @@ -#! /bin/sh - -basedir="." - -# make sure to use the same locale everywhere. -LC_ALL=C -export LC_ALL -LANG=C -export LANG - -for suffix in _glibc '' -do -binary=$basedir/getconf$suffix -logfile=$basedir/tst-getconf$suffix.out -rm -f $logfile - -result=0 -while read name; do - case "$name" in - "#"*) continue;; - esac - echo -n "getconf $name: " >> $logfile - $binary "$name" 2>> $logfile >> $logfile - if test $? -ne 0; then - echo "*** $name FAILED" >> $logfile - result=1 - fi -done <> $logfile - $binary "$name" / 2>> $logfile >> $logfile - if test $? -ne 0; then - echo "*** $name FAILED" >> $logfile - result=1 - fi -done < -#include - -#ifndef TST_POSIX_FALLOCATE64 -# define stat64 stat -# define fstat64 fstat -# else -# ifndef O_LARGEFILE -# error no O_LARGEFILE but you want to test with LFS enabled -# endif -#endif - -static void do_prepare (void); -#define PREPARE(argc, argv) do_prepare () -static int do_test (void); -#define TEST_FUNCTION do_test () -#include - -static int fd; -static void -do_prepare (void) -{ - fd = create_temp_file ("tst-posix_fallocate.", NULL); - if (fd == -1) - { - printf ("cannot create temporary file: %m\n"); - exit (1); - } -} - - -static int -do_test (void) -{ - struct stat64 st; - - if (fstat64 (fd, &st) != 0) - { - puts ("1st fstat failed"); - return 1; - } - - if (st.st_size != 0) - { - puts ("file not created with size 0"); - return 1; - } - - if (posix_fallocate (fd, 512, 768) != 0) - { - puts ("1st posix_fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("2nd fstat failed"); - return 1; - } - - if (st.st_size != 512 + 768) - { - printf ("file size after 1st posix_fallocate call is %llu, expected %u\n", - (unsigned long long int) st.st_size, 512u + 768u); - return 1; - } - - if (posix_fallocate (fd, 0, 1024) != 0) - { - puts ("2nd posix_fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("3rd fstat failed"); - return 1; - } - - if (st.st_size != 512 + 768) - { - puts ("file size changed in 2nd posix_fallocate"); - return 1; - } - - if (posix_fallocate (fd, 2048, 64) != 0) - { - puts ("3rd posix_fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("4th fstat failed"); - return 1; - } - - if (st.st_size != 2048 + 64) - { - printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n", - (unsigned long long int) st.st_size, 2048u + 64u); - return 1; - } -#ifdef TST_POSIX_FALLOCATE64 - if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0) - { - puts ("4th posix_fallocate call failed"); - return 1; - } - - if (fstat64 (fd, &st) != 0) - { - puts ("5th fstat failed"); - return 1; - } - - if (st.st_size != 4097ULL + 4294967295ULL + 2ULL) - { - printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n", - (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL); - return 1; - } -#endif - close (fd); - - return 0; -} diff --git a/test/unistd/tst-posix_fallocate64.c b/test/unistd/tst-posix_fallocate64.c deleted file mode 100644 index b1ee0ffdd..000000000 --- a/test/unistd/tst-posix_fallocate64.c +++ /dev/null @@ -1,2 +0,0 @@ -#define TST_POSIX_FALLOCATE64 -#include "tst-posix_fallocate.c" diff --git a/test/unistd/tst-preadwrite.c b/test/unistd/tst-preadwrite.c deleted file mode 100644 index 66a1c0aa3..000000000 --- a/test/unistd/tst-preadwrite.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Tests for pread and pwrite. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - - -/* Allow testing of the 64-bit versions as well. */ -#ifndef PREAD -# define PREAD pread -# define PWRITE pwrite -#endif - -#define STRINGIFY(s) STRINGIFY2 (s) -#define STRINGIFY2(s) #s - -/* Prototype for our test function. */ -extern void do_prepare (int argc, char *argv[]); -extern int do_test (int argc, char *argv[]); - -/* We have a preparation function. */ -#define PREPARE do_prepare - -/* We might need a bit longer timeout. */ -#define TIMEOUT 20 /* sec */ - -/* This defines the `main' function and some more. */ -#include "../test-skeleton.c" - -/* These are for the temporary file we generate. */ -char *name; -int fd; - -void -do_prepare (int argc, char *argv[]) -{ - char name_len; - -#define FNAME FNAME2(TRUNCATE) -#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX" - - name_len = strlen (test_dir); - name = malloc (name_len + sizeof (FNAME)); - if (name == NULL) - error (EXIT_FAILURE, errno, "cannot allocate file name"); - mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME)); - add_temp_file (name); - - /* Open our test file. */ - fd = mkstemp (name); - if (fd == -1) - error (EXIT_FAILURE, errno, "cannot open test file `%s'", name); -} - - -int -do_test (int argc, char *argv[]) -{ - char buf[1000]; - char res[1000]; - int i; - - memset (buf, '\0', sizeof (buf)); - memset (res, '\xff', sizeof (res)); - - if (write (fd, buf, sizeof (buf)) != sizeof (buf)) - error (EXIT_FAILURE, errno, "during write"); - - for (i = 100; i < 200; ++i) - buf[i] = i; - if (PWRITE (fd, buf + 100, 100, 100) != 100) - error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE)); - - for (i = 450; i < 600; ++i) - buf[i] = i; - if (PWRITE (fd, buf + 450, 150, 450) != 150) - error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE)); - - if (PREAD (fd, res, sizeof (buf) - 50, 50) != sizeof (buf) - 50) - error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PREAD)); - - close (fd); - unlink (name); - - return memcmp (buf + 50, res, sizeof (buf) - 50); -} diff --git a/test/unistd/tst-preadwrite64.c b/test/unistd/tst-preadwrite64.c deleted file mode 100644 index a0ec021c6..000000000 --- a/test/unistd/tst-preadwrite64.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Tests for pread64 and pwrite64. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1998. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define PREAD pread64 -#define PWRITE pwrite64 - -#include "tst-preadwrite.c" diff --git a/test/unistd/tst-pselect.c b/test/unistd/tst-pselect.c deleted file mode 100644 index cab945119..000000000 --- a/test/unistd/tst-pselect.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -// our SIGALRM handler -void handler(int signum) { - (void)signum; - puts("got signal\n"); -} - -static int -do_test (void) -{ - int rc; - sigset_t wait_mask, mask_sigchld; - struct sigaction act; - - // block SIGALRM. We want to handle it only when we're ready - sigemptyset(&mask_sigchld); - sigaddset(&mask_sigchld, SIGALRM); - sigprocmask(SIG_BLOCK, &mask_sigchld, &wait_mask); - sigdelset(&wait_mask, SIGALRM); - - // register a signal handler so we can see when the signal arrives - memset(&act, 0, sizeof(act)); - sigemptyset(&act.sa_mask); // just in case an empty set isn't all 0's (total paranoia) - act.sa_handler = handler; - sigaction(SIGALRM, &act, NULL); - - // send ourselves a SIGARLM. It will pend until we unblock that signal in pselect() - printf("sending ourselves a signal\n"); - kill(getpid(), SIGALRM); - - printf("signal is pending; calling pselect()\n"); - rc = pselect(0, NULL, NULL, NULL, NULL, &wait_mask); - if (rc != -1 || errno != EINTR) { - int e = errno; - printf("pselect() returned %d, errno %d (%s)\n", rc, e, strerror(e)); - exit(1); - } - - return 0; -} - -#define TEST_FUNCTION do_test () -#include diff --git a/test/unistd/tstgetopt.c b/test/unistd/tstgetopt.c deleted file mode 100644 index 1c1263e67..000000000 --- a/test/unistd/tstgetopt.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -#include - -int -main (int argc, char **argv) -{ - static const struct option options[] = - { - {"required", required_argument, NULL, 'r'}, - {"optional", optional_argument, NULL, 'o'}, - {"none", no_argument, NULL, 'n'}, - {"color", no_argument, NULL, 'C'}, - {"colour", no_argument, NULL, 'C'}, - {NULL, 0, NULL, 0 } - }; - - int aflag = 0; - int bflag = 0; - char *cvalue = NULL; - int Cflag = 0; - int nflag = 0; - int idx; - int c; - int result = 0; - - while ((c = getopt_long (argc, argv, "abc:", options, NULL)) >= 0) - switch (c) - { - case 'a': - aflag = 1; - break; - case 'b': - bflag = 1; - break; - case 'c': - cvalue = optarg; - break; - case 'C': - ++Cflag; - break; - case '?': - fputs ("Unknown option.\n", stderr); - return 1; - default: - fprintf (stderr, "This should never happen!\n"); - return 1; - - case 'r': - printf ("--required %s\n", optarg); - result |= strcmp (optarg, "foobar") != 0; - break; - case 'o': - printf ("--optional %s\n", optarg); - result |= optarg == NULL || strcmp (optarg, "bazbug") != 0; - break; - case 'n': - puts ("--none"); - nflag = 1; - break; - } - - printf ("aflag = %d, bflag = %d, cvalue = %s, Cflags = %d, nflag = %d\n", - aflag, bflag, cvalue, Cflag, nflag); - - result |= (aflag != 1 || bflag != 1 || cvalue == NULL - || strcmp (cvalue, "foobar") != 0 || Cflag != 3 || nflag != 1); - - for (idx = optind; idx < argc; idx++) - printf ("Non-option argument %s\n", argv[idx]); - - result |= optind + 1 != argc || strcmp (argv[optind], "random") != 0; - - return result; -} diff --git a/test/unistd/vfork.c b/test/unistd/vfork.c deleted file mode 100644 index 295583945..000000000 --- a/test/unistd/vfork.c +++ /dev/null @@ -1,53 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * vfork test for uClibc - * Copyright (C) 2000-2006 by Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include -#include -#include -#include -#include - - -int main(void) -{ - pid_t pid; - int status, wpid; - char *argv[] = { - "/bin/ls", - "-laF", - NULL, - }; - - clearenv(); - if ((pid = vfork()) == 0) { - printf("Hi. I'm the child process...\n"); - execvp(argv[0], argv); - _exit(0); - } - - printf("Hello. I'm the parent process.\n"); - while (1) { - wpid = wait(&status); - if (wpid > 0 && wpid != pid) { - continue; - } - if (wpid == pid) - break; - } - - printf("Child process exited.\nGoodbye.\n"); - return EXIT_SUCCESS; -} - -/* -Local Variables: -c-file-style: "linux" -c-basic-offset: 4 -tab-width: 4 -End: -*/ -- cgit v1.2.3