From 7c5ef071689703755b8556d9cc43808916184b3e Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 3 Sep 2000 03:40:29 +0000 Subject: remove everything and move it up a level. --- winsup/cygwin/testsuite/winsup.api/crlf.c | 527 -------------------------- winsup/cygwin/testsuite/winsup.api/devzero.c | 113 ------ winsup/cygwin/testsuite/winsup.api/iospeed.c | 115 ------ winsup/cygwin/testsuite/winsup.api/winsup.exp | 43 --- 4 files changed, 798 deletions(-) delete mode 100644 winsup/cygwin/testsuite/winsup.api/crlf.c delete mode 100644 winsup/cygwin/testsuite/winsup.api/devzero.c delete mode 100644 winsup/cygwin/testsuite/winsup.api/iospeed.c delete mode 100644 winsup/cygwin/testsuite/winsup.api/winsup.exp (limited to 'winsup/cygwin/testsuite/winsup.api') diff --git a/winsup/cygwin/testsuite/winsup.api/crlf.c b/winsup/cygwin/testsuite/winsup.api/crlf.c deleted file mode 100644 index 5dbc2227b..000000000 --- a/winsup/cygwin/testsuite/winsup.api/crlf.c +++ /dev/null @@ -1,527 +0,0 @@ - -typedef enum { - Nop=100000, /* ; do nothing */ - New1, /* ; reset and begin new test */ - Open, /* ; open test file */ - Read, /* [askfor] [get] ; read bytes into buffer */ - Write, /* [expect] [bytestream] ; write to file (expect 0 = ignore)*/ - Compare, /* [bytestream] ; compare buffer to given bytes */ - Verify, /* [bytestream] ; compare file to given bytes */ - Seek, /* [offset] [whence] ; seek in file */ - Tell, /* [offset] ; compare file positions */ - BufSize, /* [size] ; change the stdio buffer size */ - Flush, /* ; flush the stdio stream */ - Text, /* ; switch file to text mode */ - Binary, /* ; switch file to binary mode */ - Rep, /* [count] ; repeat 'R' bytes (used in bytestream) */ - Fill, /* [posn] ; fill 'F' until given byte position */ - Start, /* ; for Seek */ - Current, /* ; for Seek */ - End, /* ; for Seek, or end of byte stream */ - Max } Opcode; - -#define New New1,__LINE__ - -/* Byte streams are just inserted into the command stream, and must - end in an End code. */ - -int commands[] = { -#ifndef __DJGPP__ - New, - Write, 1605, Rep, 1600, 'h', 'e', 'l', 'l', 'o', End, - Tell, 1605, - - Open, - BufSize, 16, - Read, 1605, 1605, - Compare, Rep, 1600, 'h', 'e', 'l', 'l', 'o', End, - Tell, 1605, - Flush, - Tell, 1605, - Seek, 1000, Start, - Tell, 1000, - - New, - Text, - Write, 2, 'x', 10, End, - Verify, 'x', 13, 10, End, - - New, - Binary, - Write, 2, 'x', 10, End, - Verify, 'x', 10, End, - - BufSize, 16, - - New, - Binary, - Write, 0, Fill, 15, 13, 10, 'x', End, - Text, Open, - Read, 17, 17, - Compare, Fill, 15, 10, 'x', End, - Tell, 18, - - New, - Binary, - Write, 0, Fill, 14, 13, 10, 'x', End, - Text, Open, - Read, 16, 16, - Compare, Fill, 14, 10, 'x', End, - Tell, 17, - - New, - Binary, - Write, 0, 13, 10, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 10, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 2, - - New, - Binary, - Write, 0, 13, 'a', 'b', End, - Text, Open, - Read, 2, 2, - Compare, 13, 'a', End, - Tell, 2, - - New, - Binary, - Write, 0, 13, 13, 10, 'a', End, - Text, Open, - Read, 2, 2, - Compare, 13, 10, End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 10, 'a', 13, End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 10, 'a', 10, End, - Text, Open, - Read, 2, 2, - Compare, 10, 'a', End, - Tell, 3, - - New, - Binary, - Write, 0, 13, 13, 13, 10, 'a', 10, 10, 10, End, - Text, Open, - Read, 4, 4, - Compare, 13, 13, 10, 'a', End, - Tell, 5, -#endif - - New, - Binary, - Write, 0, 13, 13, 13, 10, 'a', 'b', 13, 10, 13, 10, End, - Text, Open, - Read, 4, 4, - Compare, 13, 13, 10, 'a', End, - Tell, 5, - - }; - -/*==========================================================================*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef O_TEXT -#define O_TEXT 0 -#endif - -int errors = 0; - -#define num_commands (sizeof(commands)/sizeof(commands[0])) - -int pc; -int askfor, get, expect, count, posn, whence, size; - -typedef struct { - unsigned char *bytes; - int max, count; -} Buffer; - -Buffer rw_buf={0,0,0}, cmp_buf={0,0,0}, vfy_buf={0,0,0}; - -void -expand_buf(Buffer *buf, int len) -{ - if (buf->max < len) - { - buf->max = len+20; - if (buf->bytes) - buf->bytes = (unsigned char *)realloc(buf->bytes, buf->max); - else - buf->bytes = (unsigned char *)malloc(buf->max); - } -} - -void -get_bytestream(Buffer *buf) -{ - int tpc; - int len = 0, rep, byte; - unsigned char *bp; - - for (tpc = pc+1; tpc < num_commands && commands[tpc] != End; tpc++) - { - switch (commands[tpc]) - { - case Rep: - len += commands[tpc+1]; - tpc ++; - break; - case Fill: - if (len < commands[tpc+1]) - len = commands[tpc+1]; - tpc ++; - break; - default: - len ++; - break; - } - } - - expand_buf(buf, len); - - len = 0; - bp = buf->bytes; - - for (tpc = pc+1; tpc < num_commands && commands[tpc] != End; tpc++) - { - switch (commands[tpc]) - { - case Rep: - rep = commands[++tpc]; - byte = 'R'; - while (rep--) *bp++ = byte; - break; - case Fill: - rep = commands[++tpc]; - byte = 'F'; - while (bp-buf->bytes < rep) *bp++ = byte; - break; - default: - *bp++ = commands[tpc]; - break; - } - } - buf->count = bp - buf->bytes; - pc = tpc; -} - -char dataname[] = "crlf.dat"; - -int verbose=0; -void -v(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf("\n"); -} - -void -vp(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - printf("%08x: ", pc); - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf("\n"); -} - -void -errorq(int use_errno, char *fmt, ...) -{ - va_list ap; - fprintf(stderr, "crlf: Error at pc=%d: ", pc); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - if (use_errno) - perror("The error was"); - errors++; -} - -void -error(int use_errno, char *fmt, ...) -{ - va_list ap; - fprintf(stderr, "crlf: Error at pc=%d: ", pc); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - if (use_errno) - perror("The error was"); - fprintf(stderr, "FAIL\n"); - exit(1); -} - -void -display_buf(char *which, Buffer *buf, int ofs) -{ - int i; - fprintf(stderr, "%s %04x:", which, ofs); - for (i=0; i<8; i++) - if (i+ofs < buf->count) - { - unsigned char b = buf->bytes[i+ofs]; - fprintf(stderr, " %02x", b); - if (isgraph(b)) - fprintf(stderr, " %c ", b); - else - fprintf(stderr, " ", b); - } - fprintf(stderr, "\n"); -} - -void -compare_bufs(char *name, Buffer *actual, Buffer *expected) -{ - int i, got_one=0; - for (i=0; icount && icount; i++) - if (actual->bytes[i] != expected->bytes[i]) - { - errorq(0, "%s: byte mismatch at offset 0x%x", name, i); - got_one = 1; - break; - } - if (!got_one) - { - if (actual->count < expected->count) - errorq(0, "%s: too few bytes (0x%x vs 0x%x)", name, - actual->count, expected->count); - else if (actual->count > expected->count) - errorq(0, "%s: too many bytes (0x%x vs 0x%x)", name, - actual->count, expected->count); - else - return; - } - - i -= 4; - if (i<0) i = 0; - display_buf("Actual ", actual, i); - display_buf("Expected", expected, i); -} - -int -main(int argc, char **argv) -{ - char *readmode = "rb"; - char *writemode = "wb"; - FILE *file = 0; - int i, fd; - struct stat st; - char *str; - - while (argc > 1 && argv[1][0] == '-') - { - if (strcmp(argv[1], "-v") == 0) - verbose++; - argc--; - argv++; - } - - size = 0; - - for (pc=0; pc -#include -#include -#include -#include - -main() -{ - int fd, r, w, l; - char buf[1024]; - char *v; - - fd = open("/dev/zero", O_RDONLY); - if (fd < 0) - { - fprintf(stderr, "Unable to open /dev/zero for reading\n"); - perror("The error was"); - exit(1); - } - - l = read(fd, buf, 1024); - if (l != 1024) - { - fprintf(stderr, "Asked to read 1024 bytes, got %d\n", l); - exit(1); - } - - for (r=0; r<1024; r++) - if (buf[r] != 0) - { - fprintf(stderr, "/dev/zero returned a byte of %02x at offset %d\n", - buf[r], r); - exit(1); - } - - l = lseek(fd, 4096, 0); - if (l != 0) - { - fprintf(stderr, "l == %d\n", l); - exit(1); - } - - l = close(fd); - if (l != 0) - { - fprintf(stderr, "close: returned %d\n", l); - perror("The error was"); - exit(1); - } - - fd = open("/dev/zero", O_WRONLY); - if (fd < 0) - { - fprintf(stderr, "Unable to open /dev/zero for writing\n"); - perror("The error was"); - exit(1); - } - - l = write(fd, buf, 1024); - if (l != 1024) - { - fprintf(stderr, "Asked to write 1024 bytes, got %d\n", l); - exit(1); - } - - l = close(fd); - if (l != 0) - { - fprintf(stderr, "close: returned %d\n", l); - perror("The error was"); - exit(1); - } - - fd = open("/dev/zero", O_RDWR); - v = (char *)mmap(0, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); - if (v == (char *)-1) - { - fprintf(stderr, "mmap r/w /dev/zero failed\n"); - perror("The error was"); - exit(1); - } - - for (r=0; r<65536; r++) - if (v[r] != 0) - { - fprintf(stderr, "mmap'd r/w /dev/zero has byte %d at offset %d\n", - v[r], r); - exit(1); - } - munmap(v, 65536); - close(fd); - - fd = open("/dev/zero", O_RDONLY); - v = (char *)mmap(0, 65536, PROT_READ, MAP_SHARED, fd, 0); - if (v == (char *)-1) - { - fprintf(stderr, "mmap /dev/zero r/o failed\n"); - perror("The error was"); - exit(1); - } - - for (r=0; r<65536; r++) - if (v[r] != 0) - { - fprintf(stderr, "mmap'd r/o /dev/zero has byte %d at offset %d\n", - v[r], r); - exit(1); - } - munmap(v, 65536); - close(fd); - - exit(0); -} diff --git a/winsup/cygwin/testsuite/winsup.api/iospeed.c b/winsup/cygwin/testsuite/winsup.api/iospeed.c deleted file mode 100644 index d286f90bd..000000000 --- a/winsup/cygwin/testsuite/winsup.api/iospeed.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int verbose = 0; - -void -v(char *fmt, ...) -{ - va_list ap; - if (!verbose) return; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); -} - -#define TSIZE (1024 * 1024 * 16) - -unsigned long start_tic; - -void -start(FILE *f) -{ - fseek(f, 0, SEEK_SET); - start_tic = GetTickCount(); -} - -void -end() -{ - unsigned long end_tic = GetTickCount(); - printf("%6d", end_tic - start_tic); -} - -void -test(int linesz, int cr) -{ - FILE *f = fopen("iospeed.dat", "wb"); - char buf[65536]; - int i, fd; - - memset(buf, 'x', linesz); - buf[linesz-1] = '\n'; - if (cr) - buf[linesz-2] = '\r'; - for (i=0; i 0); - end(); - - start(f); - while (fgets(buf, 64436, f)); - end(); - - f = fopen("iospeed.dat", "rb"); - fd = fileno(f); - - for (i=0; i 0); - end(); - - start(f); - while (fgets(buf, 64436, f)); - end(); - - printf("\n"); -} - -int -main(int argc, char **argv) -{ - if (argc > 1 && strcmp(argv[1],"-v") == 0) - verbose = 1; - - setbuf(stdout, 0); - - printf(" ----- text ----- ---- binary ----\n"); - printf("linesz cr getc fread fgets getc fread fgets\n"); - - test(4, 0); - test(64, 0); - test(4096, 0); - test(4, 1); - test(64, 1); - test(4096, 1); - - remove ("iospeed.dat"); - - return 0; -} diff --git a/winsup/cygwin/testsuite/winsup.api/winsup.exp b/winsup/cygwin/testsuite/winsup.api/winsup.exp deleted file mode 100644 index 96e7c7cf4..000000000 --- a/winsup/cygwin/testsuite/winsup.api/winsup.exp +++ /dev/null @@ -1,43 +0,0 @@ -source "site.exp" - -if { ! [isnative] } { - verbose "skipping winsup.api because it's not native" - return -} - -set rv "" - -proc ws_spawn {cmd args} { - global rv - verbose "running $cmd\n" - catch [eval "exec $cmd"] rv - verbose send "catchCode = $rv\n" -} - -foreach src [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.c] { - regsub "^$srcdir/$subdir/" $src "" testcase - regsub ".c$" $testcase "" base - regsub ".*/" $base "" basename - regsub "/" $base "-" base - - if { [regexp "^xf-" $basename] } { - setup_xfail "*-*-*" - } else { - clear_xfail - } - - ws_spawn "$CC $src $rootme/new-libcygwin.a -o $base.exe" - if { $rv != "" } { - verbose -log "$rv" - fail "$testcase (compile)" - } else { - ws_spawn "../cygrun ./$base.exe > /dev/null" - if { $rv != "" } { - verbose -log "$testcase: $rv" - fail "$testcase (execute)" - } else { - pass "$testcase" - file delete "$base.exe" - } - } -} -- cgit v1.2.3