Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/testsuite/winsup.api')
-rw-r--r--winsup/testsuite/winsup.api/crlf.c527
-rw-r--r--winsup/testsuite/winsup.api/devzero.c113
-rw-r--r--winsup/testsuite/winsup.api/iospeed.c115
-rw-r--r--winsup/testsuite/winsup.api/known_bugs.tcl8
-rw-r--r--winsup/testsuite/winsup.api/ltp/access01.c302
-rw-r--r--winsup/testsuite/winsup.api/ltp/access03.c507
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm02.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/alarm03.c229
-rw-r--r--winsup/testsuite/winsup.api/ltp/asyncio02.c365
-rw-r--r--winsup/testsuite/winsup.api/ltp/chdir02.c220
-rw-r--r--winsup/testsuite/winsup.api/ltp/chmod02.c260
-rw-r--r--winsup/testsuite/winsup.api/ltp/chown01.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/close08.c241
-rw-r--r--winsup/testsuite/winsup.api/ltp/creat09.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup01.c261
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup02.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup04.c297
-rw-r--r--winsup/testsuite/winsup.api/ltp/dup05.c266
-rw-r--r--winsup/testsuite/winsup.api/ltp/execl01.c258
-rw-r--r--winsup/testsuite/winsup.api/ltp/execle01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/execlp01.c256
-rw-r--r--winsup/testsuite/winsup.api/ltp/execv01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/execve01.c258
-rw-r--r--winsup/testsuite/winsup.api/ltp/execvp01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/fchmod01.c241
-rw-r--r--winsup/testsuite/winsup.api/ltp/fchown01.c234
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl02.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl03.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl04.c239
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl05.c249
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl07.c426
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl07B.c427
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl08.c250
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl09.c272
-rw-r--r--winsup/testsuite/winsup.api/ltp/fcntl10.c278
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork01.c317
-rw-r--r--winsup/testsuite/winsup.api/ltp/fork04.c405
-rw-r--r--winsup/testsuite/winsup.api/ltp/fpathconf01.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/fstat01.c239
-rw-r--r--winsup/testsuite/winsup.api/ltp/fsync01.c248
-rw-r--r--winsup/testsuite/winsup.api/ltp/getegid01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/geteuid01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgroups01.c315
-rw-r--r--winsup/testsuite/winsup.api/ltp/getgroups02.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/gethostid01.c224
-rw-r--r--winsup/testsuite/winsup.api/ltp/gethostname01.c226
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpgrp01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getpid01.c217
-rw-r--r--winsup/testsuite/winsup.api/ltp/getppid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/getuid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/kill09.c258
-rw-r--r--winsup/testsuite/winsup.api/ltp/link02.c263
-rw-r--r--winsup/testsuite/winsup.api/ltp/link03.c330
-rw-r--r--winsup/testsuite/winsup.api/ltp/link04.c426
-rw-r--r--winsup/testsuite/winsup.api/ltp/link05.c351
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek01.c256
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek02.c243
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek04.c257
-rw-r--r--winsup/testsuite/winsup.api/ltp/lseek05.c253
-rw-r--r--winsup/testsuite/winsup.api/ltp/lstat02.c253
-rw-r--r--winsup/testsuite/winsup.api/ltp/mkdir01.c271
-rw-r--r--winsup/testsuite/winsup.api/ltp/mkdir08.c236
-rw-r--r--winsup/testsuite/winsup.api/ltp/mknod01.c274
-rw-r--r--winsup/testsuite/winsup.api/ltp/nice05.c220
-rw-r--r--winsup/testsuite/winsup.api/ltp/open03.c243
-rw-r--r--winsup/testsuite/winsup.api/ltp/pathconf01.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/pause01.c229
-rw-r--r--winsup/testsuite/winsup.api/ltp/readlink02.c244
-rw-r--r--winsup/testsuite/winsup.api/ltp/rename02.c251
-rw-r--r--winsup/testsuite/winsup.api/ltp/rmdir04.c237
-rw-r--r--winsup/testsuite/winsup.api/ltp/select01.c276
-rw-r--r--winsup/testsuite/winsup.api/ltp/setgid01.c219
-rw-r--r--winsup/testsuite/winsup.api/ltp/setgroups01.c229
-rw-r--r--winsup/testsuite/winsup.api/ltp/setpgid01.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/setregid01.c338
-rw-r--r--winsup/testsuite/winsup.api/ltp/setreuid01.c338
-rw-r--r--winsup/testsuite/winsup.api/ltp/setuid01.c225
-rw-r--r--winsup/testsuite/winsup.api/ltp/setuid02.c240
-rw-r--r--winsup/testsuite/winsup.api/ltp/stat05.c241
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink01.c2024
-rw-r--r--winsup/testsuite/winsup.api/ltp/symlink02.c245
-rw-r--r--winsup/testsuite/winsup.api/ltp/sync01.c216
-rw-r--r--winsup/testsuite/winsup.api/ltp/time01.c218
-rw-r--r--winsup/testsuite/winsup.api/ltp/times01.c222
-rw-r--r--winsup/testsuite/winsup.api/ltp/ulimit01.c273
-rw-r--r--winsup/testsuite/winsup.api/ltp/umask01.c220
-rw-r--r--winsup/testsuite/winsup.api/ltp/uname01.c221
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink05.c246
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink06.c255
-rw-r--r--winsup/testsuite/winsup.api/ltp/unlink07.c329
-rw-r--r--winsup/testsuite/winsup.api/ltp/wait02.c230
-rw-r--r--winsup/testsuite/winsup.api/ltp/write01.c250
-rw-r--r--winsup/testsuite/winsup.api/mmaptest01.c106
-rw-r--r--winsup/testsuite/winsup.api/mmaptest02.c189
-rw-r--r--winsup/testsuite/winsup.api/mmaptest03.c127
-rw-r--r--winsup/testsuite/winsup.api/mmaptest04.c96
-rw-r--r--winsup/testsuite/winsup.api/samples/sample-fail.c4
-rw-r--r--winsup/testsuite/winsup.api/samples/sample-miscompile.c1
-rw-r--r--winsup/testsuite/winsup.api/samples/sample-pass.c4
-rw-r--r--winsup/testsuite/winsup.api/sigchld.c20
-rw-r--r--winsup/testsuite/winsup.api/waitpid.c22
-rw-r--r--winsup/testsuite/winsup.api/winsup.exp70
104 files changed, 0 insertions, 26833 deletions
diff --git a/winsup/testsuite/winsup.api/crlf.c b/winsup/testsuite/winsup.api/crlf.c
deleted file mode 100644
index 5dbc2227b..000000000
--- a/winsup/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 <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#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; i<actual->count && i<expected->count; 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<num_commands; pc++)
- {
- switch (commands[pc])
- {
- case Nop:
- vp("Nop");
- break;
-
- case New1:
- i = commands[++pc];
- vp("New %d", i);
- if (file) fclose(file);
- file = 0;
- remove(dataname);
- break;
-
- case Open:
- vp("Open");
- if (file) fclose(file);
- file = 0;
- break;
-
- case Read:
- if (!file)
- {
- file = fopen(dataname, readmode);
- if (size)
- setvbuf(file, 0, _IOFBF, size);
- }
- if (!file)
- error(1, "cannot open %s, mode %s", dataname, readmode);
- askfor = commands[++pc];
- get = commands[++pc];
- vp("Read %d %d", askfor, get);
- expand_buf(&rw_buf, askfor);
- if (askfor == 1)
- {
- i = getc(file);
- rw_buf.bytes[0] = i;
- i = (i == EOF) ? 0 : 1;
- }
- else
- i = fread(rw_buf.bytes, 1, askfor, file);
- if (i != get)
- error(0, "read wrong number of bytes (%d vs %d)", i, get);
- rw_buf.count = i;
- break;
-
- case Write:
- if (!file)
- {
- file = fopen(dataname, writemode);
- if (size)
- setvbuf(file, 0, _IOFBF, size);
- }
- if (!file)
- error(1, "cannot open %s, mode %s\n", dataname, writemode);
- expect = commands[++pc];
- get_bytestream(&rw_buf);
- vp("Write %d %d", rw_buf.count, expect);
- if (askfor == 1)
- {
- i = putc(rw_buf.bytes[0], file);
- i = (i == EOF) ? 0 : 1;
- }
- else
- i = fwrite(rw_buf.bytes, 1, rw_buf.count, file);
- if (expect && (i != expect))
- error(0, "wrote wrong number of bytes (%d vs %d)", i, expect);
- break;
-
- case Compare:
- get_bytestream(&cmp_buf);
- vp("Compare %d/%d", rw_buf.count, cmp_buf.count);
- compare_bufs("Compare", &rw_buf, &cmp_buf);
- break;
-
- case Verify:
- if (file) fclose(file);
- file = 0;
- get_bytestream(&cmp_buf);
- vp("Verify %s", dataname);
- if (stat(dataname, &st))
- error(1, "Can't stat %s", dataname);
- expand_buf(&vfy_buf, st.st_size);
- i = open(dataname, O_RDONLY|O_BINARY, 0);
- vfy_buf.count = read(i, vfy_buf.bytes, st.st_size);
- close(i);
- compare_bufs("Verify", &vfy_buf, &cmp_buf);
- break;
-
- case Seek:
- posn = commands[++pc];
- whence = commands[++pc];
- switch (whence)
- {
- case Start:
- whence = SEEK_SET;
- str = "Start";
- break;
- case Current:
- whence = SEEK_CUR;
- str = "Current";
- break;
- case End:
- whence = SEEK_END;
- str = "End";
- break;
- }
- vp("Seek 0x%x %s", posn, str);
- i = fseek(file, posn, whence);
- if (i)
- error(1, "fseek failed");
- break;
-
- case Tell:
- posn = commands[++pc];
- vp("Tell 0x%x", posn);
- i = ftell(file);
- if (i != posn)
- error(0, "ftell failed, got 0x%x expected 0x%x", i, posn);
- break;
-
- case BufSize:
- size = commands[++pc];
- vp("BufSize 0x%x", size);
- if (file)
- {
- fflush(file);
- setvbuf(file, 0, _IOFBF, size);
- }
- break;
-
- case Flush:
- vp("Flush");
- if (file)
- fflush(file);
- break;
-
- case Text:
- vp("Text");
- readmode = "rt";
- writemode = "wt";
- break;
-
- case Binary:
- vp("Binary");
- readmode = "rb";
- writemode = "wb";
- break;
-
- default:
- printf("Invalid command code %d at offset %d\n", commands[pc], pc);
- exit(1);
- }
- }
-
- if (file) fclose(file);
-
- if (errors)
- printf("FAIL: %d error%s\n", errors, errors==1?"":"s");
- else
- {
- printf("PASS\n");
- unlink (dataname);
- }
- return errors;
-}
diff --git a/winsup/testsuite/winsup.api/devzero.c b/winsup/testsuite/winsup.api/devzero.c
deleted file mode 100644
index 85a2615b1..000000000
--- a/winsup/testsuite/winsup.api/devzero.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-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/testsuite/winsup.api/iospeed.c b/winsup/testsuite/winsup.api/iospeed.c
deleted file mode 100644
index d286f90bd..000000000
--- a/winsup/testsuite/winsup.api/iospeed.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <windows.h>
-
-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<TSIZE; i += linesz)
- fwrite(buf, 1, linesz, f);
- fclose(f);
-
- f = fopen("iospeed.dat", "rt");
- fd = fileno(f);
-
- printf("%6d%6d", linesz, cr);
- for (i=0; i<TSIZE; i+= 65536)
- read(fd, buf, 65536);
-
- start(f);
- while (getc(f) != EOF);
- end();
-
- start(f);
- while (fread(buf, 1, 256, f) > 0);
- end();
-
- start(f);
- while (fgets(buf, 64436, f));
- end();
-
- f = fopen("iospeed.dat", "rb");
- fd = fileno(f);
-
- for (i=0; i<TSIZE; i+= 65536)
- read(fd, buf, 65536);
-
- start(f);
- while (getc(f) != EOF);
- end();
-
- start(f);
- while (fread(buf, 1, 256, f) > 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/testsuite/winsup.api/known_bugs.tcl b/winsup/testsuite/winsup.api/known_bugs.tcl
deleted file mode 100644
index c84eaad28..000000000
--- a/winsup/testsuite/winsup.api/known_bugs.tcl
+++ /dev/null
@@ -1,8 +0,0 @@
-set xfail_list [list dup03 dup05 \
- fcntl05 fcntl07B fcntl09 fcntl10 \
- fsync01 gethostid01 lseek04 mknod01 \
- setgroups01 setregid01 setreuid01 setuid02 \
- ulimit01 unlink06 \
- sample-fail sample-miscompile]
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/access01.c b/winsup/testsuite/winsup.api/ltp/access01.c
deleted file mode 100644
index e003805a0..000000000
--- a/winsup/testsuite/winsup.api/ltp/access01.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : access01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for access(2) using F_OK,
- * R_OK, W_OK and X_OK arguments.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 6
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) access(2) returns 0 for F_OK...(See Description)
- * 2.) access(2) returns 0 for R_OK...(See Description)
- * 3.) access(2) returns 0 for W_OK...(See Description)
- * 4.) access(2) returns 0 for X_OK...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * The libcuts.a and libsys.a libraries must be included in
- * the compilation of this test.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the access(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * access(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- * Create a temp directory and cd to it.
- * Creat a temp file wil read, write and execute permissions.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call with F_OK on tmp file
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- * Execute system call with X_OK on tmp file...
- * Execute system call with W_OK on tmp file...
- * Execute system call with R_OK on tmp file...
- *
- * Cleanup:
- * Print errno log
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <string.h>
-#include <sys/unistd.h>
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "usctest.h"
-void setup();
-void cleanup();
-
-char *TCID="access01"; /* Test program identifier. */
-int TST_TOTAL=4; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-
-char Fname[255];
-
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int main(int ac, char **av)
-{
- struct test_case_t {
- char *file;
- unsigned mode;
- const char *string;
- int experrno;
- } Test_cases[] = {
- { Fname, F_OK, "F_OK", 0 },
- { Fname, X_OK, "X_OK", 0 },
- { Fname, W_OK, "W_OK", 0 },
- { Fname, R_OK, "R_OK", 0 },
- };
-
- int Ntc = sizeof(Test_cases) / sizeof(struct test_case_t);
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int tc;
-
- TST_TOTAL=Ntc;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (tc=0; tc<Ntc; tc++) {
- /*
- * Call access(2)
- */
- TEST(access(Test_cases[tc].file, Test_cases[tc].mode));
-
- /* check return code */
- if ( TEST_RETURN == -1 && Test_cases[tc].experrno == 0 ) {
- tst_resm(TFAIL, "access(%s, %s) Failed, errno=%d : %s",
- Test_cases[tc].file, Test_cases[tc].string,
- TEST_ERRNO, strerror(TEST_ERRNO));
-
- } else if ( TEST_RETURN != -1 && Test_cases[tc].experrno != 0 ) {
- tst_resm(TFAIL, "access(%s, %s) returned %d, exp -1, errno:%d",
- Test_cases[tc].file, Test_cases[tc].string,
- TEST_RETURN, Test_cases[tc].experrno);
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "access(%s, %s) returned %d",
- Test_cases[tc].file, Test_cases[tc].string,
- TEST_RETURN);
- }
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int fd;
- struct stat stbuf;
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- umask(0); /* reset umask avoid it affects on modes */
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /*
- * Since files inherit group ids, make sure our dir has a valid grp
- * to us.
- */
- chown(".", -1, getgid());
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname,"accessfile");
-
- if ((fd = open(Fname, O_RDWR|O_CREAT, 06777)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,06777) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- else if (close(fd) == -1) {
- tst_resm(TINFO, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-
- /*
- * force the mode to be set to 6777
- */
- if (chmod(Fname, 06777) == -1 ) {
- tst_brkm(TBROK, cleanup, "chmod(%s, 06777) failed, errno:%d %s\n",
- Fname, errno, strerror(errno));
- }
-
- stat(Fname, &stbuf);
-
- if ( (stbuf.st_mode & 06777) != 06777 ) {
- /*
- * file can not be properly setup
- */
- }
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove the temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/access03.c b/winsup/testsuite/winsup.api/ltp/access03.c
deleted file mode 100644
index dc7dc5ee4..000000000
--- a/winsup/testsuite/winsup.api/ltp/access03.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : access03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : EFAULT error testing for access(2)
- *
- * PARENT DOCUMENT : acstds01
- *
- * TEST CASE TOTAL : 8
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Kathy Olmsted
- *
- * CO-PILOT : Tom Hampson
- *
- * DATE STARTED : 05/13/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * access(2) test for errno(s) EFAULT.
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Setup signal handling.
- * Make and change to a temporary directory.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno.
- * If doing functional test
- * check the errno returned and print result message
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Remove the temporary directory and exit.
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-
-void setup();
-void cleanup();
-
-
-char *get_high_address();
-
-char *TCID="access03"; /* Test program identifier. */
-int TST_TOTAL=8; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={EFAULT, 0}; /* List must end with 0 */
-
-int main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
-
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos. */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * R_OK on low pointer (-1) for path
- */
-
-
- /* Call access(2) */
- TEST(access( (char *)-1,R_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char *)-1,R_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char *)-1,R_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char *)-1,R_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * W_OK on low pointer (-1) for path
- */
-
-
- /* Call access(2) */
- TEST(access( (char *)-1,W_OK));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char *)-1,W_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char *)-1,W_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char *)-1,W_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * X_OK on low pointer (-1) for path
- */
-
-
- /* Call access(2) */
- TEST(access( (char *)-1,X_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char*)-1,X_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char*)-1,X_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char*)-1,X_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * F_OK on low pointer (-1) for path
- */
-
-
- /* Call access(2) */
- TEST(access( (char *)-1,F_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char*)-1,F_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char*)-1,F_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char*)-1,F_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * R_OK on high pointer (sbrk(0)+1) for path
- */
-
-
- /* Call access(2) */
- TEST(access(get_high_address(),R_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char*)sbrk(0)+1,R_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char*)sbrk(0)+1,R_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char*)sbrk(0)+1,R_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * W_OK on high pointer (sbrk(0)+1) for path
- */
-
-
- /* Call access(2) */
- TEST(access(get_high_address(),W_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char*)sbrk(0)+1,W_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char*)sbrk(0)+1,W_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char*)sbrk(0)+1,W_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * X_OK on high pointer (sbrk(0)+1) for path
- */
-
-
- /* Call access(2) */
- TEST(access(get_high_address(),X_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access(high_address,X_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access(high_address,X_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access(high_address,X_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE:
- * F_OK on high pointer (sbrk(0)+1) for path
- */
-
-
- /* Call access(2) */
- TEST(access(get_high_address(),F_OK));
-
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS,
- "access((char*)sbrk(0)+1,F_OK) failed as expected with errno %d (EFAULT) : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "access((char*)sbrk(0)+1,F_OK) failed with errno %d : %s but expected %d (EFAULT)",
- TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL,
- "access((char*)sbrk(0)+1,F_OK) succeeded unexpectedly.");
-
- }
- }
-
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make and change to a temporary directory */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove the temporary directory and exit with
- return code appropriate for results */
- tst_rmdir();
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/alarm01.c b/winsup/testsuite/winsup.api/ltp/alarm01.c
deleted file mode 100644
index ac754e326..000000000
--- a/winsup/testsuite/winsup.api/ltp/alarm01.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : alarm01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for alarm(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) alarm(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * The libcuts.a and libsys.a libraries must be included in
- * the compilation of this test.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the alarm(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * alarm(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="alarm01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call alarm(2)
- */
- TEST(alarm(1));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- tst_resm(TFAIL, "alarm(1) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "alarm(1) returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- void trapper();
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- signal(SIGALRM, trapper);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-void
-trapper(sig)
-int sig;
-{
- signal(SIGALRM, trapper);
-}
-
diff --git a/winsup/testsuite/winsup.api/ltp/alarm02.c b/winsup/testsuite/winsup.api/ltp/alarm02.c
deleted file mode 100644
index 7c608da66..000000000
--- a/winsup/testsuite/winsup.api/ltp/alarm02.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : alarm02
- *
- * TEST TITLE : Boundary Value Test for alarm(2)
- *
- * PARENT DOCUMENT : almtds02
- *
- * TEST CASE TOTAL : 3
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * BINARY LOCATION : CUTS_BIN/rf_tests/sys
- *
- * SOURCE LOCATION : CUTS_SRC/src/tests/sys
- *
- * AUTHOR : Billy Jean Horne
- *
- * CO-PILOT : Kathy Olmsted
- *
- * DATE STARTED : 06/01/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- * Test Case One - A call to alarm() shall not return an error if
- * seconds is a -1.
- * Test FAILS if a non-zero value is returned.
- * Test Case Two - A call to alarm() shall not return an error if
- * seconds is the maximum unsigned integer (2**63).
- * Test FAILS if a non-zero value is returned.
- * Test Case Three - A call to alarm() shall not return an error if
- * seconds is the maximum unsigned integer plus 1 ((2**63)+1).
- * Test FAILS if a non-zero value is returned.
- *
- * ENVIRONMENTAL NEEDS
- * The libcuts.a and libsys.a libraries must be included in
- * the compilation of this test.
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Define a cleanup function.
- *
- * Test:
- * Loop for each test case.
- * Execute alarm (0) system call to clear previous alarm.
- * Check return code, if system call failed (return=-1)
- * Issue a BROK message and exit the test.
- * Call alarm() with boundary values for seconds.
- * Verify that returned value is as expected.
- * Report results.
- *
- * Cleanup:
- *
- */
-#include <sys/types.h>
-#include <errno.h>
-#include <sys/signal.h>
-#include <limits.h>
-#include "test.h"
-#include "usctest.h" /* required for usctest */
-
-void setup();
-void cleanup();
-void alarm_received();
-
-
-
-char *TCID="alarm02"; /* Test program identifier. */
-int TST_TOTAL=3; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_ * routines */
-
-int received_alarm = 0; /* Indicates a SIGALRM was received */
-
-/************************************************************
- * Main program
- ***********************************************************/
-
-int
-main(int ac, char **av)
-{
-
- /* Parameters for usc code */
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /* Parameters for alarm test */
- char *buf[] = { "-1", "ULONG_MAX", "ULONG_MAX+1"};
- unsigned long int sec[] = {-1, ULONG_MAX, ULONG_MAX+1};
- int exp[] = {0,0,0};
- int i;
-
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
-
- setup();
-
- /***************************************************************
- * check looping state
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
-
- Tst_count=0;
-
- for (i=0;i<TST_TOTAL;i++) {
-
- /* capture an SIGALRM signal */
- received_alarm = 0;
- signal(SIGALRM, alarm_received);
-
- TEST (alarm (sec[i]));
- /* reset the alarm */
- alarm (0);
- if (TEST_RETURN != 0) {
- tst_resm(TFAIL,
- "alarm(%u) returned %u, when %u was expected for value %s.",
- sec[i], TEST_RETURN, exp[i], buf[i]);
-
- }
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- else if (STD_FUNCTIONAL_TEST) {
- if (received_alarm == 1) {
- tst_resm (TFAIL,
- "alarm(%u) returned %u but an alarm signal was received for value %s.",
- sec[i], TEST_RETURN, buf[i]);
- } else {
- tst_resm (TPASS,
- "alarm(%u) returned %u as expected for value %s.",
- sec[i], TEST_RETURN, buf[i]);
- }
-
- } /* End of STD_FUNCTIONAL_TEST */
- } /* End of for loop */
- /*
- * Reset alarm before cleanup.
- */
-
- alarm(0);
-
- } /* End for TEST_LOOPING */
-
- cleanup();
-
- return 0;
-}
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- /* End setup() */
-
-}
-
-/***********************************************************
- * Cleanup:
- * exit using tst_exit.
- ***********************************************************/
-
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
-
- tst_exit();
-}
-
-void alarm_received()
-{
- received_alarm = 1;
-}
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/alarm03.c b/winsup/testsuite/winsup.api/ltp/alarm03.c
deleted file mode 100644
index 275301374..000000000
--- a/winsup/testsuite/winsup.api/ltp/alarm03.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : alarm03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : alarm(2) cleared by a fork
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : Dennis Arason
- *
- * DATE STARTED : 08/96
- *
- *
- * TEST CASES
- *
- * 1.) alarm(100), fork, child's alarm(0) shall return 0;
- * 2.) alarm(100), fork, parent's alarm(0) shall return non-zero.
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the alarm(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * alarm(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-char *TCID="alarm03"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call alarm(2)
- */
- TEST(alarm(100));
-
- switch ( fork()) {
- case -1:
- tst_brkm(TBROK, cleanup, "fork failed, errno:%d %s",
- errno, strerror(errno));
- break;
-
- case 0:
- TEST( alarm(0) );
-
- if ( TEST_RETURN != 0 )
- tst_resm(TFAIL,
- "alarm(100), fork, alarm(0) child's alarm returned %d",
- TEST_RETURN);
- else if ( STD_FUNCTIONAL_TEST )
- tst_resm(TPASS,
- "alarm(100), fork, alarm(0) child's alarm returned %d",
- TEST_RETURN);
-
- exit(0);
- break;
-
- default:
- Tst_count++;
- TEST( alarm(0) );
- if ( TEST_RETURN <= 0 || TEST_RETURN > 100 )
- tst_resm(TFAIL,
- "alarm(100), fork, alarm(0) parent's alarm returned %d",
- TEST_RETURN);
-
- else if ( STD_FUNCTIONAL_TEST )
- tst_resm(TPASS,
- "alarm(100), fork, alarm(0) parent's alarm returned %d",
- TEST_RETURN);
-
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- void trapper();
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- signal(SIGALRM, trapper);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-void
-trapper(sig)
-int sig;
-{
- signal(SIGALRM, trapper);
-}
-
diff --git a/winsup/testsuite/winsup.api/ltp/asyncio02.c b/winsup/testsuite/winsup.api/ltp/asyncio02.c
deleted file mode 100644
index b7ccb62f5..000000000
--- a/winsup/testsuite/winsup.api/ltp/asyncio02.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/************************************************************
- * OS Test - Silicon Graphics, Inc.
- * Mendota Heights, Minnesota
- *
- * TEST IDENTIFIER: aiotcs02: write/close flushes data to the file
- *
- * PARENT DOCUMENT: aiotds01: kernel i/o
- *
- * AUTHOR: Barrie Kletscher
- *
- * CO-PILOT: Dave Baumgartner
- *
- * TEST ITEMS:
- * for each open flags set used:
- * 1. Multiple writes to a file work as specified for
- * more than BUFSIZ bytes.
- * 2. Multiple writes to a file work as specified for
- * BUFSIZ bytes.
- * 3. Multiple writes to a file work as specified for
- * lower than BUFSIZ bytes.
- *
- * INPUT SPECIFICATIONS:
- * Standard parse_opts supported options.
- *
- * OUTPUT SPECIFICATIONS
- * Standard tst_res output format
- *
- * ENVIRONMENTAL NEEDS:
- * This program uses the environment variable TMPDIR for the location
- * of the temporary directory.
- *
- *
- * SPECIAL PROCEDURAL REQUIREMENTS:
- * The program must be linked with tst_*.o and parse_opts.o.
- *
- * INTERCASE DEPENDENCIES:
- * NONE.
- *
- * DETAILED DESCRIPTION:
- * Attempt to get some memory to work with.
- * Call testrun writing (BUFSIZ + 1) bytes
- * Call testrun writing BUFSIZ bytes
- * Repeated call to testrun() with decreasing write sizes
- * less than BUFSIZ
- * End
- *
- * Start testrun()
- * Attempt to open a temporary file.
- * Write the memory to the file.
- * Attempt to close the file which also flushes the buffers.
- * Now check to see if the number of bytes written is the
- * same as the number of bytes in the file.
- * Cleanup
- *
- * BUGS:
- * NONE.
- *
-************************************************************/
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/signal.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "test.h"
-#include "usctest.h"
-
-#define FLAG O_RDWR | O_CREAT | O_TRUNC /* Flags used when opening temp tile */
-#define MODE 0777 /* Mode to open file with */
-#define WRITES 10 /* Number of times buffer is written */
-#define DECR 1000 /* Number of bytes decremented between */
- /* Calls to testrun() */
-#define OK -1 /* Return value from testrun() */
-
-#define FNAME1 "aio02.1"
-#define FNAME2 "aio02.2"
-#define FNAME3 "aio02.3"
-
-#define ERR_MSG1 "Bytes in file not equal to bytes written."
-#define ERR_MSG2 "Bytes in file (%d) not equal to bytes written (%d)."
-
-char *dp; /* pointer to area of memory */
-
-void setup();
-void cleanup();
-int testrun(int flag, int bytes, int ti);
-
-char *TCID="asyncio02"; /* Test program identifier. */
-int TST_TOTAL=6; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* variable used to turn off tst_res buffering */
-
-extern int errno;
-
-int exp_enos[]={0}; /* Array of expected errnos */
-char mesg[150];
-char *filename; /* name of the temporary file */
-
-char *Progname;
-int Open_flags;
-
-int Flags[] = {
- O_RDWR | O_CREAT | O_TRUNC,
- O_RDWR | O_CREAT | O_TRUNC
-};
-
-int Num_flags;
-
-/***********************************************************************
- * MAIN
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
-
- int i; /* counter */
- int ret_val; /* return value from testrun call */
- int eok; /* everything is ok flag */
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int flag_cnt;
-
- Tst_nobuf=1;
- Num_flags = sizeof(Flags)/sizeof(int);
- TST_TOTAL= 3 * Num_flags;
-
- /***************************************************************
- * parse standard options, and exit if there is an error
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (flag_cnt=0; flag_cnt<Num_flags; flag_cnt++) {
-
- /*
- * call testrun writing (BUFSIZ + 1) byte chunks
- */
-
- filename=FNAME1;
- if( testrun(Flags[flag_cnt],BUFSIZ+1,1) != OK)
- tst_resm(TFAIL,ERR_MSG1);
-
- else if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS,
- "More than BUFSIZE bytes multiple synchronous writes to a file check out ok");
- }
-
- /*
- * call testrun writing BUFSIZ byte chunks
- */
-
- filename=FNAME2;
- if(testrun(Flags[flag_cnt],BUFSIZ,2) != OK) {
- tst_resm(TFAIL,ERR_MSG1);
- }
- else if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS,
- "BUFSIZE bytes multiple synchronous writes to a file checks out ok");
- }
-
- /*
- * while the byte chunks are greater than 0
- * call testrun() with decreasing chunk sizes
- */
-
- filename=FNAME3;
- eok=1;
- for(i = BUFSIZ-1; i >= 0; i -= DECR) {
- if((ret_val = testrun(Flags[flag_cnt],i,3)) != OK) {
- char output[80]; /* local output char string */
-
- (void)sprintf(output,ERR_MSG2,ret_val,i*WRITES);
- tst_resm(TFAIL,output);
- }
- }
-
- if ( eok && STD_FUNCTIONAL_TEST )
- tst_resm(TPASS,
- "Less than BUFSIZE bytes multiple synchronous writes to a file checks out ok");
-
- }
- }
- cleanup();
-
- return 0;
-} /* end main() */
-
-/***********************************************************
- *
- * This function does the actual running of the tests.
- *
- ***********************************************************/
-int
-testrun(int flag, int bytes, int ti)
-{
-
- void cleanup();
-
- int fildes, /* temporary file's descriptor */
- i; /* counter */
-
- int ret;
-
- struct stat buffer; /* buffer of memory required for stat command */
-
- /*
- * Attempt to open a temporary file.
- */
-
- if((fildes = open(filename,flag,MODE)) == -1) {
- sprintf(mesg, "open failed, errno:%d", errno);
- tst_brkm(TBROK, cleanup, mesg);
- }
-
- /*
- * Write the memory to the file.
- */
-
- for(i = 0; i < WRITES; i++) {
- TEST( write(fildes,dp,(unsigned)bytes) );
-
- if( TEST_RETURN == -1) {
- sprintf(mesg, "write failed, errno:%d", errno);
- tst_brkm(TBROK, cleanup, mesg);
- }
- } /* end for() */
-
- /*
- * Attempt to close the file which also flushes the buffers.
- */
-
- if(close(fildes) == -1) {
- sprintf(mesg, "close failed, errno:%d", errno);
- tst_brkm(TBROK, cleanup, mesg);
- }
-
- ret=OK;
- if ( STD_FUNCTIONAL_TEST ) {
-
- /*
- * Now check to see if the number of bytes written is the
- * same as the number of bytes in the file.
- */
-
- if(stat(filename,&buffer) == -1) {
- sprintf(mesg, "stat failed, errno:%d", errno);
- tst_brkm(TBROK, cleanup, mesg);
- }
-
-
- if(buffer.st_size != (off_t)(bytes * WRITES)) {
- ret=(int)buffer.st_size;
- }
- }
-
- if ( unlink(filename) == -1 ) {
- sprintf(mesg, "unlink failed, errno:%d", errno);
- tst_brkm(TBROK, cleanup, mesg);
- }
-
- return ret;
-
-} /* end testrun() */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* create a temporary directory and go to it */
- tst_tmpdir();
-
- /* Indicate which errnos are expected */
- TEST_EXP_ENOS(exp_enos);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- /*
- * Attempt to get some memory to work with.
- */
-
- if((dp = (char *)malloc((unsigned)BUFSIZ+1)) == NULL) {
- sprintf(mesg, "malloc failed, errno:%d", errno);
- tst_brkm(TBROK, cleanup, mesg);
- }
-
-
-} /* End setup() */
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove temporary directory and all files in it. */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/chdir02.c b/winsup/testsuite/winsup.api/ltp/chdir02.c
deleted file mode 100644
index b59fd9338..000000000
--- a/winsup/testsuite/winsup.api/ltp/chdir02.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : chdir02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for chdir(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) chdir(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the chdir(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * chdir(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="chdir02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char *dirs[2] = { "/", "/tmp" };
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call chdir(2)
- */
- TEST(chdir(dirs[lc%2]));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "chdir(%s) Failed, errno=%d : %s", dirs[lc%2],
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "chdir(%s) returned %d", dirs[lc%2], TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/chmod02.c b/winsup/testsuite/winsup.api/ltp/chmod02.c
deleted file mode 100644
index 41c3485e8..000000000
--- a/winsup/testsuite/winsup.api/ltp/chmod02.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : chmod02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for chmod(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 8
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) chmod(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * The libcuts.a and libsys.a libraries must be included in
- * the compilation of this test.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the chmod(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * chmod(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="chmod02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-char fname[255];
-char *buf = "file contents\n";
-
-int Modes[] = {0, 07, 070, 0700, 0777, 02777, 04777, 06777};
-
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int ind;
- int mode;
-
- TST_TOTAL = sizeof(Modes) / sizeof(int);
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (ind=0; ind<TST_TOTAL; ind++) {
- mode=Modes[ind];
-
- /*
- * Call chmod(2) with mode argument on fname
- */
- TEST(chmod(fname, mode));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- tst_resm(TFAIL, "chmod(%s, %#o) Failed, errno=%d : %s", fname,
- mode, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "chmod(%s, %#o) returned %d", fname,
- mode, TEST_RETURN);
- }
- else
- Tst_count++;
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int fd;
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- strcat(fname, "tfile");
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- } else if (write(fd, &buf, strlen(buf)) == -1) {
- tst_brkm(TBROK, cleanup,
- "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_brkm(TBROK, cleanup,
- "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
diff --git a/winsup/testsuite/winsup.api/ltp/chown01.c b/winsup/testsuite/winsup.api/ltp/chown01.c
deleted file mode 100644
index 1060637e2..000000000
--- a/winsup/testsuite/winsup.api/ltp/chown01.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : chown01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for chown(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) chown(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the chown(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * chown(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="chown01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd, uid, gid;
-char *buf = "davef";
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call chown(2)
- */
- TEST(chown(fname, uid,gid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "chown(%s, %d,%d) Failed, errno=%d : %s", fname, uid, gid,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "chown(%s, %d,%d) returned %d", fname, uid, gid, TEST_RETURN);
- }
- } /* end else */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* create a temp dir and cd to it. */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- /* set uid and gid */
- uid=geteuid();
- gid=getegid();
-
- sprintf(fname,"t_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if (write(fd, &buf, strlen(buf)) == -1) {
- tst_brkm(TBROK, cleanup, "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove temp dir and files */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/close08.c b/winsup/testsuite/winsup.api/ltp/close08.c
deleted file mode 100644
index 7c9567fdb..000000000
--- a/winsup/testsuite/winsup.api/ltp/close08.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : close08
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for close(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) close(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the close(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * close(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="close08"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- }
- /*
- * Call close(2)
- */
- TEST(close(fd));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "close(%s) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "close(%s) returned %d", fname, TEST_RETURN);
- }
- }
-
- if (unlink(fname) == -1) {
- tst_brkm(TBROK, cleanup, "unlink(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/creat09.c b/winsup/testsuite/winsup.api/ltp/creat09.c
deleted file mode 100644
index 0caa87973..000000000
--- a/winsup/testsuite/winsup.api/ltp/creat09.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : creat09
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for creat(2) using 0700 argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) creat(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the creat(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * creat(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="creat09"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
-
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- *******************************************
- * Call creat(2) with 0700 argument on fname
- *******************************************
- */
- TEST(creat(fname, 0700));
-
- /* check return code */
-
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "creat(%s, 0700) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "creat(%s, 0700) returned %d", fname, TEST_RETURN);
- }
- }
-
- /* close and remove file, possibly for next loop */
- if (close(TEST_RETURN) == -1) {
- tst_brkm(TBROK, cleanup,
- "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- } else if (unlink(fname) == -1) {
- tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/dup01.c b/winsup/testsuite/winsup.api/ltp/dup01.c
deleted file mode 100644
index d065f9dc1..000000000
--- a/winsup/testsuite/winsup.api/ltp/dup01.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : dup01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for dup(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) dup(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the dup(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * dup(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-char *TCID="dup01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char Fname[255];
-int Fd;
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call dup(2)
- */
- TEST( dup(Fd) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s", Fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "dup(%s) returned %d", Fname, TEST_RETURN);
- }
-
- /* close the new file so loops do not open too many files */
- if (close(TEST_RETURN) == -1) {
- tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /*
- * Initialize Fd in case we get a quick signal
- */
- Fd=-1;
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname, "dupfile");
- if ((Fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the open file we've been dup'ing */
- if (Fd != -1) {
- if (close(Fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- Fd=-1;
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/dup02.c b/winsup/testsuite/winsup.api/ltp/dup02.c
deleted file mode 100644
index 3aac3e9f8..000000000
--- a/winsup/testsuite/winsup.api/ltp/dup02.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : dup02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test for dup(2) with bad fd.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 06/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1-?.) dup(2) returns -1 with errno set to EBADF...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- * Standard tst_res formatted output
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Loop through the test cases
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * if doing functional check
- * check if errno set correctly, report results
- * Otherwise, Issue a FAIL message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-char *TCID="dup02"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int Fds[] = { -1, 1500 };
-
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int nfds = sizeof(Fds) / sizeof(int);
- int ind;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (ind=0; ind<nfds; ind++) {
-
- /*
- * Call dup(2)
- */
- TEST( dup(Fds[ind]) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_ERRNO == EBADF ) {
- tst_resm(TPASS, "dup(%d) Failed, errno=%d : %s", Fds[ind],
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL,
- "dup(%d) Failed, errno=%d %s, expected %d (EBADF)",
- Fds[ind], TEST_ERRNO, strerror(TEST_ERRNO), EBADF);
- }
- }
- } else {
- tst_resm(TFAIL, "dup(%d) returned %d, expected -1, errno:%d (EBADF)",
- Fds[ind], TEST_RETURN, EBADF);
-
- /* close the new file so loops do not open too many files */
- if (close(TEST_RETURN) == -1) {
- tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s",
- TEST_RETURN, errno, strerror(errno));
- }
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/dup04.c b/winsup/testsuite/winsup.api/ltp/dup04.c
deleted file mode 100644
index 85540db35..000000000
--- a/winsup/testsuite/winsup.api/ltp/dup04.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : dup04
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for dup(2) of a system pipe descriptor
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 06/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) dup(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the dup(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * dup(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-char *TCID="dup04"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int Fd[2];
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call dup(2) for read side
- */
- TEST( dup(Fd[0]) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "dup(%d) read side of syspipe Failed, errno=%d : %s", Fd[0],
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "dup(%d) read side of syspipe returned %d", Fd[0],
- TEST_RETURN);
-
- }
- else
- Tst_count++;
-
- /* close the new file so loops do not open too many files */
- if (close(TEST_RETURN) == -1) {
- tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s",
- TEST_RETURN, errno, strerror(errno));
- }
- }
-
- /*
- * Call dup(2) for write side
- */
- TEST( dup(Fd[1]) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "dup(%d) write side of syspipe Failed, errno=%d : %s", Fd[1],
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "dup(%d) write side of syspipe returned %d", Fd[1],
- TEST_RETURN);
-
- }
- else
- Tst_count++;
-
- /* close the new file so loops do not open too many files */
- if (close(TEST_RETURN) == -1) {
- tst_brkm(TBROK, cleanup, "close(%d) Failed, errno=%d : %s",
- TEST_RETURN, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /*
- * Initialize Fd in case we get a quick signal
- */
- Fd[0]=-1;
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- if ( pipe(Fd) == -1 ) {
- tst_brkm(TBROK, cleanup, "pipe(&Fd) Failed, errno=%d : %s",
- errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- int ind;
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the open file we've been dup'ing */
- if (Fd[0] != -1) {
- for (ind=0; ind<2; ind++) {
- if (close(Fd[ind]) == -1) {
- tst_resm(TWARN, "close(%d) Failed, errno=%d : %s",
- Fd[ind], errno, strerror(errno));
- }
- Fd[ind]=-1;
- }
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/dup05.c b/winsup/testsuite/winsup.api/ltp/dup05.c
deleted file mode 100644
index 4f889cdcd..000000000
--- a/winsup/testsuite/winsup.api/ltp/dup05.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : dup05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for dup(2) of a named pipe descriptor
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 06/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) dup(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the dup(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * dup(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-char *TCID="dup05"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char Fname[255];
-int Fd;
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call dup(2)
- */
- TEST( dup(Fd) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "dup(%s) Failed, errno=%d : %s", Fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "dup(%s) returned %d", Fname, TEST_RETURN);
- }
-
- /* close the new file so loops do not open too many files */
- if (close(TEST_RETURN) == -1) {
- tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /*
- * Initialize Fd in case we get a quick signal
- */
- Fd=-1;
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname, "dupfile");
- if ( mkfifo(Fname, 0777) == -1 ) {
- tst_brkm(TBROK, cleanup,
- "mkfifo(%s, 0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- if ((Fd = open(Fname, O_RDWR, 0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR, 0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the open file we've been dup'ing */
- if (Fd != -1) {
- if (close(Fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- Fd=-1;
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/execl01.c b/winsup/testsuite/winsup.api/ltp/execl01.c
deleted file mode 100644
index b23716a0f..000000000
--- a/winsup/testsuite/winsup.api/ltp/execl01.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : execl01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for execl(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 06/01/02
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) execl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the execl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * execl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="execl01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int pid; /* process id from fork */
-int status; /* status returned from waitpid */
-
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- Tst_nobuf=1; /* turn off buffering in tst_ routines */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * fork, then call execl from child
- */
- switch(pid=fork()) {
- case 0: /* CHILD - Call execl(2) */
- execl("test", "test", NULL);
- /* should not get here!! if we do, the parent will fail the Test Case */
- exit(errno);
- case -1: /* ERROR!!! exit now!!*/
- tst_brkm(TBROK, cleanup,
- "Unable to fork a child process to exec over! Errno:%d,:%s",
- errno, strerror(errno));
- break;
- default:
- waitpid(pid, &status, 0);
- if ( WIFEXITED(status) ) {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "execl - properly exec's a simple program..");
- }
- } else {
- TEST_ERROR_LOG(WEXITSTATUS(status));
- tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status);
- }
- break;
- } /* switch */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /*
- * Send out info message that timing and errnolog info is not
- * available because of the use of a child process for each exec
- */
- if ( STD_TIMING_ON )
- tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\
-This is because the test forks to create a child process which then calls execl.\n\
-The TEST macro is NOT used.");
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/execle01.c b/winsup/testsuite/winsup.api/ltp/execle01.c
deleted file mode 100644
index f29d34f6a..000000000
--- a/winsup/testsuite/winsup.api/ltp/execle01.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : execle01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for execle(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 06/01/02
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) execle(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the execle(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * execle(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="execle01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int pid; /* process id from fork */
-int status; /* status returned from waitpid */
-extern char **environ; /* pointer to this processes env, to pass along */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- Tst_nobuf=1; /* turn off buffering in tst_ routines */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * fork, then call execle from child
- */
- switch(pid=fork()) {
- case 0: /* CHILD - Call execle(2) */
- execle("test", "test", 0, environ);
- /* should not get here!! if we do, the parent will fail the Test Case */
- exit(errno);
- case -1: /* ERROR!!! exit now!!*/
- tst_brkm(TBROK, cleanup,
- "Unable to fork a child process to exec over! Errno:%d,:%s",
- errno, strerror(errno));
- break;
- default:
- waitpid(pid, &status, 0);
- if ( WIFEXITED(status) ) {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "execle - properly exec's a simple program..");
- }
- } else {
- TEST_ERROR_LOG(WEXITSTATUS(status));
- tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status);
- }
- break;
- } /* switch */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /*
- * Send out info message that timing and errnolog info is not
- * available because of the use of a child process for each exec
- */
- if ( STD_TIMING_ON )
- tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\
-This is because the test forks to create a child process which then calls execle.\n\
-The TEST macro is NOT used.");
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/execlp01.c b/winsup/testsuite/winsup.api/ltp/execlp01.c
deleted file mode 100644
index 6bf97d4e1..000000000
--- a/winsup/testsuite/winsup.api/ltp/execlp01.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : execlp01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for execlp(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 06/01/02
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) execlp(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the execlp(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * execlp(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="execlp01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int pid; /* process id from fork */
-int status; /* status returned from waitpid */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- Tst_nobuf=1; /* turn off buffering in tst_ routines */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * fork, then call execlp from child
- */
- switch(pid=fork()) {
- case 0: /* CHILD - Call execlp(2) */
- execlp("/usr/bin/test", "/usr/bin/test", 0);
- /* should not get here!! if we do, the parent will fail the Test Case */
- exit(errno);
- case -1: /* ERROR!!! exit now!!*/
- tst_brkm(TBROK, cleanup,
- "Unable to fork a child process to exec over! Errno:%d,:%s",
- errno, strerror(errno));
- break;
- default:
- waitpid(pid, &status, 0);
- if ( WIFEXITED(status) ) {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "execlp - properly exec's a simple program..");
- }
- } else {
- TEST_ERROR_LOG(WEXITSTATUS(status));
- tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status);
- }
- break;
- } /* switch */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /*
- * Send out info message that timing and errnolog info is not
- * available because of the use of a child process for each exec
- */
- if ( STD_TIMING_ON )
- tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\
-This is because the test forks to create a child process which then calls execlp.\n\
-The TEST macro is NOT used.");
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/execv01.c b/winsup/testsuite/winsup.api/ltp/execv01.c
deleted file mode 100644
index b833e1c4f..000000000
--- a/winsup/testsuite/winsup.api/ltp/execv01.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : execv01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for execv(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 06/01/02
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) execv(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the execv(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * execv(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="execv01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int pid; /* process id from fork */
-int status; /* status returned from waitpid */
-char *args[2]={"/usr/bin/test", 0}; /* argument list for execv call */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- Tst_nobuf=1; /* turn off buffering in tst_ routines */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * fork, then call execv from child
- */
- switch(pid=fork()) {
- case 0: /* CHILD - Call execv(2) */
- execv("/usr/bin/test", args);
- /* should not get here!! if we do, the parent will fail the Test Case */
- exit(errno);
- case -1: /* ERROR!!! exit now!!*/
- tst_brkm(TBROK, cleanup,
- "Unable to fork a child process to exec over! Errno:%d,:%s",
- errno, strerror(errno));
- break;
- default:
- waitpid(pid, &status, 0);
- if ( WIFEXITED(status) ) {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "execv - properly exec's a simple program..");
- }
- } else {
- TEST_ERROR_LOG(WEXITSTATUS(status));
- tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status);
- }
- break;
- } /* switch */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /*
- * Send out info message that timing and errnolog info is not
- * available because of the use of a child process for each exec
- */
- if ( STD_TIMING_ON )
- tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\
-This is because the test forks to create a child process which then calls execv.\n\
-The TEST macro is NOT used.");
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/execve01.c b/winsup/testsuite/winsup.api/ltp/execve01.c
deleted file mode 100644
index 1abe72f23..000000000
--- a/winsup/testsuite/winsup.api/ltp/execve01.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : execve01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for execve(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 06/01/02
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) execve(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the execve(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * execve(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="execve01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int pid; /* process id from fork */
-int status; /* status returned from waitpid */
-char *args[2]={"/usr/bin/test", 0}; /* argument list for execve call */
-extern char **environ; /* pointer to this processes env, to pass along */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- Tst_nobuf=1; /* turn off buffering in tst_ routines */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * fork, then call execve from child
- */
- switch(pid=fork()) {
- case 0: /* CHILD - Call execve(2) */
- execve("/usr/bin/test", args, environ);
- /* should not get here!! if we do, the parent will fail the Test Case */
- exit(errno);
- case -1: /* ERROR!!! exit now!!*/
- tst_brkm(TBROK, cleanup,
- "Unable to fork a child process to exec over! Errno:%d,:%s",
- errno, strerror(errno));
- break;
- default:
- waitpid(pid, &status, 0);
- if ( WIFEXITED(status) ) {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "execve - properly exec's a simple program..");
- }
- } else {
- TEST_ERROR_LOG(WEXITSTATUS(status));
- tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status);
- }
- break;
- } /* switch */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /*
- * Send out info message that timing and errnolog info is not
- * available because of the use of a child process for each exec
- */
- if ( STD_TIMING_ON )
- tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\
-This is because the test forks to create a child process which then calls execve.\n\
-The TEST macro is NOT used.");
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/execvp01.c b/winsup/testsuite/winsup.api/ltp/execvp01.c
deleted file mode 100644
index 6f645d68d..000000000
--- a/winsup/testsuite/winsup.api/ltp/execvp01.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : execvp01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for execvp(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 06/01/02
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) execvp(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the execvp(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * execvp(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="execvp01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf; /* used to turn off buffering in tst_ routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int pid; /* process id from fork */
-int status; /* status returned from waitpid */
-char *args[2]={"/usr/bin/test", 0}; /* argument list for execvp call */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- Tst_nobuf=1; /* turn off buffering in tst_ routines */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * fork, then call execvp from child
- */
- switch(pid=fork()) {
- case 0: /* CHILD - Call execvp(2) */
- execvp("/usr/bin/test", args);
- /* should not get here!! if we do, the parent will fail the Test Case */
- exit(errno);
- case -1: /* ERROR!!! exit now!!*/
- tst_brkm(TBROK, cleanup,
- "Unable to fork a child process to exec over! Errno:%d,:%s",
- errno, strerror(errno));
- break;
- default:
- waitpid(pid, &status, 0);
- if ( WIFEXITED(status) ) {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "execvp - properly exec's a simple program..");
- }
- } else {
- TEST_ERROR_LOG(WEXITSTATUS(status));
- tst_resm(TFAIL, "Child process did not terminate properly, status=%d", status);
- }
- break;
- } /* switch */
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /*
- * Send out info message that timing and errnolog info is not
- * available because of the use of a child process for each exec
- */
- if ( STD_TIMING_ON )
- tst_resm(TINFO, "There are NO timing statistics produced by this test.\n\
-This is because the test forks to create a child process which then calls execvp.\n\
-The TEST macro is NOT used.");
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/fchmod01.c b/winsup/testsuite/winsup.api/ltp/fchmod01.c
deleted file mode 100644
index ffcf37f66..000000000
--- a/winsup/testsuite/winsup.api/ltp/fchmod01.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fchmod01
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fchmod(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fchmod(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fchmod(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fchmod01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-char *buf = "davef";
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call fchmod(2)
- */
- TEST(fchmod(fd, 0700));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fchmod(%s, 0700) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fchmod(%s, 0700) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if (write(fd, &buf, strlen(buf)) == -1) {
- tst_brkm(TBROK, cleanup, "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the open file wev'e been chmoding */
- if (close(fd) == -1) {
- tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/fchown01.c b/winsup/testsuite/winsup.api/ltp/fchown01.c
deleted file mode 100644
index 045f84892..000000000
--- a/winsup/testsuite/winsup.api/ltp/fchown01.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fchown01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fchown(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 02/14/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fchown(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fchown(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fchown(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fchown01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int Fd; /* file descriptor for fchown */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /* Call fchown(2) just once */
- TEST(fchown(Fd, geteuid(), getegid()));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL,
- "fchown(Fd, geteuid(), getegid()) failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* Perform functional verification here */
- tst_resm(TPASS,
- "fchown(Fd, geteuid(), getegid()) returned %d",
- TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- char fname[1024];
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a tempdir and change to it */
- tst_tmpdir();
-
- /* open a file for read/write */
- sprintf(fname, "./tmpfile.%d", getpid());
- if ( (Fd=open(fname, O_RDWR|O_CREAT, 0700)) == -1 )
- tst_brkm(TBROK, cleanup,
- "Unable to open %s for read/write. Error:%d, %s",
- fname, errno, strerror(errno)); /* this exits */
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- close(Fd);
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove temp dir and files */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl02.c b/winsup/testsuite/winsup.api/ltp/fcntl02.c
deleted file mode 100644
index 14fc1b61d..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl02.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_DUPFD argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fcntl02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call fcntl(2) with F_DUPFD argument on fname
- */
- TEST(fcntl(fd, F_DUPFD, 0));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fcntl(%s, F_DUPFD, 0) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fcntl(%s, F_DUPFD, 0) returned %d", fname, TEST_RETURN);
- }
- if (close(TEST_RETURN) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we've had open */
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl03.c b/winsup/testsuite/winsup.api/ltp/fcntl03.c
deleted file mode 100644
index 93a9b9b1f..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl03.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_GETFD argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fcntl03"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call fcntl(2) with F_GETFD argument on fname
- */
- TEST(fcntl(fd, F_GETFD, 0));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fcntl(%s, F_GETFD, 0) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fcntl(%s, F_GETFD, 0) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl04.c b/winsup/testsuite/winsup.api/ltp/fcntl04.c
deleted file mode 100644
index d70843071..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl04.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl04
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_GETFL argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fcntl04"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call fcntl(2) with F_GETFL argument on fname
- */
- TEST(fcntl(fd, F_GETFL, 0));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fcntl(%s, F_GETFL, 0) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fcntl(%s, F_GETFL, 0) returned %d", fname, TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl05.c b/winsup/testsuite/winsup.api/ltp/fcntl05.c
deleted file mode 100644
index 86f492aa7..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl05.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_GETLK argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fcntl05"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-struct flock flocks;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- flocks.l_type = F_RDLCK;
- /*
- * Call fcntl(2) with F_GETLK argument on fname
- */
- TEST(fcntl(fd, F_GETLK, &flocks));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fcntl(%s, F_GETLK, &flocks) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fcntl(%s, F_GETLK, &flocks) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- /* set needed flags in the flocks structure */
- flocks.l_whence=1;
- flocks.l_start=0;
- flocks.l_len=0;
- flocks.l_pid=getpid();
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Close the file we have open */
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07.c b/winsup/testsuite/winsup.api/ltp/fcntl07.c
deleted file mode 100644
index c48e475ba..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl07.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl07
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Close-On-Exec functional test
- *
- * PARENT DOCUMENT : none
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 5
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Glen Overby
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 08/11/93
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) test close-on-exec with a regular file
- * 2.) test close-on-exec with a system pipe
- *
- * INPUT SPECIFICATIONS
- *
- * Standard arguments accepted by parse_opts(3).
- *
- * The -t (timing) and -e options apply to the fcntl(.., F_SETFD, ..)
- * system call.
- *
- * -T fd : If this option is given, the program runs as "test_open",
- * testing <fd> to see if it is open or not and exiting
- * accordingly:
- * 0 not open (EBADF from fcntl(..., F_GETFD, ...))
- * 3 no error from fcntl
- * errno fcntl returned an error other than EBADF
- *
- * -F name : File to open. Must be an absolute path
- * and the file must be writable;
- * -n program: path to the 'test_open' program
- *
- * OUTPUT SPECIFICATIONS
- * This test uses the cuts-style test_res format output consisting of:
- *
- * test-name PASS/FAIL/BROK message
- *
- * the message will tell what type of test and, if it failed, indicate
- * what the failure was.
- *
- * DURATION
- * Terminates
- *
- * SIGNALS
- * None
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * If this test is not called with a full pathname, it must be able
- * to find itself on $PATH
- *
- * INTERCASE DEPENDENCIES
- * none
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Setup signal handling.
- * Create and make current a temporary directory.
- * Open a regular file for writing
- * Create a system pipe
- * Create a named pipe and open it for writing
- *
- * Test:
- * Set the file descriptor for close-on-exec
- * Fork
- * Child execlp's the program "test_open".
- * If the exec fails, exit "2"
- * Parent waits
- * Report results.
- *
- * Cleanup:
- * Close file and pipes
- * Remove the temporary directory
- *
- * BUGS
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <limits.h>
-
-#include "test.h"
-#include "usctest.h"
-#include "search_path.h"
-
-void setup();
-void cleanup();
-void help();
-
-char *TCID="fcntl07"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-
-
-/* for parse_opts */
-int fflag, Tflag; /* binary flags: opt or not */
-char *fopt, *Topt; /* option arguments */
-
-option_t options[] = {
- { "F:", &fflag, &fopt }, /* -F filename */
- { "T:", &Tflag, &Topt }, /* -T <fd> exec'ed by test: test FD */
- { NULL, NULL, NULL }
-};
-
-int stat_loc; /* for waitpid() */
-
-int file_fd, pipe_fds[2];
- /* file descriptors for a file and a system pipe */
-#define DEFAULT_FILE "DefaultFileName"
-char *File1 = DEFAULT_FILE;
-
-#define DEFAULT_SUBPROG "test_open"
-char *openck = DEFAULT_SUBPROG; /* support program name to check for open FD */
-char subprog_path[_POSIX_PATH_MAX]; /* path to exec "openck" with */
-#define STRSIZE 255
-
-int *testfds[] = {
- &file_fd, &pipe_fds[1], 0
- };
-
-char *testfdtypes[] = {
- "regular file",
- "write side of system pipe",
- };
-
-int test_open(char *arg);
-int do_exec(char *prog, int fd, char *tcd);
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int exec_return; /* return from do_exec */
- int **tcp; /* testcase pointer (pointer to FD) */
- char **tcd; /* testcase description pointer */
-
- /***************************************************************
- * parse standard options, and exit if there is an error
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- if(fflag) /* -F option */
- File1 = fopt;
-
- if(Tflag) { /* -T option */
- exit(test_open(Topt));
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup(av[0]);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for(tcp = testfds, tcd = testfdtypes; *tcp; tcp++, tcd++) {
-
- TEST(fcntl(**tcp, F_SETFD, FD_CLOEXEC));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fcntl(%s[%d], F_SETFD, FD_CLOEXEC) Failed, errno=%d : %s",
- *tcd, **tcp, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /*************************************************************
- * only perform functional verification if flag set
- * (-f not given)
- *************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
-
- exec_return = do_exec(subprog_path, **tcp, *tcd);
-
- switch(exec_return) {
- case -1:
- tst_resm(TBROK, "fork failed. Errno %s [%d]",
- strerror(errno), errno);
- break;
- case 1:
- tst_resm(TBROK, "waitpid return was 0%o", stat_loc);
- break;
- case 2:
- tst_resm(TBROK, "exec failed"); /* errno was in child */
- break;
- case 0:
- tst_resm(TPASS, "%s child exited 0, indicating that the file was closed",
- *tcd);
- break;
- default:
- tst_resm(TFAIL, "%s child exited non-zero, %d", *tcd,
- exec_return);
- break;
- }
- }
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup(char *path)
-{
- search_path(path, subprog_path, X_OK, 1);
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* create a temporary directory and go to it */
- tst_tmpdir();
-
- /* set up a regular file */
- if((file_fd=open(File1, O_CREAT|O_RDWR, 0666)) == -1) {
- tst_brkm(TBROK, cleanup, "Open of file %s failed errno %d (%s)\n", File1, errno, strerror(errno));
- }
-
- /* set up a system pipe (write side gets CLOSE-ON-EXEC) */
- pipe(pipe_fds);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close everything */
- close(file_fd);
- close(pipe_fds[0]);
- close(pipe_fds[1]);
-
- /* remove temporary directory and all files in it. */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-/***************************************************************************
- * issue a help message
- ***************************************************************************/
-void
-help()
-{
- printf("-T fd : If this option is given, the program runs as 'test_open'\n");
- printf(" testing <fd> to see if it is open or not and exiting accordingly\n");
- printf("-F name : File to open. Must be an absolute path,\n");
- printf(" and the file must be writable\n");
- printf("-n program: path to the 'test_open' program\n");
-}
-
-/*---------------------------------------------------------------------------*/
-/* Perform an exec, then wait for the child to terminate.
- * The child's termination status determines the success of the test
- *
- * Return codes:
- * -1 BROK fork failed
- * 1 BROK waitpid returned != exit status
- * <else> ???? exit code from child:
- * 2 BROK exec failed
- * 0 PASS fd was properly closed
- *
- */
-
-int
-do_exec(char *prog, int fd, char *tcd)
-{
- int pid;
- char pidname[STRSIZE];
-#ifdef DEBUG
- int rc, status; /* for the fcntl */
-#endif
-
- /* set up arguments to exec'ed child */
- sprintf(pidname, "%d", fd);
-
-#ifdef DEBUG
- rc = fcntl(fd, F_GETFD, &status);
- printf("%s: fd = %d rc = %d status= %d, errno= %d\n", tcd, fd, rc, status, errno);
-#endif
-
- switch(pid=fork()) {
- case -1:
- return(-1);
- case 0: /* child */
- execlp(prog, openck, "-T", pidname, 0);
-
- /* the ONLY reason to do this is to get the errno printed out */
- fprintf(stderr, "exec(%s, %s, -T, %s) failed. Errno %s [%d]\n",
- prog, openck, pidname, strerror(errno), errno);
- exit(2);
- default: /* parent */
- waitpid(pid, &stat_loc, 0);
- if(WIFEXITED(stat_loc)) {
- return(WEXITSTATUS(stat_loc));
- } else {
- return(1);
- }
- }
-}
-
-/*
- * PROGRAM TITLE : Test if a named file descriptor is open
- * This function is called when fcntcs07 is called with the -T option.
- * It tests if a file descriptor is open and exits accordingly.
- */
-int
-test_open(char *arg)
-{
- int fd, rc;
- int status;
-
- fd = atoi(arg);
-
- rc = fcntl(fd, F_GETFD, &status);
-
-#ifdef DEBUG_T
- printf("%s: fd = %d rc = %d status= %d, errno= %d\n", openck, fd, rc,
- status, errno);
-#endif
-
- if(rc == -1 && errno == EBADF) {
- exit(0);
- }
-
- if(rc != -1)
- exit(3);
-
- exit(errno);
- return -1; /* to remove compiler warning on IRIX */
-}
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl07B.c b/winsup/testsuite/winsup.api/ltp/fcntl07B.c
deleted file mode 100644
index 51b88c278..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl07B.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl07B
- * <same
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Close-On-Exec of named pipe functional test
- *
- * PARENT DOCUMENT : none
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 5
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan :copied from fcntcs07 written by Glen Overby
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 08/11/93
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) test close-on-exec with a named pipe
- *
- * INPUT SPECIFICATIONS
- *
- * Standard arguments accepted by parse_opts(3).
- *
- * The -t (timing) and -e options apply to the fcntl(.., F_SETFD, ..)
- * system call.
- *
- * -T fd : If this option is given, the program runs as "test_open",
- * testing <fd> to see if it is open or not and exiting
- * accordingly:
- * 0 not open (EBADF from fcntl(..., F_GETFD, ...))
- * 3 no error from fcntl
- * errno fcntl returned an error other than EBADF
- *
- * -F name : File to open. Must be an absolute path
- * and the file must be writable;
- * -n program: path to the 'test_open' program
- *
- * OUTPUT SPECIFICATIONS
- * This test uses the cuts-style test_res format output consisting of:
- *
- * test-name PASS/FAIL/BROK message
- *
- * the message will tell what type of test and, if it failed, indicate
- * what the failure was.
- *
- * DURATION
- * Terminates
- *
- * SIGNALS
- * None
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * If this test is not called with a full pathname, it must be able
- * to find itself on $PATH
- *
- * INTERCASE DEPENDENCIES
- * none
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Setup signal handling.
- * Create and make current a temporary directory.
- * Create a named pipe and open it for writing
- *
- * Test:
- * Set the file descriptor for close-on-exec
- * Fork
- * Child execlp's the program "test_open".
- * If the exec fails, exit "2"
- * Parent waits
- * Report results.
- *
- * Cleanup:
- * Close file and pipes
- * Remove the temporary directory
- *
- * BUGS
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <limits.h>
-
-#include "test.h"
-#include "usctest.h"
-#include "search_path.h"
-
-void setup();
-void cleanup();
-void help();
-
-char *TCID="fcntl07B"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-
-/* for parse_opts */
-int fflag, Tflag; /* binary flags: opt or not */
-char *fopt, *Topt; /* option arguments */
-
-option_t options[] = {
- { "F:", &fflag, &fopt }, /* -F filename */
- { "T:", &Tflag, &Topt }, /* -T <fd> exec'ed by test: test FD */
- { NULL, NULL, NULL }
-};
-
-int stat_loc; /* for waitpid() */
-
-int npipe_fd;
- /* file descriptors for a named pipe */
-#define DEFAULT_FILE "DefaultFileName"
-char *File1 = DEFAULT_FILE;
-
-#define DEFAULT_SUBPROG "test_open"
-char *openck = DEFAULT_SUBPROG; /* support program name to check for open FD */
-char subprog_path[_POSIX_PATH_MAX]; /* path to exec "openck" with */
-#define STRSIZE 255
-#define FIFONAME "FiFo"
-
-int *testfds[] = {
- &npipe_fd, 0
- };
-
-char *testfdtypes[] = {
- "named pipe"
- };
-
-int test_open(char *arg);
-int do_exec(char *prog, int fd, char *tcd);
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int exec_return; /* return from do_exec */
- int **tcp; /* testcase pointer (pointer to FD) */
- char **tcd; /* testcase description pointer */
-
- /***************************************************************
- * parse standard options, and exit if there is an error
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- if(fflag) /* -F option */
- File1 = fopt;
-
- if(Tflag) { /* -T option */
- exit(test_open(Topt));
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup(av[0]);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for(tcp = testfds, tcd = testfdtypes; *tcp; tcp++, tcd++) {
-
- TEST(fcntl(**tcp, F_SETFD, FD_CLOEXEC));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fcntl(%s[%d], F_SETFD, FD_CLOEXEC) Failed, errno=%d : %s",
- *tcd, **tcp, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /*************************************************************
- * only perform functional verification if flag set
- * (-f not given)
- *************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
-
- exec_return = do_exec(subprog_path, **tcp, *tcd);
-
- switch(exec_return) {
- case -1:
- tst_resm(TBROK, "fork failed. Errno %s [%d]",
- strerror(errno), errno);
- break;
- case 1:
- tst_resm(TBROK, "waitpid return was 0%o", stat_loc);
- break;
- case 2:
- tst_resm(TBROK, "exec failed"); /* errno was in child */
- break;
- case 0:
- tst_resm(TPASS, "%s child exited 0, indicating that the file was closed",
- *tcd);
- break;
- default:
- tst_resm(TFAIL, "%s child exited non-zero, %d", *tcd,
- exec_return);
- break;
- }
- }
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup(char *path)
-{
- search_path(path, subprog_path, X_OK, 1);
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* create a temporary directory and go to it */
- tst_tmpdir();
-
- /* set up a named pipe (write side gets CLOSE-ON-EXEC) */
- if(mkfifo(FIFONAME, 0666) == -1) {
- tst_brkm(TBROK, cleanup, "mkfifo of named pipe %s failed errno %d (%s)\n", FIFONAME, errno, strerror(errno));
- }
-
- if((npipe_fd=open(FIFONAME, O_RDWR, 0666)) == -1) {
- tst_brkm(TBROK, cleanup, "Open of named pipe %s failed errno %d (%s)\n", File1, errno, strerror(errno));
- }
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close everything */
- close(npipe_fd);
-
- /* remove temporary directory and all files in it. */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-/***************************************************************************
- * issue a help message
- ***************************************************************************/
-void
-help()
-{
- printf("-T fd : If this option is given, the program runs as 'test_open'\n");
- printf(" testing <fd> to see if it is open or not and exiting accordingly\n");
- printf("-F name : File to open. Must be an absolute path,\n");
- printf(" and the file must be writable\n");
- printf("-n program: path to the 'test_open' program\n");
-
-}
-
-/*---------------------------------------------------------------------------*/
-/* Perform an exec, then wait for the child to terminate.
- * The child's termination status determines the success of the test
- *
- * Return codes:
- * -1 BROK fork failed
- * 1 BROK waitpid returned != exit status
- * <else> ???? exit code from child:
- * 2 BROK exec failed
- * 0 PASS fd was properly closed
- *
- */
-
-int
-do_exec(char *prog, int fd, char *tcd)
-{
- int pid;
- char pidname[STRSIZE];
-#ifdef DEBUG
- int rc, status; /* for the fcntl */
-#endif
-
- /* set up arguments to exec'ed child */
- sprintf(pidname, "%d", fd);
-
-#ifdef DEBUG
- rc = fcntl(fd, F_GETFD, &status);
- printf("%s: fd = %d rc = %d status= %d, errno= %d\n", tcd, fd, rc, status, errno);
-#endif
-
- switch(pid=fork()) {
- case -1:
- return(-1);
- case 0: /* child */
- execlp(prog, openck, "-T", pidname, 0);
-
- /* the ONLY reason to do this is to get the errno printed out */
- fprintf(stderr, "exec(%s, %s, -T, %s) failed. Errno %s [%d]\n",
- prog, openck, pidname, strerror(errno), errno);
- exit(2);
- default: /* parent */
- waitpid(pid, &stat_loc, 0);
- if(WIFEXITED(stat_loc)) {
- return(WEXITSTATUS(stat_loc));
- } else {
- return(1);
- }
- }
-}
-
-/*
- * PROGRAM TITLE : Test if a named file descriptor is open
- * This function is called when fcntcs07 is called with the -T option.
- * It tests if a file descriptor is open and exits accordingly.
- */
-int
-test_open(char *arg)
-{
- int fd, rc;
- int status;
-
- extern char *optarg;
- extern int optind;
-
- fd = atoi(arg);
-
- rc = fcntl(fd, F_GETFD, &status);
-
-#ifdef DEBUG_T
- printf("%s: fd = %d rc = %d status= %d, errno= %d\n", openck, fd, rc,
- status, errno);
-#endif
-
- if(rc == -1 && errno == EBADF) {
- exit(0);
- }
-
- if(rc != -1)
- exit(3);
-
- exit(errno);
- return -1; /* To remove compiler warning on IRIX */
-}
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl08.c b/winsup/testsuite/winsup.api/ltp/fcntl08.c
deleted file mode 100644
index c4cbad461..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl08.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl08
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_SETFL argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * close file
- * remove temp directory
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-#ifndef O_NDELAY
-#define O_NDELAY 0
-#endif
-
-char *TCID="fcntl08"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-char fname[255];
-int arg, fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call fcntl(2) with F_SETFL argument on fname
- */
- TEST(fcntl(fd, F_SETFL, arg));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- tst_resm(TFAIL, "fcntl(%s, F_SETFL, %d) Failed, errno=%d : %s",
- fname, arg, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fcntl(%s, F_SETFL, %d) returned %d",
- fname, arg, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- /* set the flags to be used */
-#ifdef CRAY
- arg = (O_NDELAY | O_APPEND | O_RAW | O_NONBLOCK);
-#else
- arg = (O_NDELAY | O_APPEND | O_NONBLOCK);
-#endif /* ! CRAY */
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we have open */
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl09.c b/winsup/testsuite/winsup.api/ltp/fcntl09.c
deleted file mode 100644
index f10df71fe..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl09.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl09
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_SETLK argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fcntl09"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-struct flock flocks;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- flocks.l_type = F_RDLCK | F_WRLCK;
- /*
- * Call fcntl(2) with F_SETLK argument on fname
- */
- TEST(fcntl(fd, F_SETLK, &flocks));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL,
- "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS,
- "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d",
- fname, TEST_RETURN);
- }
- }
-
- flocks.l_type = F_UNLCK;
- /*
- * Call fcntl(2) with F_SETLK argument on fname
- */
- TEST(fcntl(fd, F_SETLK, &flocks));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL,
- "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_UNLCK Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS,
- "fcntl(%s, F_SETLK, &flocks) flocks.l_type = F_UNLCK returned %d",
- fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"./file_%d",getpid());
- if (creat(fname, 02644) == -1) {
- tst_brkm(TBROK, cleanup, "creat(%s, 02644) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if ((fd = open(fname,O_RDWR,0700)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR,0700) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
- flocks.l_whence=1;
- flocks.l_start=0;
- flocks.l_len=0;
- flocks.l_pid=getpid();
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if (unlink(fname) == -1) {
- tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
-
- }
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fcntl10.c b/winsup/testsuite/winsup.api/ltp/fcntl10.c
deleted file mode 100644
index 8b23575b3..000000000
--- a/winsup/testsuite/winsup.api/ltp/fcntl10.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fcntl10
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fcntl(2) using F_SETLKW argument.
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fcntl(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fcntl(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fcntl(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fcntl10"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-struct flock flocks;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- flocks.l_type = F_RDLCK | F_WRLCK;
- /*
- * Call fcntl(2) with F_SETLKW flocks.l_type = F_UNLCK argument on fname
- */
- TEST(fcntl(fd, F_SETLKW, &flocks));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL,
- "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_RDLCK | F_WRLCK Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS,
- "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_RDLCK | F_WRLCK returned %d",
- fname, TEST_RETURN);
- }
- }
-
- flocks.l_type = F_UNLCK;
- /*
- * Call fcntl(2) with F_SETLKW flocks.l_type = F_UNLCK argument on fname
- */
- TEST(fcntl(fd, F_SETLKW, &flocks));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL,
- "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_UNLCK Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS,
- "fcntl(%s, F_SETLKW, &flocks) flocks.l_type = F_UNLCK returned %d",
- fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = creat(fname, 02644)) == -1) {
- tst_brkm(TBROK, cleanup, "creat(%s, 02644) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_brkm(TBROK, cleanup, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- } else if ((fd = open(fname,O_RDWR,0700)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR,0700) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* set needed fields in the flocks structure */
- flocks.l_whence=1;
- flocks.l_start=0;
- flocks.l_len=0;
- flocks.l_pid=getpid();
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fork01.c b/winsup/testsuite/winsup.api/ltp/fork01.c
deleted file mode 100644
index dfd412a5f..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork01.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fork01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fork(2)
- *
- * PARENT DOCUMENT : frktds02
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Kathy Olmsted
- *
- * CO-PILOT : Steve Shaw
- *
- * DATE STARTED : 06/17/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fork returns without error
- * 2.) fork returns the pid of the child
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * fork()
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- * CHILD:
- * determine PID
- * write to PID to a file and close the file
- * exit
- * PARENT:
- * wait for child to exit
- * read child PID from file
- * compare child PID to fork() return code and report
- * results
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "test.h"
-#include "usctest.h"
-
-#define KIDEXIT 42
-extern void setup();
-extern void cleanup();
-
-#define LINE_SZ 20 /* size of the line written/read to the file */
-#define FILENAME "childpid"
-
-
-
-char *TCID="fork01"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-/***************************************************************
- * child_pid - the child side of the test
- * determine the PID and write to a file
- ***************************************************************/
-void child_pid()
-{
-
- int fildes;
- char tmp_line[LINE_SZ];
-
- fildes = creat(FILENAME,0700);
- sprintf(tmp_line,"%d\n",getpid());
- write(fildes,tmp_line,LINE_SZ);
- close(fildes);
-
-}
-
-/***************************************************************
- * parent_pid - the parent side of the test
- * read the value determined by the child
- * compare and report results
- ***************************************************************/
-void parent_pid()
-{
-
- int fildes;
- char tmp_line[LINE_SZ];
- pid_t child_id;
-
- if ((fildes = open(FILENAME,O_RDWR)) == -1) {
- tst_brkm(TBROK, cleanup,
- "parent open failed. errno: %d (%s)\n",
- errno, strerror(errno));
- }
- else {
- if (read(fildes,tmp_line,LINE_SZ) == 0) {
- tst_brkm(TBROK,cleanup, "fork(): parent failed to read PID from file errno: %d (%s)",
- errno, strerror(errno));
- }
- else {
- child_id = atoi(tmp_line);
- if (TEST_RETURN != child_id) {
- tst_resm(TFAIL,"child reported a pid of %d. parent received %d from fork()",
- child_id,TEST_RETURN);
- } else {
- tst_resm(TPASS,"child pid and fork() return agree: %d",child_id);
- }
- }
- close(fildes);
- }
-}
-
-/***************************************************************
- * main() - performs tests
- *
- ***************************************************************/
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int fails;
- int kid_status, wait_status;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
- fails = 0;
-
- /*
- * Call fork(2)
- */
- TEST(fork());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TFAIL, "fork() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- tst_resm(TBROK,"unable to continue");
- }
- }
- if (TEST_RETURN == 0) {
- /* child */
- if ( STD_FUNCTIONAL_TEST ) {
- child_pid();
- }
- exit(KIDEXIT);
- } else {
- /* parent */
- if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS, "fork() returned %d", TEST_RETURN);
- }
- /* wait for the child to complete */
- wait_status = wait(&kid_status);
- if ( STD_FUNCTIONAL_TEST ) {
- if (wait_status == TEST_RETURN) {
- if (kid_status != KIDEXIT << 8) {
- tst_resm(TBROK,
- "incorrect child status returned on wait(): %d",
- kid_status);
- fails++;
- }
- }
- else {
- tst_resm(TBROK,
- "wait() for child status failed with %d errno: %d : %s",
- wait_status,errno,strerror(errno));
- fails++;
- }
- if (fails == 0 ) {
- /* verification tests */
- parent_pid();
- }
- } /* STD_FUNCTIONAL_TEST */
- } /* TEST_RETURN */
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
- setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
- cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_rmdir();
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fork04.c b/winsup/testsuite/winsup.api/ltp/fork04.c
deleted file mode 100644
index 3725d9f0f..000000000
--- a/winsup/testsuite/winsup.api/ltp/fork04.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fork04
- *
- * TEST TITLE : Child inheritance of Environment Variables after fork()
- *
- * PARENT DOCUMENT : frktds01
- *
- * TEST CASE TOTAL : 3
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Kathy Olmsted
- *
- * CO-PILOT : Steve Shaw
- *
- * DATE STARTED : 06/17/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- * Test these environment variables correctly inherited by child:
- * 1. TERM
- * 2. NoTSetzWq
- * 3. TESTPROG
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * DETAILED DESCRIPTION
- *
- * Setup:
- * Setup signal handling.
- * Make and change to a temporary directory.
- * Pause for SIGUSR1 if option specified.
- * Add TESTPROG variable to the environment
- *
- * Test:
- * Loop if the proper options are given.
- * fork()
- * Check return code, if system call failed (return=-1)
- * Log the errno
- * CHILD:
- * open a temp file
- * Determine environment values and write to file
- * close file containing test values.
- * exit.
- * PARENT:
- * Wait for child to exit.
- * Verify exit status
- * Open file containing test values.
- * For each test case:
- * Read the value from the file.
- * Determine and report PASS/FAIL result.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Remove the temporary directory and exit.
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/param.h>
-#include <signal.h> /*Includes signal information. */
-#include <errno.h>
-#include "test.h"
-#include "usctest.h"
-
-char *TCID="fork04"; /* Test program identifier. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-
-
-#define KIDEXIT 42 /* Known value for child exit status */
-#define MAX_LINE_LENGTH 256
-#define OUTPUT_FILE "env.out"
-#define ENV_NOT_SET "getenv() does not find variable set"
-
-/* list of environment variables to test */
-char *environ_list[] = {"TERM","NoTSetzWq","TESTPROG"};
-#define NUMBER_OF_ENVIRON sizeof(environ_list)/sizeof(char *)
-int TST_TOTAL=NUMBER_OF_ENVIRON; /* Total number of test cases. */
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove the temporary directory and exit with
- return code appropriate for results */
- tst_rmdir();
- tst_exit();
-
-} /* End cleanup() */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make and change to a temporary directory */
- tst_tmpdir();
-
- /* add a variable to the environment */
- putenv("TESTPROG=FRKTCS04");
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * child_environment - the child side of the environment tests
- * determine values for the variables and write to a file
- ***************************************************************/
-void child_environment()
-{
-
- int fildes;
- int index;
- char msg[MAX_LINE_LENGTH];
- char *var;
-
- fildes = creat(OUTPUT_FILE,0700);
-
-
- for (index=0;index<NUMBER_OF_ENVIRON;index++) {
- memset(msg, 0, MAX_LINE_LENGTH);
-
- if ( (var=getenv(environ_list[index])) == NULL )
- (void)sprintf(msg,"%s:%s",environ_list[index], ENV_NOT_SET);
- else
- (void)sprintf(msg,"%s:%s",environ_list[index], var);
-
- write(fildes,msg,sizeof(msg)); /* includes extra null chars */
- }
-
- close(fildes);
-
-}
-
-/***********************************************************************
- *
- * Compare parent env string to child's string.
- * Each string is in the format: <env var>:<value>
- *
- ***********************************************************************/
-int
-cmp_env_strings(char *pstring, char *cstring)
-{
- char *penv, *cenv, *pvalue, *cvalue;
-
- /*
- * Break pstring into env and value
- */
- penv=pstring;
- if ( (pvalue=strchr(pstring, ':')) == NULL ) {
- tst_resm(TBROK,
- "internal error - parent's env string not in correct format:'%s'",
- pstring);
- return -1;
- } else {
- *pvalue='\0';
- pvalue++;
- if ( *pvalue == '\0' ) {
- tst_resm(TBROK, "internal error - missing parent's env value");
- return -1;
- }
- }
-
- /*
- * Break cstring into env and value
- */
- cenv=cstring;
- if ( (cvalue=strchr(cstring, ':')) == NULL ) {
- tst_resm(TBROK,
- "internal error - parent's env string not in correct format:'%s'",
- cstring);
- return -1;
- } else {
- *cvalue='\0';
- cvalue++;
- if ( *cvalue == '\0' ) {
- tst_resm(TBROK, "internal error - missing child's env value");
- return -1;
- }
- }
-
- if ( strcmp(penv, cenv) != 0 ) {
- tst_resm(TBROK, "internal error - parent(%s) != child (%s) env",
- penv, cenv);
- return -1;
- }
-
- if ( strcmp(pvalue, cvalue) != 0 ) {
- tst_resm(TFAIL, "Env var %s changed after fork(), parent's %s, child's %s",
- penv, pvalue, cvalue);
- } else {
- tst_resm(TPASS, "Env var %s unchanged after fork(): %s",
- penv, cvalue);
- }
- return 0;
-
-}
-
-/***************************************************************
- * parent_environment - the parent side of the environment tests
- * determine values for the variables
- * read the values determined by the child
- * compare values
- ***************************************************************/
-void parent_environment()
-{
-
- int fildes;
- char tmp_line[MAX_LINE_LENGTH];
- char parent_value[MAX_LINE_LENGTH];
- int index;
- int ret;
- char *var;
-
- if ((fildes = open(OUTPUT_FILE,O_RDWR)) == -1) {
- tst_brkm(TBROK, cleanup,
- "fork() test. Parent open of temporary file failed. errno %d (%s)\n",
- errno, strerror(errno));
- }
- for (index=0;index<NUMBER_OF_ENVIRON;index++)
- {
- if ((ret=read(fildes,tmp_line,MAX_LINE_LENGTH)) == 0) {
- tst_resm(TBROK,"fork() test. parent_environment: failed to read from file with %d (%s)",
- errno,strerror(errno));
- }
- else {
-
- if ( (var=getenv(environ_list[index])) == NULL )
- sprintf(parent_value,"%s:%s", environ_list[index], ENV_NOT_SET);
- else
- sprintf(parent_value,"%s:%s", environ_list[index], var);
-
- cmp_env_strings(parent_value, tmp_line);
-
- }
- }
- close(fildes);
-
-}
-
-/***************************************************************
- * main() - performs tests
- *
- ***************************************************************/
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int kid_status; /* status returned from child */
- int wait_status; /* status of wait system call in parent */
- int fails; /* indicates whether to continue with tests */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count and fail indicator in case we are looping. */
- Tst_count=0;
- fails = 0;
-
- /* make the call to fork */
- TEST(fork());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- /* fork failed */
- if ( STD_FUNCTIONAL_TEST ) {
- tst_brkm(TFAIL, cleanup, "fork() failed with %d (%s)",
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- }
- else if (TEST_RETURN == 0) {
- /* child */
- if ( STD_FUNCTIONAL_TEST ) {
- /* determine environment variables */
- child_environment();
- }
- /* exit with known value */
- exit(KIDEXIT);
- } else {
- /* parent of successful fork */
- /* wait for the child to complete */
- wait_status = wait(&kid_status);
- if ( STD_FUNCTIONAL_TEST ) {
- /* validate the child exit status */
- if (wait_status == TEST_RETURN) {
- if (kid_status != KIDEXIT << 8) {
- tst_brkm(TBROK, cleanup,
- "fork(): Incorrect child status returned on wait(): %d",
- kid_status);
- fails++;
- }
- }
- else {
- tst_brkm(TBROK, cleanup,
- "fork(): wait() for child status failed with %d errno: %d : %s",
- wait_status,errno,strerror(errno));
- fails++;
- }
-
- if (fails == 0 ) {
- /* verification tests */
- parent_environment();
- }
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
diff --git a/winsup/testsuite/winsup.api/ltp/fpathconf01.c b/winsup/testsuite/winsup.api/ltp/fpathconf01.c
deleted file mode 100644
index bc4f2b2ad..000000000
--- a/winsup/testsuite/winsup.api/ltp/fpathconf01.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fpathconf01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fpathconf(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 7
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fpathconf(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fpathconf(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fpathconf(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fpathconf01"; /* Test program identifier. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-#define FILENAME "fpafile01"
-
-int exp_enos[]={0, 0};
-
-int i;
-
-struct pathconf_args
-{
- char *define_tag;
- int value;
- int defined; /* Some of these are undefined on regular files.
- * Cancer does a slightly better job with these already,
- * so this is all I'll do to this test. 11/19/98 roehrich
- */
-} args[] = {
- {"_PC_MAX_CANON", _PC_MAX_CANON, 0},
- {"_PC_MAX_INPUT", _PC_MAX_INPUT, 0},
- {"_PC_VDISABLE", _PC_VDISABLE, 0},
- {"_PC_LINK_MAX", _PC_LINK_MAX, 1},
- {"_PC_NAME_MAX", _PC_NAME_MAX, 1},
- {"_PC_PATH_MAX", _PC_PATH_MAX, 1},
- {"_PC_PIPE_BUF", _PC_PIPE_BUF, 0}
-};
-
-int TST_TOTAL=((sizeof(args)/sizeof(args[0])));
-int fd; /* temp file for fpathconf */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (i=0; i<TST_TOTAL; i++) {
- /*
- * Call fpathconf(2) with one of the valid arguments in the args array
- */
- TEST(fpathconf(fd,args[i].value));
-
- /* check return code -- if the return value is defined */
- if ( (TEST_RETURN == -1) && args[i].defined ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fpathconf(fd, %s) Failed, errno=%d : %s", args[i].define_tag,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fpathconf(fd, %s) returned %d", args[i].define_tag, TEST_RETURN);
- }
- }
- } /* End for i */
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- tst_tmpdir();
-
- if ( (fd=open(FILENAME, O_RDWR|O_CREAT, 0700)) == -1 )
- tst_brkm(TBROK, cleanup, "Unable to open temp file %s!", FILENAME);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- close(fd);
-
- /* exit with return code appropriate for results */
- tst_rmdir();
- tst_exit();
-
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fstat01.c b/winsup/testsuite/winsup.api/ltp/fstat01.c
deleted file mode 100644
index 9cb7959e4..000000000
--- a/winsup/testsuite/winsup.api/ltp/fstat01.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fstat01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fstat(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fstat(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fstat(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fstat(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fstat01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-struct stat statter;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call fstat(2)
- */
- TEST(fstat(fd, &statter));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fstat(%s, &statter) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fstat(%s, &statter) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/fsync01.c b/winsup/testsuite/winsup.api/ltp/fsync01.c
deleted file mode 100644
index 57ddd5f98..000000000
--- a/winsup/testsuite/winsup.api/ltp/fsync01.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : fsync01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for fsync(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) fsync(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the fsync(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * fsync(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/statfs.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="fsync01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-char *buf = "davef";
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /* write sone data to get fsync'd out */
- if (write(fd, &buf, strlen(buf)) == -1) {
- tst_brkm(TBROK, cleanup,
- "write(%s, &buf, strlen(buf)) Failed, errno=%d : %s",
- fname, TEST_ERRNO, strerror(TEST_ERRNO));
- }
- /*
- * Call fsync(2)
- */
- TEST(fsync(fd));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "fsync(%s) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "fsync(%s) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we have open */
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/getegid01.c b/winsup/testsuite/winsup.api/ltp/getegid01.c
deleted file mode 100644
index d2c8a5240..000000000
--- a/winsup/testsuite/winsup.api/ltp/getegid01.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getegid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getegid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getegid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getegid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getegid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getegid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0}; /* must be a 0 terminated list */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- ;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Get effective group id.
- */
- ;
-
- /* Call getegid(2) */
- TEST(getegid( ));
-
- /* check return code */
- if ( TEST_RETURN < 0 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getegid - Get effective group id. failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- continue; /* next loop for MTKERNEL */
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getegid - Get effective group id. returned %d", TEST_RETURN);
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/geteuid01.c b/winsup/testsuite/winsup.api/ltp/geteuid01.c
deleted file mode 100644
index b4840f52c..000000000
--- a/winsup/testsuite/winsup.api/ltp/geteuid01.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : geteuid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for geteuid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) geteuid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the geteuid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * geteuid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="geteuid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0}; /* must be a 0 terminated list */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- ;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Get effective user id.
- */
- ;
-
- /* Call geteuid(2) */
- TEST(geteuid( ));
-
- /* check return code */
- if ( TEST_RETURN < 0 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "geteuid - Get effective user id. failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- continue; /* next loop for MTKERNEL */
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "geteuid - Get effective user id. returned %d", TEST_RETURN);
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/getgid01.c b/winsup/testsuite/winsup.api/ltp/getgid01.c
deleted file mode 100644
index fcde734a0..000000000
--- a/winsup/testsuite/winsup.api/ltp/getgid01.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getgid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getgid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getgid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getgid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getgid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getgid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call getgid(2)
- */
- TEST(getgid());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getgid() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getgid() returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/getgroups01.c b/winsup/testsuite/winsup.api/ltp/getgroups01.c
deleted file mode 100644
index 6b935f293..000000000
--- a/winsup/testsuite/winsup.api/ltp/getgroups01.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/***********************************************************************
-TEST IDENTIFIER: getgroups01 : Getgroups system call critical test
-
-PARENT DOCUMENT: ggrtds01: Getgroups system call test design spec
-
-AUTHOR: Barrie Kletscher
- Rewrote : 11-92 by Richard Logan
-
-CO-PILOT: Dave Baumgartner
-
-TEST ITEMS:
- 1. Check to see if getgroups(-1, gidset) fails and sets errno to EINVAL
- 2. Check to see if getgroups(0, gidset) does not return -1 and gidset is
- not modified.
- 3. Check to see if getgroups(x, gigset) fails and sets errno to EINVAL,
- where x is one less then what is returned by getgroups(0, gidset).
- 4. Check to see if getgroups() succeeds and gidset contains
- group id returned from getgid().
-
-INPUT SPECIFICATIONS:
- NONE
-
-OUTPUT SPECIFICATIONS:
- Standard tst_res output format
-
-ENVIRONMENTAL NEEDS:
- NONE.
-
-SPECIAL PROCEDURAL REQUIREMENTS:
- None
-
-INTERCASE DEPENDENCIES:
- Test case #3 depends on test case #2.
-
-DETAILED DESCRIPTION:
- Set up the signal handling capabilities.
- execute tests
- exit
-
-BUGS:
- None known.
-
-************************************************************/
-
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/param.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-char *TCID="getgroups01"; /* Test program identifier. */
-int TST_TOTAL=4; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-/***********************************************************************
- * MAIN
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *ptr; /* message returned from parse_opts */
-
- int i, /* counter */
- group, /* return value from Getgid() call */
- entries; /* number of group entries */
-
- gid_t gidset[NGROUPS]; /* storage for all group ids */
- gid_t cmpset[NGROUPS];
- int ret;
- int ret2;
- int errors = 0;
- char msg[500];
-
- /***************************************************************
- * parse standard options, and exit if there is an error
- ***************************************************************/
- if ( (ptr=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", ptr);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * Check to see if getgroups() fails on erraneous condition.
- */
- TEST( getgroups(-1,gidset) );
-
- if((ret=TEST_RETURN) != -1) {
- sprintf(msg,
- "getgroups(-1,gidset) returned %d, expected -1 and errno = EINVAL",
- ret);
- tst_resm(TFAIL,msg);
- errors++;
- }
- else if ( STD_FUNCTIONAL_TEST ) {
- if(errno != EINVAL) {
- sprintf(msg,
- "getgroups(-1,gidset) returned %d, errno = %d, expected errno %d (EINVAL)",
- ret, errno, EINVAL);
- tst_resm(TFAIL,msg);
- errors++;
- }
- else {
- sprintf(msg,
- "getgroups(-1,gidset) returned %d and error = %d (EINVAL) as expected",
- ret, errno);
- tst_resm(TPASS, msg);
- }
- }
-
- /*
- * Check that if ngrps is zero that the number of groups is return and
- * the the gidset array is not modified.
- * This is a POSIX special case.
- */
-
- memset(gidset, 052, NGROUPS);
- memset(cmpset, 052, NGROUPS);
-
- TEST( getgroups(0,gidset) );
- if((ret=TEST_RETURN) < 0) {
- sprintf(msg,
- "getgroups(0,gidset) returned %d with errno = %d, expected num gids with no change to gidset",
- ret, errno);
- tst_resm(TFAIL,msg);
- errors++;
- }
- else if ( STD_FUNCTIONAL_TEST ) {
- /*
- * check that gidset was unchanged
- */
- if ( memcmp(cmpset, gidset, NGROUPS) != 0 ) {
- sprintf(msg,
- "getgroups(0,gidset) returned %d, the gidset array was modified",
- ret);
- tst_resm(TFAIL,msg);
- errors++;
- }
- else {
- sprintf(msg,
- "getgroups(0,gidset) returned %d, the gidset array not was modified",
- ret);
- tst_resm(TPASS, msg);
- }
- }
-
- /*
- * Check to see that is -1 is returned and errno is set to EINVAL when
- * ngroups is not big enough to hold all groups.
- */
-
- if ( ret <= 1 ) {
- sprintf(msg, "getgroups(0,gidset) returned %d, Unable to test that\nusing ngrps >=1 but less than number of grps", ret);
- tst_resm(TCONF, msg);
- errors++;
- }
- else {
- TEST( getgroups(ret-1, gidset) );
- if ((ret2 = TEST_RETURN) == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
- if ( errno != EINVAL ) {
- sprintf(msg,
- "getgroups(%d, gidset) returned -1, but not errno %d (EINVAL) but %d",
- ret-1, EINVAL, errno);
- tst_resm(TFAIL, msg);
- errors++;
- }
- else {
- sprintf(msg,
- "getgroups(%d, gidset) returned -1, and errno %d (EINVAL) when %d grps",
- ret-1, errno, ret);
- tst_resm(TPASS, msg);
- }
- }
- }
- else {
- sprintf(msg,
- "getgroups(%d, gidset) returned %d, expected -1 and errno EINVAL.",
- ret-1, ret2);
- tst_resm(TFAIL, msg);
- errors++;
- }
- }
-
- /*
- * Check to see if getgroups() succeeds and contains getgid's gid.
- */
-
- TEST( getgroups(NGROUPS,gidset) );
- if((entries = TEST_RETURN) == -1) {
- sprintf(msg, "getgroups(NGROUPS,gidset) returned -1 and errno = %d", errno);
- tst_resm(TFAIL, msg);
- errors++;
- }
- else if ( STD_FUNCTIONAL_TEST ) {
-
- /*
- * Check to see if getgroups() contains getgid().
- */
-
- group = getgid();
-
- for(i = 0; i < entries; i++)
- {
- if(gidset[i] == group)
- {
- sprintf(msg,
- "getgroups(NGROUPS,gidset) ret %d contains gid %d (from getgid)",
- entries, group);
- tst_resm(TPASS, msg);
- break;
- }
- }
-
- if( i == entries ) {
- sprintf(msg,
- "getgroups(NGROUPS,gidset) ret %d, does not contain gid %d (from getgid)",
- entries, group);
- tst_resm(TFAIL,msg);
- errors++;
- }
- }
-
- }
- cleanup();
-
- return 0;
-} /* end main() */
-
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
diff --git a/winsup/testsuite/winsup.api/ltp/getgroups02.c b/winsup/testsuite/winsup.api/ltp/getgroups02.c
deleted file mode 100644
index b517c7617..000000000
--- a/winsup/testsuite/winsup.api/ltp/getgroups02.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getgroups02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getgroups(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getgroups(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getgroups(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getgroups(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getgroups02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-/* define array size for gids */
-#define GID_ARRAY_SIZE 100
-
-gid_t gidset[GID_ARRAY_SIZE]; /* array of gids */
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call getgroups(2)
- */
- TEST(getgroups(GID_ARRAY_SIZE, gidset));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getgroups() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getgroups() returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/gethostid01.c b/winsup/testsuite/winsup.api/ltp/gethostid01.c
deleted file mode 100644
index 2d4a18755..000000000
--- a/winsup/testsuite/winsup.api/ltp/gethostid01.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : gethostid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for gethostid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) gethostid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the gethostid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * gethostid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="gethostid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0}; /* must be a 0 terminated list */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- ;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Get host name
- */
- ;
-
- /* Call gethostid(2) */
- TEST(gethostid( ));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "gethostid - Get host name failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- continue; /* next loop for MTKERNEL */
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "gethostid - Get host name returned %d", TEST_RETURN);
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/gethostname01.c b/winsup/testsuite/winsup.api/ltp/gethostname01.c
deleted file mode 100644
index 2f94db725..000000000
--- a/winsup/testsuite/winsup.api/ltp/gethostname01.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : gethostname01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for gethostname(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) gethostname(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the gethostname(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * gethostname(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="gethostname01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0}; /* must be a 0 terminated list */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- char hname[100]; /* host name */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Get host name
- */
- ;
-
- /* Call gethostname(2) */
- TEST(gethostname(hname, sizeof(hname) ));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "gethostname - Get host name failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- continue; /* next loop for MTKERNEL */
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "gethostname - Get host name returned %d", TEST_RETURN);
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/getpgrp01.c b/winsup/testsuite/winsup.api/ltp/getpgrp01.c
deleted file mode 100644
index bd3a89117..000000000
--- a/winsup/testsuite/winsup.api/ltp/getpgrp01.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getpgrp01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getpgrp(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getpgrp(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getpgrp(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getpgrp(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getpgrp01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call getpgrp(2)
- */
- TEST(getpgrp());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getpgrp() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getpgrp() returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/getpid01.c b/winsup/testsuite/winsup.api/ltp/getpid01.c
deleted file mode 100644
index 58d6b0579..000000000
--- a/winsup/testsuite/winsup.api/ltp/getpid01.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getpid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getpid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getpid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getpid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getpid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getpid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call getpid(2)
- */
- TEST(getpid());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getpid() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getpid() returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/getppid01.c b/winsup/testsuite/winsup.api/ltp/getppid01.c
deleted file mode 100644
index 9eab5dfc2..000000000
--- a/winsup/testsuite/winsup.api/ltp/getppid01.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getppid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getppid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getppid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getppid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getppid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getppid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call getppid(2)
- */
- TEST(getppid());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getppid() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getppid() returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/getuid01.c b/winsup/testsuite/winsup.api/ltp/getuid01.c
deleted file mode 100644
index 58920ed34..000000000
--- a/winsup/testsuite/winsup.api/ltp/getuid01.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : getuid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for getuid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) getuid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the getuid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * getuid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="getuid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call getuid(2)
- */
- TEST(getuid());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "getuid() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "getuid() returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/kill09.c b/winsup/testsuite/winsup.api/ltp/kill09.c
deleted file mode 100644
index 9d6b0a181..000000000
--- a/winsup/testsuite/winsup.api/ltp/kill09.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : kill09
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for kill(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) kill(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the kill(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * kill(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-void alarm_handler(int sig);
-
-
-
-
-char *TCID="kill09"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int fork_pid;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- int status;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /* make a child process so we can kill it */
- /* If we cannot fork => we cannot test kill, so break and exit */
- if ((fork_pid=fork()) == -1) {
- tst_brkm(TBROK, cleanup,
- "fork() Failure. errno=%d : %s",
- errno, strerror(errno));
- }
-
- if (fork_pid == 0) {
- /* CHILD */
- /*
- * Setup alarm signal if we don't get the signal to prevent this process
- * from hanging around forever.
- */
- signal(SIGALRM, alarm_handler);
- alarm(20);
- pause();
- exit(1);
- }
-
- /* PARENT */
- /*
- * Call kill(2)
- */
- TEST(kill(fork_pid, SIGKILL));
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "kill(%d, SIGKILL) Failed, errno=%d : %s", fork_pid,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "kill(%d, SIGKILL) returned %d", fork_pid, TEST_RETURN);
- }
- }
-
- /*
- * wait for process to cleanup zombies.
- *
- */
- waitpid(0, &status, WNOHANG);
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- (void) signal(SIGCHLD, SIG_IGN);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-void
-alarm_handler(int sig)
-{
- exit(8);
-}
diff --git a/winsup/testsuite/winsup.api/ltp/link02.c b/winsup/testsuite/winsup.api/ltp/link02.c
deleted file mode 100644
index 61294f16f..000000000
--- a/winsup/testsuite/winsup.api/ltp/link02.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : link02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for link(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) link(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the link(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * link(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="link02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char Fname[255], Lname[255];
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- struct stat fbuf, lbuf;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call link(2)
- */
- TEST(link(Fname, Lname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "link(%s, %s) Failed, errno=%d : %s",
- Fname, Lname, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- stat(Fname, &fbuf);
- stat(Lname, &lbuf);
- if ( fbuf.st_nlink > 1 && lbuf.st_nlink > 1 &&
- fbuf.st_nlink == lbuf.st_nlink )
-
- tst_resm(TPASS, "link(%s, %s) returned %d and link cnts match",
- Fname, Lname, TEST_RETURN);
- else {
- tst_resm(TFAIL,
- "link(%s, %s) returned %d, stat link cnts do not match %d %d",
- Fname, Lname, TEST_RETURN, fbuf.st_nlink,
- lbuf.st_nlink);
- }
- }
- if (unlink(Lname) == -1) {
- tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int fd;
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- strcpy(Fname, "tfile");
- if ((fd = open(Fname, O_RDWR|O_CREAT, 0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT, 0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- strcpy(Lname, "lfile");
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/link03.c b/winsup/testsuite/winsup.api/ltp/link03.c
deleted file mode 100644
index 7b4395853..000000000
--- a/winsup/testsuite/winsup.api/ltp/link03.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : link03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : multi links tests
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 03/31/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) link(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- * -N #links : Use #links links every iteration
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the link(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * link(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void help();
-void cleanup();
-
-
-
-char *TCID="link03"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-extern int Tst_nobuf;
-
-int exp_enos[]={0, 0};
-
-#define BASENAME "lkfile"
-
-char Basename[255];
-char Fname[255];
-int Nlinks=0;
-char *Nlinkarg;
-
-int Nflag=0;
-
-
-/* for test specific parse_opts options */
-option_t options[] = {
- { "N:", &Nflag, &Nlinkarg }, /* -N #links */
- { NULL, NULL, NULL }
-};
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- struct stat fbuf, lbuf;
- int cnt;
- int nlinks;
- char lname[255];
-
- Tst_nobuf=1;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- if ( Nflag ) {
- if (sscanf(Nlinkarg, "%i", &Nlinks) != 1 ) {
- tst_brkm(TBROK, NULL, "--N option arg is not a number");
- tst_exit();
- }
- if ( Nlinks > 1000 ) {
- tst_resm(TWARN, "--N option arg > 1000 - may get errno:%d (EMLINK)",
- EMLINK);
- }
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- if ( Nlinks )
- nlinks = Nlinks;
- else
- /* min of 10 links and max of a 100 links */
- nlinks = (lc%90)+10;
-
- for(cnt=1; cnt < nlinks; cnt++) {
-
- sprintf(lname, "%s%d", Basename, cnt);
- /*
- * Call link(2)
- */
- TEST(link(Fname, lname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_brkm(TFAIL, cleanup, "link(%s, %s) Failed, errno=%d : %s",
- Fname, lname, TEST_ERRNO, strerror(TEST_ERRNO));
- }
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- stat(Fname, &fbuf);
-
- for(cnt=1; cnt < nlinks; cnt++) {
- sprintf(lname, "%s%d", Basename, cnt);
-
- stat(lname, &lbuf);
- if ( fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 ||
- (fbuf.st_nlink != lbuf.st_nlink) ) {
-
- tst_resm(TFAIL,
- "link(%s, %s[1-%d]) ret %d for %d files, stat values do not match %d %d",
- Fname, Basename, nlinks, TEST_RETURN, nlinks,
- fbuf.st_nlink, lbuf.st_nlink);
- break;
- }
- }
- if ( cnt >= nlinks ) {
- tst_resm(TPASS,
- "link(%s, %s[1-%d]) ret %d for %d files, stat linkcounts match %d",
- Fname, Basename, nlinks, TEST_RETURN, nlinks,
- fbuf.st_nlink);
- }
- }
- else
- Tst_count++;
-
- for(cnt=1; cnt < nlinks; cnt++) {
-
- sprintf(lname, "%s%d", Basename, cnt);
-
- if (unlink(lname) == -1) {
- tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * help
- ***************************************************************/
-void
-help()
-{
- printf(" -N #links : create #links hard links every iteration\n");
-}
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int fd;
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname,"%s_%d", BASENAME, getpid());
- if ((fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_res(TWARN, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- sprintf(Basename, "%s_%d.", BASENAME, getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/link04.c b/winsup/testsuite/winsup.api/ltp/link04.c
deleted file mode 100644
index 7f2390139..000000000
--- a/winsup/testsuite/winsup.api/ltp/link04.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : link04
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test cases for link(2).
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 14
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 03/30/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1-14.) link(2) returns...(See Test_cases structure below)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- * Standard tst_res output formt.
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the link(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * link(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/param.h> /* for PATH_MAX */
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-extern char *get_high_address();
-
-char *TCID="link04"; /* Test program identifier. */
-int TST_TOTAL=14; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int longpath_setup();
-int no_setup();
-int filepath_setup();
-int filepath2_setup();
-char Longpathname[PATH_MAX+2];
-char High_address[64];
-int dir_setup();
-
-struct test_case_t {
- char *file1;
- char *desc1;
- char *file2;
- char *desc2;
- int exp_errno;
- int (*setupfunc1)();
- int (*setupfunc2)();
-} Test_cases[] = {
- /* This test program should contain test cases where link */
- /* will fail regardless of who executed it (i.e. joe-user or root) */
-
- /* first path is invalid */
-
- { "nonexistfile", "non-existent file", "nefile", "nefile",
- ENOENT, no_setup, no_setup},
-
- { "", "path is empty string", "nefile", "nefile",
- ENOENT, no_setup, no_setup},
-
- { "neefile/file", "path contains a non-existent file", "nefile", "nefile",
- ENOENT, no_setup, no_setup },
-
-#ifndef __CYGWIN__
- { "regfile/file", "path contains a regular file", "nefile", "nefile",
- ENOTDIR, filepath_setup, no_setup },
-#endif
-
- { Longpathname, "pathname too long", "nefile", "nefile",
- ENAMETOOLONG, longpath_setup, no_setup },
-
- { High_address, "address beyond address space", "nefile", "nefile",
- EFAULT, no_setup, no_setup },
-
- { (char *)-1, "negative address", "nefile", "nefile",
- EFAULT, no_setup, no_setup },
-
- /* second path is invalid */
-
- { "regfile", "regfile", "", "empty string",
- ENOENT, no_setup, no_setup},
-
- { "regfile", "regfile", "neefile/file", "path contains a non-existent file",
- ENOENT, filepath_setup, no_setup},
-
- { "regfile", "regfile", "file/file", "path contains a regular file",
- ENOENT, filepath_setup, no_setup},
-
- { "regfile", "regfile", Longpathname, "pathname too long",
- ENAMETOOLONG, no_setup, longpath_setup },
-
- { "regfile", "regfile", High_address, "address beyond address space",
- EFAULT, no_setup, no_setup },
-
- { "regfile", "regfile", (char *)-1, "negative address",
- EFAULT, no_setup, no_setup},
-
- /* two existing files */
-
- { "regfile", "regfile", "regfile2", "regfile2",
- EEXIST, filepath_setup, filepath2_setup },
-
- { NULL, NULL, NULL, NULL, 0, no_setup, no_setup }
-};
-
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- char *fname1, *fname2;
- char *desc1, *desc2;
- int ind;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) {
-
- fname1 = Test_cases[ind].file1;
- desc1 = Test_cases[ind].desc1;
- fname2 = Test_cases[ind].file2;
- desc2 = Test_cases[ind].desc2;
-
- if ( fname1 == High_address )
- fname1 = get_high_address();
-
- if ( fname2 == High_address )
- fname2 = get_high_address();
-
- /*
- * Call link(2)
- */
- TEST(link(fname1, fname2));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_ERRNO == Test_cases[ind].exp_errno )
- tst_resm(TPASS, "link(<%s>, <%s>) Failed, errno=%d",
- desc1, desc2, TEST_ERRNO);
- else
- tst_resm(TFAIL,
- "link(<%s>, <%s>) Failed, errno=%d, expected errno:%d",
- desc1, desc2, TEST_ERRNO, Test_cases[ind].exp_errno);
- }
- else
- Tst_count++;
- } else {
- tst_resm(TFAIL,
- "link(<%s>, <%s>) returned %d, expected -1, errno:%d",
- desc1, desc2, TEST_RETURN, Test_cases[ind].exp_errno);
- }
- }
-
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int ind;
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) {
- Test_cases[ind].setupfunc1();
- Test_cases[ind].setupfunc2();
- }
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-/******************************************************************
- *
- ******************************************************************/
-int
-no_setup()
-{
- return 0;
-}
-
-/******************************************************************
- *
- ******************************************************************/
-int
-longpath_setup()
-{
- int ind;
-
- static int alreadycalled = 0;
-
- if ( alreadycalled )
- return 0;
- alreadycalled++;
-
- for(ind=0; ind<= PATH_MAX+1; ind++) {
- Longpathname[ind] = 'a';
- }
- return 0;
-
-}
-
-/******************************************************************
- *
- ******************************************************************/
-int
-filepath2_setup()
-{
- int fd;
- static int alreadycalled = 0;
-
- if ( alreadycalled )
- return 0;
- alreadycalled++;
-
- if ( (fd=creat("regfile2", 0777)) == -1 ) {
- tst_brkm(TBROK, cleanup, "creat(regfile2, 0777) failed, errno:%d %s",
- errno, strerror(errno));
- }
- close(fd);
- return 0;
-}
-/******************************************************************
- *
- ******************************************************************/
-int
-filepath_setup()
-{
- int fd;
- static int alreadycalled = 0;
-
- if ( alreadycalled )
- return 0;
- alreadycalled++;
-
- if ( (fd=creat("regfile", 0777)) == -1 ) {
- tst_brkm(TBROK, cleanup, "creat(regfile, 0777) failed, errno:%d %s",
- errno, strerror(errno));
- }
- close(fd);
- return 0;
-}
-
-/******************************************************************
- *
- ******************************************************************/
-int
-dir_setup()
-{
- static int alreadycalled = 0;
-
- if ( alreadycalled )
- return 0;
- alreadycalled++;
-
- if ( mkdir("dir", 0777) == -1 ) {
- tst_brkm(TBROK, cleanup,
- "mkdir(dir, 0700) Failed, errno=%d : %s",
- errno, strerror(errno));
- }
-
- return 0;
-}
diff --git a/winsup/testsuite/winsup.api/ltp/link05.c b/winsup/testsuite/winsup.api/ltp/link05.c
deleted file mode 100644
index 5078a6a3f..000000000
--- a/winsup/testsuite/winsup.api/ltp/link05.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : link05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : multi links (EMLINK) negative test
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 3
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 03/31/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) link(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the link(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * link(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-void help();
-
-
-
-char *TCID="link05"; /* Test program identifier. */
-#ifdef CRAY
-int TST_TOTAL=2; /* Total number of test cases. */
-#else
-int TST_TOTAL=1; /* Total number of test cases. */
-#endif
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-#define BASENAME "lkfile"
-
-char Basename[255];
-char Fname[255];
-
-int Nflag=0;
-char *Noptlinks;
-
-/* for test specific parse_opts options */
-option_t options[] = {
- { "N:", &Nflag, &Noptlinks }, /* -N option */
- { NULL, NULL, NULL }
-};
-
-int nlinks = 1000;
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- struct stat fbuf, lbuf;
- int cnt;
- char lname[255];
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, options, &help)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- if ( Nflag ) {
- if ( sscanf(Noptlinks, "%i", &nlinks) != 1 ) {
- tst_brkm(TBROK, cleanup, "-N option invalid, must be numeric");
- }
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for(cnt=1; cnt < nlinks; cnt++) {
-
- sprintf(lname, "%s%d", Basename, cnt);
- /*
- * Call link(2)
- */
- TEST(link(Fname, lname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- tst_resm(TFAIL, "link(%s, %s) Failed, errno=%d : %s",
- Fname, lname, TEST_ERRNO, strerror(TEST_ERRNO));
- }
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- stat(Fname, &fbuf);
-
- for(cnt=1; cnt < nlinks; cnt++) {
- sprintf(lname, "%s%d", Basename, cnt);
-
- stat(lname, &lbuf);
- if ( fbuf.st_nlink <= 1 || lbuf.st_nlink <= 1 ||
- (fbuf.st_nlink != lbuf.st_nlink) ) {
-
- tst_resm(TFAIL,
- "link(%s, %s[1-%d]) ret %d for %d files, stat values do not match %d %d",
- Fname, Basename, nlinks, TEST_RETURN, nlinks,
- fbuf.st_nlink, lbuf.st_nlink);
- break;
- }
- }
- if ( cnt >= nlinks ) {
- tst_resm(TPASS,
- "link(%s, %s[1-%d]) ret %d for %d files, stat linkcounts match %d",
- Fname, Basename, nlinks, TEST_RETURN, nlinks,
- fbuf.st_nlink);
- }
- }
- else
- Tst_count++;
-
-#ifdef CRAY
-/*
- * IRIX (xfs) systems do not have the 1000 link limit.
- * I tried 100000 links on 2/97 without error on IRIX 6.4.
- */
- /*
- * Now check that one more link will put you over the top
- */
- sprintf(lname, "%s%d", Basename, cnt);
-
- /*
- * Call link(2)
- */
- TEST(link(Fname, lname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_ERRNO == EMLINK ) {
- tst_resm(TPASS,
- "link(%s, %s) ret %d on %d link, errno:%d",
- Fname, lname, TEST_RETURN, nlinks+1, EMLINK);
- }
- else {
- tst_resm(TFAIL,
- "link(%s, %s) ret %d on %d link, errno:%d, expected -1, errno:%d",
- Fname, lname, TEST_RETURN, nlinks+1,
- TEST_ERRNO, EMLINK);
- }
- }
- else
- Tst_count++;
- }
- else {
- tst_resm(TFAIL, "link(%s, %s) ret %d on %d link, expected -1, errno:%d",
- Fname, lname, TEST_RETURN, nlinks+1, EMLINK);
- }
-#endif /* CRAY */
-
- for(cnt=1; cnt < nlinks; cnt++) {
-
- sprintf(lname, "%s%d", Basename, cnt);
-
- if (unlink(lname) == -1) {
- tst_res(TWARN, "unlink(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * help
- ***************************************************************/
-void
-help()
-{
- printf(" -N #links : create #links hard links every iteration\n");
-}
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int fd;
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname,"%s_%d", BASENAME, getpid());
- if ((fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_res(TWARN, "close(%s) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
- sprintf(Basename, "%s_%d.", BASENAME, getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/lseek01.c b/winsup/testsuite/winsup.api/ltp/lseek01.c
deleted file mode 100644
index 32756fedd..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek01.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : lseek01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for lseek(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 3
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) lseek(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the lseek(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * lseek(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="lseek01"; /* Test program identifier. */
-int TST_TOTAL=3; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char Fname[255];
-int Fd;
-
-int Whence[] = {SEEK_SET, SEEK_CUR, SEEK_END, -1};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- int ind;
- int offset;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- offset=(lc%100)*4096; /* max size is 100 blocks */
-
- for (ind=0; Whence[ind] >= 0; ind++) {
-
- /*
- * Call lseek(2)
- */
- TEST(lseek(Fd, (long)offset, Whence[ind]));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "lseek(%s, %ld, 0) Failed, errno=%d : %s",
- Fname, offset, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "lseek(%s, %ld, %d) returned %d", Fname,
- offset, Whence[ind], TEST_RETURN);
- }
- else
- Tst_count++;
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname, "tfile_%d",getpid());
- if ((Fd = open(Fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we have open */
- if (close(Fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", Fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/lseek02.c b/winsup/testsuite/winsup.api/ltp/lseek02.c
deleted file mode 100644
index 9ad906b5b..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek02.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : lseek02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test for lseek(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 04/25/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) lseek(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the lseek(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * lseek(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="lseek02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int Whence[] = {SEEK_SET, SEEK_CUR, SEEK_END, -1};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call lseek(2)
- */
- TEST( lseek(-1, (long)1, SEEK_SET) );
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
-
- if ( TEST_ERRNO == EBADF )
-
- tst_resm(TPASS,
- "lseek(-1, 1, SEEK_SET) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- else
- tst_resm(TFAIL,
- "lseek(-1, 1, SEEK_SET) Failed, errno=%d : %s, expected %d(EBADF)",
- TEST_ERRNO, strerror(TEST_ERRNO), EBADF);
-
- }
- else
- Tst_count++;
-
- } else {
-
- tst_resm(TFAIL, "lseek(-1, 1, SEEK_SET) returned %d",
- TEST_RETURN);
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/lseek04.c b/winsup/testsuite/winsup.api/ltp/lseek04.c
deleted file mode 100644
index d1c3c36a1..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek04.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : lseek04
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test for lseek(2) of a fifo
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 04/25/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) lseek(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the lseek(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * lseek(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="lseek04"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char Fname[255];
-int Fd;
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call lseek(2)
- */
- TEST(lseek(Fd, (long)1, SEEK_SET));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
-
- if ( TEST_ERRNO == ESPIPE )
- tst_resm(TPASS,
- "lseek(fifofd, 1, SEEK_SET) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- else
- tst_resm(TFAIL,
- "lseek(fifofd, 1, SEEK_SET) Failed, errno=%d %s, expected %d(ESPIPE)",
- TEST_ERRNO, strerror(TEST_ERRNO),
- EINVAL);
- }
- else
- Tst_count++;
- } else {
-
- tst_resm(TFAIL, "lseek(fifofd, 1, SEEK_SET) returned %d",
- TEST_RETURN);
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname,"tfile_%d",getpid());
- if ( mkfifo(Fname,0700) == -1) {
- tst_brkm(TBROK, cleanup,
- "mkfifo(%s, 0700) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-
- if ( (Fd=open(Fname, O_RDWR, 0777)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR, 0777) Failed, errno=%d : %s",
- Fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we have open */
- if (close(Fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", Fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/lseek05.c b/winsup/testsuite/winsup.api/ltp/lseek05.c
deleted file mode 100644
index 0d51643f0..000000000
--- a/winsup/testsuite/winsup.api/ltp/lseek05.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : lseek05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Negative test for lseek(2) of a pipe
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 04/25/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) lseek(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the lseek(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * lseek(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="lseek05"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int Fd;
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call lseek(2)
- */
- TEST(lseek(Fd, (long)1, SEEK_SET));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
-
- if ( TEST_ERRNO == ESPIPE )
- tst_resm(TPASS,
- "lseek(pipefd, 1, SEEK_SET) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- else
- tst_resm(TFAIL,
- "lseek(pipefd, 1, SEEK_SET) Failed, errno=%d %s, expected %d(ESPIPE)",
- TEST_ERRNO, strerror(TEST_ERRNO),
- EINVAL);
- }
- else
- Tst_count++;
- } else {
-
- tst_resm(TFAIL, "lseek(pipefd, 1, SEEK_SET) returned %d",
- TEST_RETURN);
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int fds[2];
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- if ( pipe(fds) == -1) {
- tst_brkm(TBROK, cleanup,
- "pipe(&fds) Failed, errno=%d : %s", errno, strerror(errno));
- }
- Fd = fds[0];
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we have open */
- if (close(Fd) == -1) {
- tst_resm(TWARN, "close(%d) Failed, errno=%d : %s", Fd, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/lstat02.c b/winsup/testsuite/winsup.api/ltp/lstat02.c
deleted file mode 100644
index f6b97d78a..000000000
--- a/winsup/testsuite/winsup.api/ltp/lstat02.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : lstat02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for lstat(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) lstat(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the lstat(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * lstat(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="lstat02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255], lname[255], symlnk[255], buf[255];
-int fd;
-struct stat statter;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call lstat(2)
- */
- TEST(lstat(symlnk, &statter));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "lstat(%s, &statter) Failed, errno=%d : %s", symlnk,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "lstat(%s, &statter) returned %d", symlnk, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- } else if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- sprintf(symlnk,"lnfile_%d",getpid());
- if (symlink(fname, symlnk) == -1) {
- tst_resm(TWARN, "symlink(%s, %s) Failed, errno=%d : %s",
- fname, symlnk, errno, strerror(errno));
- } else if (readlink(symlnk, buf, 255) == -1) {
- tst_resm(TWARN, "readlink(%s, buf, 255) Failed, errno=%d : %s",
- symlnk, errno, strerror(errno));
- } else if (strcmp(buf, fname) != 0) {
- tst_resm(TWARN,
- "Setup Failure : Expected symbolic link contents of %s : Actual is %s",
- fname, buf);
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/mkdir01.c b/winsup/testsuite/winsup.api/ltp/mkdir01.c
deleted file mode 100644
index 80f9bb6cc..000000000
--- a/winsup/testsuite/winsup.api/ltp/mkdir01.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : mkdir01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic errno test for mkdir(2)
- *
- * PARENT DOCUMENT : mkstds02
- *
- * TEST CASE TOTAL : 2
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Bill Branum
- *
- * CO-PILOT : Kathy Olmsted
- *
- * DATE STARTED : 4/15/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * mkdir(2) test for errno(s) EFAULT.
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * DETAILED DESCRIPTION
- * This test will verify that mkdir(2) returns a value of
- * -1 and sets errno to EFAULT when the path argument points
- * outside (above/below) the allocated address space of the
- * process.
- *
- * Setup:
- * Setup signal handling.
- * Create and make current a temporary directory.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno.
- * If doing functional test
- * check the errno returned and print result message
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- * Remove the temporary directory.
- * Exit.
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-char *get_high_address();
-
-char *TCID="mkdir01"; /* Test program identifier. */
-int TST_TOTAL=2; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={EFAULT, 0}; /* List must end with 0 */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * TEST CASE: 1
- * mkdir() call with pointer below allocated address space.
- */
-
- /* Call mkdir(2) */
- TEST(mkdir((char *)-1,0777));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS, "mkdir - path argument pointing below allocated address space failed as expected with errno %d : %s", TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL, "mkdir - path argument pointing below allocated address space failed with errno %d : %s but expected %d (EFAULT)", TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL, "mkdir - path argument pointing below allocated address space succeeded unexpectedly.");
-
- }
- }
-
-
- /*
- * TEST CASE: 2
- * mkdir() call with pointer above allocated address space.
- */
-
- /* Call mkdir(2) */
- TEST(mkdir(get_high_address(),0777));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_RETURN == -1 ) {
- if (TEST_ERRNO == EFAULT) {
- tst_resm(TPASS, "mkdir - path argument pointing above allocated address space failed as expected with errno %d : %s", TEST_ERRNO, strerror(TEST_ERRNO));
- }
- else {
- tst_resm(TFAIL, "mkdir - path argument pointing above allocated address space failed with errno %d : %s but expected %d (EFAULT)", TEST_ERRNO, strerror(TEST_ERRNO),EFAULT);
- }
- }
- else {
- tst_resm(TFAIL, "mkdir - path argument pointing above allocated address space succeeded unexpectedly.");
-
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Create a temporary directory and make it current. */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /*
- * Remove the temporary directory.
- */
- tst_rmdir();
-
- /*
- * Exit with return code appropriate for results.
- */
- tst_exit();
-
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/mkdir08.c b/winsup/testsuite/winsup.api/ltp/mkdir08.c
deleted file mode 100644
index 8378aba34..000000000
--- a/winsup/testsuite/winsup.api/ltp/mkdir08.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : mkdir08
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for mkdir(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) mkdir(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the mkdir(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * mkdir(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="mkdir08"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call mkdir(2)
- */
- TEST(mkdir(fname, 0777));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "mkdir(%s) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "mkdir(%s) returned %d", fname, TEST_RETURN);
- }
- if(rmdir(fname) == -1) {
- tst_brkm(TBROK, cleanup, "rmdir(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname, "./dir_%d", getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/mknod01.c b/winsup/testsuite/winsup.api/ltp/mknod01.c
deleted file mode 100644
index 32c7fe1e2..000000000
--- a/winsup/testsuite/winsup.api/ltp/mknod01.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : mknod01
- *
- * EXECUTED BY : root
- *
- * TEST TITLE : Basic test for mknod(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 4
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 05/13/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) mknod(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the mknod(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * mknod(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="mknod01"; /* Test program identifier. */
-int TST_TOTAL; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-char Path[1024]; /* path to create */
-int i; /* counter for test case loop */
-int tcases[] = { /* modes to give nodes created (1 per text case) */
- S_IFREG|0777, /* ordinary file with mode 0777 */
- S_IFIFO|0777, /* fifo special with mode 0777 */
- S_IFCHR|0777, /* character special with mode 0777 */
- S_IFBLK|0777, /* block special with mode 0777 */
-
- S_IFREG|04700, /* ordinary file with mode 04700 (suid) */
- S_IFREG|02700, /* ordinary file with mode 02700 (sgid) */
- S_IFREG|06700, /* ordinary file with mode 06700 (sgid & suid) */
-
-#ifdef CRAY
- S_IFDIR|0777, /* Direcory */
- S_IRESTART|0400, /* restartbit */
-#ifdef S_IFOFD
- S_IFOFD|0777, /* off line, with data */
-#endif
-#ifdef S_IFOFL
- S_IFOFL|0777, /* off line, with no data */
-#endif
-#endif /* CRAY */
-
-};
-
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- TST_TOTAL=(sizeof(tcases)/sizeof(tcases[0]));
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASES:
- * Make nodes in tcases array
- */
- for(i=0; i<TST_TOTAL; i++) {
- /* Call mknod(2) */
- TEST(mknod(Path, tcases[i], 0));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "mknod(%s, %#o, 0) failed, errno=%d : %s",
- Path, tcases[i], TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "mknod(%s, %#o, 0) returned %d",
- Path, tcases[i], TEST_RETURN);
- }
- }
-
- /* remove the node for the next go `round */
- if (unlink(Path) == -1 ) {
- if ( rmdir(Path) == -1 ) {
- tst_resm(TWARN, "unlink(%s) & rmdir(%s) failed, errno:%d %s",
- Path, Path, errno, strerror(errno));
- }
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /* Check that user is root */
- if ( geteuid() != 0 )
- tst_brkm(TBROK, cleanup, "Must be root for this test!");
-
- /* build a temp node name to bre created my mknod */
- sprintf(Path, "./tnode_%d", getpid());
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/nice05.c b/winsup/testsuite/winsup.api/ltp/nice05.c
deleted file mode 100644
index 602971f8a..000000000
--- a/winsup/testsuite/winsup.api/ltp/nice05.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : nice05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for nice(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) nice(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the nice(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * nice(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="nice05"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int val;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- val = lc % 39;
- /*
- * Call nice(2)
- */
- TEST(nice(val));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "nice(%d) Failed, errno=%d : %s", val,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "nice(%d) returned %d", val, TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/open03.c b/winsup/testsuite/winsup.api/ltp/open03.c
deleted file mode 100644
index b8dce9cee..000000000
--- a/winsup/testsuite/winsup.api/ltp/open03.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : open03
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for open(2)
- *
- * PARENT DOCUMENT : xxxtds01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) open(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the open(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * open(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="open03"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call open(2)
- */
- TEST(open(fname,O_RDWR|O_CREAT,0700));
-
- fd=TEST_RETURN;
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "open(%s,O_RDWR|O_CREAT,0700) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "open(%s, O_RDWR|O_CREAT,0700) returned %d",
- fname, TEST_RETURN);
- }
-
- if (close(fd) == -1) {
- tst_brkm(TBROK, cleanup,
- "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- } else if (unlink(fname) == -1) {
- tst_brkm(TBROK, cleanup,
- "unlink(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/pathconf01.c b/winsup/testsuite/winsup.api/ltp/pathconf01.c
deleted file mode 100644
index f87c6e239..000000000
--- a/winsup/testsuite/winsup.api/ltp/pathconf01.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : pathconf01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for pathconf(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 6
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) pathconf(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the pathconf(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * pathconf(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="pathconf01"; /* Test program identifier. */
-int TST_TOTAL; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int i;
-char *path = "/tmp";
-
-struct pathconf_args
-{
- char *define_tag;
- int value;
-} args[] = {
- {"_PC_LINK_MAX", _PC_LINK_MAX},
- {"_PC_NAME_MAX", _PC_NAME_MAX},
- {"_PC_PATH_MAX", _PC_PATH_MAX},
- {"_PC_PIPE_BUF", _PC_PIPE_BUF},
- {"_PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED},
- {"_PC_NO_TRUNC", _PC_NO_TRUNC},
- {NULL, 0}
-};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- TST_TOTAL=(sizeof(args)/sizeof(args[0]))-1;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for (i=0; i<TST_TOTAL; i++) {
-
- errno=-4;
-
- /*
- * Call pathconf(2)
- */
- TEST(pathconf(path, args[i].value));
-
- /*
- * A test case can only fail if -1 is returned and the errno
- * was set. If the errno remains unchanged, the
- * system call did not fail.
- */
- if ( TEST_RETURN == -1 && errno != -4 ) {
- tst_resm(TFAIL, "pathconf(%s, %s) Failed, errno=%d : %s",
- path, args[i].define_tag,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "pathconf(%s, %s) returned %d",
- path, args[i].define_tag, TEST_RETURN);
- }
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/pause01.c b/winsup/testsuite/winsup.api/ltp/pause01.c
deleted file mode 100644
index 28187c39f..000000000
--- a/winsup/testsuite/winsup.api/ltp/pause01.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : pause01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for pause(2)
- *
- * PARENT DOCUMENT : xxxtds01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 2
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) pause(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the pause(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * pause(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="pause01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={EINTR, 0};
-void go();
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- (void) signal(SIGALRM, go);
- alarm(1);
- /*
- * Call pause(2)
- */
- TEST(pause());
-
- /* check return code. Pause returns -1 and EINTR errno */
- if (TEST_RETURN != -1) {
- tst_resm(TFAIL,
- "pause() returned WITHOUT an error return code : %d",
- TEST_ERRNO);
- } else {
- /* log the errno */
- TEST_ERROR_LOG(TEST_ERRNO);
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* check the errno */
- if (TEST_ERRNO == EINTR)
- tst_resm(TPASS, "pause() returned %d", TEST_RETURN);
- else
- tst_resm(TFAIL, "pause() returned %d. Expected %d (EINTR)",
- TEST_RETURN, EINTR);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-/* routine to catch the alarm signal */
-void
-go()
-{
-}
diff --git a/winsup/testsuite/winsup.api/ltp/readlink02.c b/winsup/testsuite/winsup.api/ltp/readlink02.c
deleted file mode 100644
index c0ed6f154..000000000
--- a/winsup/testsuite/winsup.api/ltp/readlink02.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : readlink02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for readlink(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) readlink(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the readlink(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * readlink(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="readlink02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-char fname[255], buf[255], symlnk[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call readlink(2)
- */
- TEST(readlink(symlnk, buf, 255));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "readlink(%s, buf, 255) Failed, errno=%d : %s", symlnk,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "readlink(%s, buf, 255) returned %d", symlnk, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"./tfile_%d",getpid());
- if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- if (close(fd) == -1 ) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- sprintf(symlnk,"./sl_%d",getpid());
- if (symlink(fname, symlnk) == -1) {
- tst_resm(TWARN, "symlnk(%s, %s) Failed, errno=%d : %s",
- fname, symlnk, errno, strerror(errno));
- }
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/rename02.c b/winsup/testsuite/winsup.api/ltp/rename02.c
deleted file mode 100644
index 28890f119..000000000
--- a/winsup/testsuite/winsup.api/ltp/rename02.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : rename02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for rename(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) rename(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the rename(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * rename(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-void do_file_setup();
-
-
-
-char *TCID="rename02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-int fd;
-char fname[255], mname[255];
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call rename(2)
- */
- TEST(rename(fname, mname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "rename(%s, %s) Failed, errno=%d : %s", fname, mname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "rename(%s, %s) returned %d", fname, mname, TEST_RETURN);
- }
- if (unlink(mname) == -1) {
- tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", mname, errno, strerror(errno));
- }
- do_file_setup();
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"./tfile_%d",getpid());
- sprintf(mname,"./rnfile_%d",getpid());
- do_file_setup();
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-void
-do_file_setup()
-{
- if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- if (close(fd) == -1 )
- tst_resm(TWARN, "close(%s) Failed on file create, errno=%d : %s",
- fname, errno, strerror(errno));
-
-}
diff --git a/winsup/testsuite/winsup.api/ltp/rmdir04.c b/winsup/testsuite/winsup.api/ltp/rmdir04.c
deleted file mode 100644
index 5cf84f770..000000000
--- a/winsup/testsuite/winsup.api/ltp/rmdir04.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : rmdir04
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for rmdir(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) rmdir(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the rmdir(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * rmdir(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="rmdir04"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-char *cwd;
-char fname[255];
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- if (mkdir(fname, 0777) == -1) {
- tst_brkm(TBROK, cleanup,
- "mkdir(%s) Failure. errno=%d : %s", fname, errno, strerror(errno));
- }
- /*
- * Call rmdir(2)
- */
- TEST(rmdir(fname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "rmdir(%s) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "rmdir(%s) returned %d", fname, TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname, "./dir_%d", getpid());
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/select01.c b/winsup/testsuite/winsup.api/ltp/select01.c
deleted file mode 100644
index 6ff0fe87b..000000000
--- a/winsup/testsuite/winsup.api/ltp/select01.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : select01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : select to a file
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 3
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 02/24/93
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) select(2) to a fd of regular file with no I/O and small timeout
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the select(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * join(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h> /* For open system call parameters. */
-#include <signal.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#ifdef __CYGWIN__
-/*
- FIXME: workaround for bug in newlib -- FD_ZERO is defined via bzero and
- if we don't include strings.h compiler warns about implicit declaration
-*/
-#include <strings.h>
-#endif
-
-#include "test.h"
-#include "usctest.h"
-
-#define FILENAME "select01"
-
-void setup();
-void cleanup();
-
-char *TCID="select01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int Fd;
-fd_set Readfds;
-
-/***********************************************************************
- * MAIN
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- struct timeval timeout;
- long test_time = 0; /* in usecs */
-
-
- /***************************************************************
- * parse standard options, and exit if there is an error
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Assigning the specified seconds within the timeval structure.
- */
- test_time = ((lc%2000)*100000); /* 100 milli-seconds */
-
- /*
- * Bound the time to a value less than 60 seconds
- */
-
- if ( test_time > 1000000 * 60 )
- test_time = test_time % (1000000 * 60);
-
- timeout.tv_sec = test_time / 1000000;
- timeout.tv_usec = test_time - (timeout.tv_sec * 1000000);
-
-
- /* Call the system call being tested. */
- TEST(select(4, &Readfds, 0, 0, &timeout));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL,
- "%d select(4, &Readfds, 0, 0, &timeout), timeout = %ld usecs, errno=%d",
- lc, test_time, errno);
- }
-
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* Perform functional verification here */
- tst_resm(TPASS,
- "select(4, &Readfds, 0, 0, &timeout) timeout = %ld usecs",
- test_time);
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* create a temporary directory and go to it */
- tst_tmpdir();
-
- if ((Fd=open(FILENAME, O_CREAT | O_RDWR)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_CREAT | O_RDWR) failed: errno:%d\n",
- errno);
- }
-
- /*
- * Initializing and assigning the standard output file descriptor to
- * fd_set for select.
- */
-
- FD_ZERO(&Readfds);
- FD_SET(Fd, &Readfds);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- close(Fd);
-
- /* remove temporary directory and all files in it. */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/setgid01.c b/winsup/testsuite/winsup.api/ltp/setgid01.c
deleted file mode 100644
index 50b339d03..000000000
--- a/winsup/testsuite/winsup.api/ltp/setgid01.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setgid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for setgid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setgid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setgid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setgid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="setgid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-int gid;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call setgid(2)
- */
- TEST(setgid(gid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setgid(%d) Failed, errno=%d : %s", gid,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setgid(%d) returned %d", gid, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- gid = getgid();
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/setgroups01.c b/winsup/testsuite/winsup.api/ltp/setgroups01.c
deleted file mode 100644
index dc7bd1d47..000000000
--- a/winsup/testsuite/winsup.api/ltp/setgroups01.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setgroups01
- *
- * EXECUTED BY : root
- *
- * TEST TITLE : Basic test for setgroups(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setgroups(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setgroups(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setgroups(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <grp.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="setgroups01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int len = NGROUPS;
-gid_t list[NGROUPS];
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call setgroups(2)
- */
- TEST(setgroups(len, list));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setgroups(%d, list) Failed, errno=%d : %s", len,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setgroups(%d, list) returned %d", len, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- if ( geteuid() != 0 )
- tst_brkm(TBROK, cleanup, "Must be ROOT to run this test.");
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- if (getgroups(len, list) == -1) {
- tst_brkm(TBROK, cleanup,
- "getgroups(%d, list) Failure. errno=%d : %s",
- len, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/setpgid01.c b/winsup/testsuite/winsup.api/ltp/setpgid01.c
deleted file mode 100644
index e580a34f7..000000000
--- a/winsup/testsuite/winsup.api/ltp/setpgid01.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setpgid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for setpgid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setpgid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setpgid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setpgid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="setpgid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-int pgid, pid;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call setpgid(2)
- */
- TEST(setpgid(pid, pgid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setpgid(%d, %d) Failed, errno=%d : %s", pid, pgid,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setpgid(%d, %d) returned %d", pid, pgid, TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int status;
-
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- /*
- * Make sure current process is NOT a session or pgrp leader
- */
-
- pgid=getpgrp();
- pid=getpid();
-
- if (pgid == pid) {
- if ((pid = fork()) == -1) {
- tst_brkm(TBROK, cleanup, "fork() in setup() failed - errno %d",
- errno);
- }
-
- if (pid != 0) { /* parent - sits and waits */
- wait(&status);
- exit(WEXITSTATUS(status));
- } else { /* child - continues with test */
- pid = getpid();
- }
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/setregid01.c b/winsup/testsuite/winsup.api/ltp/setregid01.c
deleted file mode 100644
index e247f6c61..000000000
--- a/winsup/testsuite/winsup.api/ltp/setregid01.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setregid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for setregid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 5
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 05/13/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setregid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setregid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setregid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="setregid01"; /* Test program identifier. */
-int TST_TOTAL=5; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int gid, egid; /* current real and effective group id */
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Dont change either real or effective gid
- */
- gid=getgid();
-egid=getegid();
-
-
- /* Call setregid(2) */
- TEST(setregid(-1, -1));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setregid - Dont change either real or effective gid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setregid - Dont change either real or effective gid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * change effective to effective gid
- */
-
-
- /* Call setregid(2) */
- TEST(setregid(-1, egid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setregid - change effective to effective gid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setregid - change effective to effective gid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * change real to real gid
- */
-
-
- /* Call setregid(2) */
- TEST(setregid(gid, -1));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setregid - change real to real gid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setregid - change real to real gid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * change effective to real gid
- */
-
-
- /* Call setregid(2) */
- TEST(setregid(-1, gid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setregid - change effective to real gid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setregid - change effective to real gid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * try to change real to current real
- */
-
-
- /* Call setregid(2) */
- TEST(setregid(gid, gid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setregid - try to change real to current real failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setregid - try to change real to current real returned %d", TEST_RETURN);
- }
- }
-
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/setreuid01.c b/winsup/testsuite/winsup.api/ltp/setreuid01.c
deleted file mode 100644
index 67f3bae4a..000000000
--- a/winsup/testsuite/winsup.api/ltp/setreuid01.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setreuid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for setreuid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 5
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 05/14/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setreuid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setreuid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setreuid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="setreuid01"; /* Test program identifier. */
-int TST_TOTAL=5; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int ruid, euid; /* real and effective user ids */
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Don't change either real or effective uid
- */
- ruid=getuid(); /* get real uid */
-euid=geteuid(); /* get effective uid */
-
-
- /* Call setreuid(2) */
- TEST(setreuid(-1, -1));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setreuid - Don't change either real or effective uid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setreuid - Don't change either real or effective uid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * change effective to effective uid
- */
-
-
- /* Call setreuid(2) */
- TEST(setreuid(-1, euid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setreuid - change effective to effective uid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setreuid - change effective to effective uid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * change real to real uid
- */
-
-
- /* Call setreuid(2) */
- TEST(setreuid(ruid, -1));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setreuid - change real to real uid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setreuid - change real to real uid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * change effective to real uid
- */
-
-
- /* Call setreuid(2) */
- TEST(setreuid(-1, ruid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setreuid - change effective to real uid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setreuid - change effective to real uid returned %d", TEST_RETURN);
- }
- }
-
-
- /*
- * TEST CASE:
- * try to change real to current real
- */
-
-
- /* Call setreuid(2) */
- TEST(setreuid(ruid, ruid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setreuid - try to change real to current real failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setreuid - try to change real to current real returned %d", TEST_RETURN);
- }
- }
-
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/setuid01.c b/winsup/testsuite/winsup.api/ltp/setuid01.c
deleted file mode 100644
index 4437108c8..000000000
--- a/winsup/testsuite/winsup.api/ltp/setuid01.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setuid01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for setuid(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 05/14/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setuid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * The libcuts.a and libsys.a libraries must be included in
- * the compilation of this test.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setuid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setuid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="setuid01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int uid; /* current user id */
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * TEST CASE:
- * Set the effective user ID to the current real uid
- */
- uid=getuid();
-
- /* Call setuid(2) */
- TEST(setuid(uid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setuid - Set the effective user ID to the current real uid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setuid - Set the effective user ID to the current real uid returned %d", TEST_RETURN);
- }
- }
-
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/setuid02.c b/winsup/testsuite/winsup.api/ltp/setuid02.c
deleted file mode 100644
index 65576af62..000000000
--- a/winsup/testsuite/winsup.api/ltp/setuid02.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : setuid02
- *
- * EXECUTED BY : root
- *
- * TEST TITLE : Basic test for setuid(2) as root
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 05/14/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) setuid(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the setuid(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * setuid(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="setuid02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
-
-int uid; /* current user id */
-
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- uid=getuid();
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- /*
- * TEST CASE:
- * Set the effective user ID to the current real uid
- */
-
- /* Call setuid(2) */
- TEST(setuid(uid));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "setuid - Set the effective user ID to the current real uid failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "setuid - Set the effective user ID to the current real uid returned %d", TEST_RETURN);
- }
- }
-
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp dir and cd to it */
- tst_tmpdir();
-
- /* must be root */
- if ( geteuid() != 0 )
- tst_brkm(TBROK, cleanup, "Must be root for this test!");
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove files and temp dir */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/stat05.c b/winsup/testsuite/winsup.api/ltp/stat05.c
deleted file mode 100644
index ba102e3cb..000000000
--- a/winsup/testsuite/winsup.api/ltp/stat05.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : stat05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for stat(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) stat(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the stat(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * stat(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="stat05"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-struct stat statter;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call stat(2) with F_CLRALF argument on fname
- */
- TEST(stat(fname, &statter));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "stat(%s, &statter) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "stat(%s, &statter) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/symlink01.c b/winsup/testsuite/winsup.api/ltp/symlink01.c
deleted file mode 100644
index d0ad0d5ac..000000000
--- a/winsup/testsuite/winsup.api/ltp/symlink01.c
+++ /dev/null
@@ -1,2024 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
-*
-* OS Test - Silicon Graphics, Inc.
-*
-* TEST IDENTIFIER : symlink01 (symlink)
-*
-* TEST TITLE : Make a Symbolic Link to a File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 5
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : readlink01 (readlink)
-*
-* TEST TITLE : Reads Value of a Symbolic Link
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 4
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : stat04 (stat)
-*
-* TEST TITLE : Gets File Status Indirectly From a Symbolic Link
-* File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : lstat01 (lstat)
-*
-* TEST TITLE : Get file Status About a Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : mkdir05 (mkdir)
-*
-* TEST TITLE : Fail When Making a Directory File Indirectly From
-* a Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 1
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : rmdir03 (rmdir)
-*
-* TEST TITLE : Fail When Removing a Directory File Indirectly
-* From a Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 1
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : chdir01 (chdir)
-*
-* TEST TITLE : Changes Current Working DIrectory Location
-* Indirectly From a Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : link01 (link)
-*
-* TEST TITLE : Creates a Link To a File Indirectly From a
-* Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : unlink01 (unlink)
-*
-* TEST TITLE : Removes a Link To a File And Not Any Object File
-* Which Maybe Pointed At
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 1
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : chmod01 (chmod)
-*
-* TEST TITLE : Change Object File Permissions Indirectly From a
-* Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : utime01 (utime)
-*
-* TEST TITLE : Set File Access And Modify Object File Times
-* Indirectly From a Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : rename01 (rename)
-*
-* TEST TITLE : Rename a Symbolic Link File And Not Any Object
-* File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 3
-*
-* WALL CLOCK TIME : 3
-*
-* TEST IDENTIFIER : open01 (open)
-*
-* TEST TITLE : Create/Open a File For Reading Or Writing
-* Indirectly From a Symbolic Link File
-*
-* PARENT DOCUMENT : symtds01
-*
-* TEST CASE TOTAL : 5
-*
-* WALL CLOCK TIME : 3
-*
-* EXECUTED BY : whom ever
-*
-* CPU TYPES : ALL
-*
-* AUTHOR : David Fenner
-*
-* CO-PILOT : Jon Hendrickson
-*
-* DATE STARTED : 07/25/90
-*
-* INITIAL RELEASE : UNICOS 6.0
-*
-* TEST CASES
-*
-* For symlink
-*
-* 1. Create symbolic link with abnormal object name path
-* 2. Create symbolic link with normal object name path
-* 3. Create symbolic link with path to an existing object file
-* 4. Receive EEXIST error when creating an already existing symbolic link file.
-* 5. Receive ENAMETOOLONG error when creating symbolic link which exceeds PATH_MAX in length
-*
-* For readlink
-*
-* 1. Read a symbolic link file which points at no object file
-* 2. Read a symbolic link file which points at an object file
-* 3. Receive ENAMETOOLONG error when reading symbolic link which exceeds PATH_MAX in length
-* 4. Receive an EINVAL error when reading a file which is not a symbolic
-* link file.
-*
-* For stat
-*
-* 1. Get object file status through symbolic link file
-* 2. Receive ENOENT error when accessing non-existent object file through symbolic link file
-* 3. Receive ELOOP error when nesting of symbolic links exceed maximum
-*
-* For lstat
-*
-* 1. Get symbolic link file status when pointing at no object file
-* 2. Get symbolic link file status when pointing at an object file
-* 3. Get object file status when argument is not a symbolic link
-* file.
-*
-* For mkdir
-*
-* 1. Receive EEXIST error when creating a directory through a symbolic link file
-*
-* For rmdir
-*
-* 1. Receive ENOTDIR error when removing an existing directory through a symbolic link file
-*
-* For chdir
-*
-* 1. Change current working directory through a symbolic link file
-* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file
-* 3. Receive ELOOP error when nesting of symbolic links exceed maximum
-*
-* For link
-*
-* 1. Link an object file to a new file through symbolic link file
-* 2. Receive ENOENT error when accessing non-existent object file through symbolic link file
-* 3. Receive ELOOP error when nesting of symbolic links exceed maximum
-*
-* For unlink
-*
-* 1. Delete a symbolic link file and not the object file which it points at
-*
-* For chmod
-*
-* 1. Change file permissions of object file through a symbolic link file
-* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file
-* 3. Receive ELOOP error when nesting of symbolic links exceed maximum
-*
-* For utime
-*
-* 1. Change inode times of object file through a symbolic link file
-* 2. Receive ENOENT error when accessing non-existent directory through symbolic link file
-* 3. Receive ELOOP error when nesting of symbolic links exceed maximum
-*
-* For rename
-*
-* 1. Rename a symbolic link file which points at no object file
-* 2. Rename a symbolic link file which points at an object file without any object file alterations.
-* 3. Receive EXDEV when trying to rename a symbolic link file to an address outside of current file system
-*
-* For open
-*
-* 1. Create an object file through a symbolic link file
-* 2. Open an object file through a symbolic link file
-* 3. Receive EEXIST error when exclusively creating an object file through a symbolic link file
-* 4. Receive ENOENT error when accessing non-existent object file through symbolic link file
-* 5. Receive ELOOP error when nesting of symbolic links exceed maximum
-*
-* ENVIRONMENTAL NEEDS
-* None
-*
-* DETAILED DESCRIPTION
-*
-* Self-documenting code so see below
-*
-*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <stdio.h>
-#include <signal.h>
-#include <string.h>
-#include <fcntl.h> /* open(2) system call */
-#include <errno.h>
-#include <sys/types.h>
-#include <utime.h> /* utime(2) system call */
-#include <sys/param.h>
-#include <sys/stat.h> /* stat(2) and lstat(2) system calls */
-
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-void help();
-void delete_files();
-void do_EEXIST();
-void do_ENOENT();
-void do_ELOOP();
-void do_ENOTDIR();
-void do_EXDEV();
-void do_ENAMETOOLONG();
-void do_EINVAL();
-void do_readlink();
-void do_stat();
-void do_chdir();
-void do_link();
-void do_unlink();
-void do_chmod();
-void do_utime();
-void do_rename();
-void do_open();
-
-#define S_FILE "symbolic" /* Name of symbolic link file */
-#define O_FILE "object" /* Name of object file */
-#define A_S_FILE "asymbolic" /* Another name for a symbolic link file */
-#define Y_A_S_FILE "/NiCkEr" /* Yet another symbolic link file */
-#define BIG_STRING "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
-
-#define DEFAULT_TCID "symlink01"
-
-#define SYMLINK "symlink01"
-#define READLINK "readlink01"
-#define STAT "stat04"
-#define LSTAT "lstat01"
-#define MKDIR "mkdir05"
-#define RMDIR "rmdir03"
-#define CHDIR "chdir01"
-#define LINK "link01"
-#define UNLINK "unlink01"
-#define CHMOD "chmod01"
-#define UTIME "utime01"
-#define RENAME "rename01"
-#define OPEN "open01"
-
-#define cktcsid(s1,s2) (!strcmp(s1,s2))
-#define BUFMAX 512
-#define MODE 0700
-#define MASK 0100777 /* A regular file with r,w,x for all mask */
-
-/*
- * Lets be optimistic and only define messages for passing test cases
- */
-const char *msgs[] = {
- "Creation of symbolic link file to no object file is ok",
- "Creation of symbolic link file and object file via symbolic link is ok",
- "Creating an existing symbolic link file error is caught",
- "Creating a symbolic link which exceeds maximum pathname error is caught",
- "Reading of symbolic link file contents checks out ok",
- "Reading a symbolic link which exceeds maximum pathname error is caught",
- "Getting stat info about object file through symbolic link file is ok",
- "Stat(2) error when accessing non-existent object through symbolic link is caught",
- "lstat(2) of symbolic link file which points to no object file is ok",
- "lstat(2) of symbolic link file which points at an object file is ok",
- "mkdir(2) of object file through symbolic link file failed as expected",
- "rmdir(2) of object file through symbolic link file failed as expected",
- "chdir(2) to object file location through symbolic link file is ok",
- "chdir(2) to non-existent object file location through symbolic link file failed as expected",
- "link(2) to a symbolic link, which is pointing to an existing object file worked - file created and link count adjusted",
- "link(2) to a symbolic link, which is pointing to a non-existing object file worked ok - file created and link count adjusted.",
- "unlink(2) of symbolic link file with no object file removal is ok",
- "chmod(2) of object file permissions through symbolic link file is ok",
- "chmod(2) error when accessing non-existent object through symbolic link is caught",
- "utime(2) change of object file access and modify times through symbolic link file is ok",
- "utime(2) error when accessing non-existent object through symbolic link is caught",
- "rename(3) of symbolic link file name which points at no object file is ok",
- "rename(3) of symbolic link file name which points at object file is ok",
- "rename(3) error of symbolic link file name across file systems is caught",
- "open(2) with (O_CREAT | O_RDWR) to create object file through symbolic link file and all writes, reads, and lseeks are ok",
- "open(2) with O_RDWR of existing object file through symbolic link file and all writes, reads, and lseeks are ok",
- "open(2) with (O_CREAT | O_EXCL) error is caught when creating object file through symbolic link file",
- "open(2) error with O_RDWR is caught when processing symbolic link file which points at no object file",
- "Nested symbolic link access condition caught. ELOOP is returned",
- "Reading a nonsymbolic link file error condition is caught. EINVAL is returned",
- "lstat(2) of object file returns object file inode information",
- "NULL"
-};
-
-/*
- * Define test object setup and validation functions
- */
-int creat_both(), creat_symlink(), creat_path_max(), ck_symlink(),
- creat_object(), ck_object(), ck_both(), ck_path_max();
-
-
-/*
- * Define test cases
- */
-struct all_test_cases
-{
- char *tcid;
- int test_fail;
- int errno_val;
- int pass_msg;
- int (*test_setup)();
- int (*ck_test)();
- char *fn_arg[3];
-
-} test_objects[] = {
- {SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}},
- {SYMLINK, 0, 0, 0, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {SYMLINK, 0, 0, 1, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {SYMLINK, 1, EEXIST, 2, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {SYMLINK, 1, ENAMETOOLONG, 3, creat_path_max, ck_path_max, {O_FILE, S_FILE, NULL}},
- {READLINK, 0, 0, 4, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {READLINK, 0, 0, 4, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {READLINK, 1, ENAMETOOLONG, 5, creat_path_max, ck_path_max, {O_FILE, S_FILE, NULL}},
- {READLINK, 1, EINVAL, 29, creat_object, ck_object, {O_FILE, NULL, NULL}},
- {STAT, 0, 0, 6, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {STAT, 1, ENOENT, 7, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {STAT, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}},
- {LSTAT, 0, 0, 8, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {LSTAT, 0, 0, 9, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {LSTAT, 0, 0, 30, creat_object, ck_object, {O_FILE, NULL, NULL}},
- {MKDIR, 1, EEXIST, 10, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {RMDIR, 1, ENOTDIR, 11, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {CHDIR, 0, 0, 12, creat_symlink, ck_symlink, {O_FILE, S_FILE, O_FILE}},
- {CHDIR, 1, ENOENT, 13, creat_symlink, ck_symlink, {"%bc+eFhi!k", S_FILE, NULL}},
- {CHDIR, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}},
- {LINK, 0, 0, 14, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {LINK, 0, 0, 15, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- /* The following link test case is invalid - leaving it defined so */
- /* I don't have to change all the entries in the all_tcses array after link */
- {LINK, 1, -1, -1, creat_symlink, ck_symlink, {NULL, NULL, NULL}},
- {UNLINK, 0, 0, 16, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {CHMOD, 0, 0, 17, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {CHMOD, 1, ENOENT, 18, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {CHMOD, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}},
- {UTIME, 0, 0, 19, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {UTIME, 1, ENOENT, 20, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {UTIME, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}},
- {RENAME, 0, 0, 21, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {RENAME, 0, 0, 22, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {RENAME, 1, EXDEV, 23, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {OPEN, 0, 0, 24, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {OPEN, 0, 0, 25, creat_both, ck_both, {O_FILE, S_FILE, O_FILE}},
- {OPEN, 1, EEXIST, 26, creat_symlink, ck_symlink, {O_FILE, S_FILE, O_FILE}},
- {OPEN, 1, ENOENT, 27, creat_symlink, ck_symlink, {O_FILE, S_FILE, NULL}},
- {OPEN, 1, ELOOP, 28, creat_symlink, ck_symlink, {S_FILE, S_FILE, NULL}}
-};
-
-/*
- * Define tcses
- */
-struct tcses
-{
- char *tcid;
- char *syscall;
- int test_cases; /* number of entries in test_objects array */
- struct all_test_cases *tc_ptr;
- char *desc;
-} all_tcses[] = {
-
- { SYMLINK, "symlink", 5, &test_objects[0],
- "Make a Symbolic Link to a File" },
- { READLINK, "readlink", 4, &test_objects[5],
- "Reads Value of a Symbolic Link" },
- { STAT, "stat", 3, &test_objects[9],
- "Gets File Status Indirectly From a Symbolic Link file" },
- { LSTAT, "lstat", 3, &test_objects[12],
- "Get file Status About a Symbolic Link File" },
- { MKDIR, "mkdir", 1, &test_objects[15],
- "Fail When Making a Directory File Indirectly from a symlink" },
- { RMDIR, "rmdir", 1, &test_objects[16],
- "Fail When Removing a Directory File Indirectly from a symlink" },
- { CHDIR, "chdir", 3, &test_objects[17],
- "Changes CWD Location Indirectly from a symlink" },
- { LINK, "link", 2, &test_objects[20],
- "Creates a Link To a File Indirectly From a Symbolic" },
- { UNLINK, "unlink", 1, &test_objects[23],
- "Removes a Link To a File but not the Object File" },
- { CHMOD, "chmod", 3, &test_objects[24],
- "Change Object File Permissions Indirectly From a Symbolic" },
- { UTIME, "utime", 3, &test_objects[27],
- "Set File Access And Modify Object File Times via symlink" },
- { RENAME, "rename", 3, &test_objects[30],
- "Rename a Symbolic Link File And Not Any Object file" },
- { OPEN, "open", 5, &test_objects[33],
- "Create/Open a File For Reading Or Writing via symlink" },
-};
-
-/*
- * Define GLOBAL variables
- */
-
-int TST_TOTAL;
-int TEST_RESULT;
-time_t a_time_value = 100;
-char *TCID;
-char *Selectedtests = NULL; /* Name (tcid) of selected test cases */
-char test_msg[BUFMAX];
-char full_path[PATH_MAX+1];
-extern int Tst_count;
-extern char *TESTDIR;
-extern char *strrchr();
-extern int errno;
-
-struct stat asymlink, statter;
-char Buffer[1024];
-char Buf[1024];
-
-char *Tcid = NULL;
-
-option_t Options[] = {
- { "T:", NULL, &Tcid }, /* -T tcid option */
- { NULL, NULL, NULL }
-};
-
-/***********************************************************************
- * MAIN
- ***********************************************************************/
-int
-main(int argc, char *argv[])
-{
- struct tcses *tcs_ptr, *get_tcs_info();
- int do_syscalltests();
- void cleanup();
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
-
- /***************************************************************
- * parse standard options, and exit if there is an error
- ***************************************************************/
- if ( (msg=parse_opts(argc, argv, Options, &help)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /*
- * If the -T option was used, use that TCID or use the default
- */
- if ( Tcid != NULL ) {
- TCID = Tcid;
- Selectedtests=Tcid;
-
- }
-#ifndef ALL
- else {
- TCID = DEFAULT_TCID;
- Selectedtests = DEFAULT_TCID;
- }
-#endif
-
- /*
- * Get test case specification information and assign TST_TOTAL
- */
- if ((tcs_ptr=get_tcs_info(Selectedtests)) == NULL) {
- TST_TOTAL=1;
- tst_brkm(TBROK, cleanup,
- "Unknown symbolic link test case specification executed");
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
-
- setup();
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Execute tcs testing function and all defined test cases
- */
- do_syscalltests(tcs_ptr);
-
- } /* End for TEST_LOOPING */
-
- /*
- * End appropriately
- */
- cleanup();
-
- return 0;
-}
-
-/***********************************************************************
- * This function maps the name of the process to a test case specification
- * defined in the all_tcses array of tcses structures. Either a pointer
- * to the mapped test case specification information is returned or a
- * null pointer.
- *
- * Argument is path to program name.
- ***********************************************************************/
-struct tcses *get_tcs_info(ptr)
-char *ptr;
-{
- int ctr;
- struct tcses *tcs_ptr;
-
-#if ALL
- if ( ptr == NULL ) {
-
- TST_TOTAL=0;
- for (ctr=1; ctr < sizeof(all_tcses)/sizeof(struct tcses); ctr++)
- TST_TOTAL += all_tcses[ctr].test_cases;
- return all_tcses;
- }
-#endif
-
-
- for(ctr=0; ctr < (sizeof(all_tcses)/sizeof(struct tcses)); ctr++) {
- if ( strcmp(ptr, all_tcses[ctr].tcid) == 0 ||
- strcmp(ptr, all_tcses[ctr].syscall) == 0 ) {
- tcs_ptr = &all_tcses[ctr];
- TCID = all_tcses[ctr].tcid;
- TST_TOTAL=tcs_ptr->test_cases;
- return(tcs_ptr);
- }
-
- }
- return(NULL);
-}
-
-/***********************************************************************
- * Determines if what path points at is a symbolic link file
- *
- * Argument is path to symbolic link file.
- *
- * Return status is one if a symbolic link file. Zero if not a symbolic
- * link file and a minus one if the path doesn't point at a file.
- ***********************************************************************/
-int
-see_if_a_symlink(path)
-char *path;
-{
- if (lstat(path, &asymlink) < 0)
- return(-1);
-
- if ((asymlink.st_mode & S_IFMT) == S_IFLNK)
- return(1);
- else
- return(0);
-}
-
-/***********************************************************************
- * This function performs without any hesitation, file(s) deletions
- ***********************************************************************/
-void
-delete_files(path1, path2)
-char *path1, *path2;
-{
- unlink(path1);
- unlink(path2);
-}
-
-/***********************************************************************
- *
- * This routine creates a symbolic link file.
- *
- * Argument one is symbolic link pathname to point at.
- * Argument two is name of symbolic link file.
- *
- ***********************************************************************/
-int
-creat_symlink(path1, path2)
-char *path1, *path2;
-{
- TEST( symlink(path1, path2) );
- errno=TEST_ERRNO;
- if (TEST_RETURN == -1) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "symlink(2) Failure when creating setup %s object file: errno:%d %s",
- path1, errno, strerror(errno));
- return(0);
- }
- else {
- sprintf(Buf, "symlink(%s, %s) was succesful.\n", path1, path2);
- strcat(Buffer, Buf);
-#if DEBUG
- tst_resm(TPASS, "symlink(%s, %s) was succesful.", path1, path2);
-#endif
- }
- return(1);
-}
-
-/***********************************************************************
- *
- * This routine creates a regular file.
- *
- * Argument one is a pathname
- *
- ***********************************************************************/
-int
-creat_object(path1)
-char *path1;
-{
- int fd;
- if ((fd=creat(path1, MODE)) == -1) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "creat(2) Failure when creating setup %s object file: errno:%d %s",
- path1, errno, strerror(errno));
- return(0);
- }
- else {
- sprintf(Buf, "creat(%s, %#o) was succesful.\n", path1, MODE);
- strcat(Buffer, Buf);
-#if DEBUG
- tst_resm(TPASS, "creat(%s, %#o) was succesful.", path1, MODE);
-#endif
- }
- if (close(fd) == -1) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "close(2) Failure when closing setup %s object file: errno:%d %s",
- path1, errno, strerror(errno));
- return(0);
- }
- return(1);
-}
-
-/***********************************************************************
- *
- * This routine creates a symbolic link file and a regular file.
- *
- * Argument one is a pathname of object file
- * Argument two is symbolic link file name
- * Argument three is regular file name
- *
- ***********************************************************************/
-int
-creat_both(path1, path2, path3)
-char *path1, *path2, *path3;
-{
- if (creat_symlink(path1, path2) == -1)
- return(0);
- else if (creat_object(path3) == -1)
- return(0);
- return(1);
-}
-
-/***********************************************************************
- *
- * This routine checks if symbolic link file is a symbolic link file.
- *
- * Argument one is a pathname of object file
- * Argument two is symbolic link file name
- * Argument three is regular file name
- *
- ***********************************************************************/
-int
-ck_symlink(path1, path2, path3)
-char *path1, *path2, *path3;
-{
- int ret;
-
- if ((ret=see_if_a_symlink(path2)) == -1) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "lstat(2) Failure when accessing %s symbolic link file which should contain %s path to %s file ",
- path2, path1, path3);
- return(0);
- }
- else if (ret == 0) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "%s is not a symbolic link file which contains %s path to %s file",
- path2, path1, path3);
- return(0);
- }
- return(1);
-}
-
-/***********************************************************************
- *
- * This routine checks if symbolic link file points at object file.
- *
- * Argument one is a pathname of object file
- * Argument two is symbolic link file name
- * Argument three is regular file name
- *
- ***********************************************************************/
-int
-ck_both(path1, path2, path3)
-char *path1, *path2, *path3;
-{
- if (ck_symlink(path1, path2, path3) == 0)
- return(0);
- else if ((stat(path3, &statter) == -1) && (errno == ENOENT)) {
- TEST_RESULT=TBROK;
- sprintf(test_msg, "stat(2) Failure when accessing %s object file ", path3);
- return(0);
- }
- else if ((stat(path2, &asymlink) == -1) && (errno == ENOENT)) {
- TEST_RESULT=TBROK;
- sprintf(test_msg, "stat(2) Failure when accessing %s symbolic link file ",
- path2);
- return(0);
- }
- else if (statter.st_ino != asymlink.st_ino) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "stat(2) Failure when accessing %s object file through %s symbolic link file ",
- path3, path2);
- return(0);
- }
- return(1);
-
-}
-
-/***********************************************************************
- * This routine populates full_path with a pathname whose length exceeds
- * the PATH_MAX define value in param.h
- *
- * Argument one is a pathname of object file
- * Argument two is symbolic link file name
- * Argument three is regular file name
- ***********************************************************************/
-int
-creat_path_max(path1, path2, path3)
-char *path1, *path2, *path3;
-{
- int ctr, to_go, size, whole_chunks;
- char *cwd, *getcwd();
-
- if ((cwd = getcwd((char *)NULL, 64)) == NULL)
- {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "getcwd(3) Failure in setup of %s %s %s test case object elements",
- path1, path2, path3);
- return(0);
- }
- cwd = getcwd((char *)NULL, 64);
- size = strlen(cwd);
-
- to_go = PATH_MAX - size;
- size = strlen(path1);
- whole_chunks = to_go / size;
- strcpy(full_path, cwd);
- for (ctr=0; ctr < whole_chunks; ctr++) {
- strcat(full_path, path1);
- }
- size= strlen(full_path);
- to_go = PATH_MAX - size;
- strcat(full_path, "/");
- for (ctr=0; ctr < to_go; ctr++)
- strcat(full_path, "Z");
-
- return(1);
-}
-
-/***********************************************************************
- * This routine checks that full_path's length exceeds the PATH_MAX
- * define value in param.h
- *
- * Argument one is a pathname of object file
- * Argument two is symbolic link file name
- * Argument three is regular file name
- ***********************************************************************/
-int
-ck_path_max(path1, path2, path3)
-char *path1, *path2, *path3;
-{
- if (strlen(full_path) == (PATH_MAX+1))
- return(1);
- else
- {
- TEST_RESULT=TBROK;
- sprintf(test_msg, "%s %d %s %s %s %s",
- "full_path character array length was not", (PATH_MAX+1),
- "characters long for test case object elements",
- path1, path2, path3);
- return(0);
- }
-}
-
-/***********************************************************************
- * This routine checks if the stat(2) and lstat(2) calls return the same
- * information when the path is not a symbolic link file
- *
- * Argument one is a pathname of object file
- * Argument two is symbolic link file name
- * Argument three is regular file name
- *
- ***********************************************************************/
-int
-ck_object(path1, path2, path3)
-char *path1, *path2, *path3;
-{
- int ret;
-
- if ((ret=see_if_a_symlink(path1)) < 0) {
- TEST_RESULT=TFAIL;
- sprintf(test_msg,
- "lstat(2) failed to return inode information for a regular object file");
- return(0);
- }
- else if (ret == 1) {
- TEST_RESULT=TFAIL;
- sprintf(test_msg,
- "lstat(2) detected a regular object file as a symbolic link file");
- return(0);
- }
- else if (stat(path1, &statter) == -1) {
- TEST_RESULT=TBROK;
- sprintf(test_msg,
- "stat(2) failed to return inode information for a regular object file");
- return(0);
- }
- else if (bcmp((char *)&statter, (char *)&asymlink, sizeof(statter)) != 0) {
- TEST_RESULT=TFAIL;
- sprintf(test_msg,
- "lstat(2) and stat(2) do not return same inode information for an object file");
- return(0);
-
- }
- return(1);
-}
-
-/***********************************************************************
- * Main test case processing function
- *
- * Argument is a ptr into the all_tcses array of structures of type tcses
- ***********************************************************************/
-int
-do_syscalltests(tcs)
-struct tcses *tcs;
-{
- int ctr, ret;
- struct all_test_cases *tc_ptr;
-
- /*
- * loop through desired number of test cases
- */
- for (ctr=0, tc_ptr=tcs->tc_ptr; ctr < TST_TOTAL; ctr++, tc_ptr++) {
-
- Buffer[0]='\0';
-
- /*
- * If running all test cases for all tcid, set the TCID if needed.
- */
- if ( Selectedtests == NULL ) {
- if ( strcmp(tcs->tcid, tc_ptr->tcid) != 0 ) {
- TCID = tc_ptr->tcid;
- Tst_count=0;
- }
- }
- /*
- * Insure that we are executing the correct tcs test case
- */
- if (strcmp(tcs->tcid, tc_ptr->tcid) != 0) {
- tst_resm(TBROK, "%s TCID attempted to execute %s %d %d test case",
- tcs->tcid, tc_ptr->tcid, tc_ptr->test_fail, tc_ptr->errno_val);
- continue;
- }
- TEST_RESULT=TPASS;
- delete_files(S_FILE, O_FILE);
- /*
- * Perform test case setup
- */
- ret = (tc_ptr->test_setup)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1],
- tc_ptr->fn_arg[2], tc_ptr->errno_val);
-
- /* If an expected error, try it out */
-
- if (tc_ptr->test_fail) {
- /*
- * Try to perform test verification function
- */
- if (! (tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1],
- tc_ptr->fn_arg[2], tc_ptr->errno_val))
- tst_resm(TEST_RESULT, test_msg);
- else if (tc_ptr->errno_val == EEXIST)
- do_EEXIST(tc_ptr);
- else if (tc_ptr->errno_val == ENOENT)
- do_ENOENT(tc_ptr);
- else if (tc_ptr->errno_val == ELOOP)
- do_ELOOP(tc_ptr);
- else if (tc_ptr->errno_val == ENOTDIR)
- do_ENOTDIR(tc_ptr);
- else if (tc_ptr->errno_val == EXDEV)
- do_EXDEV(tc_ptr);
- else if (tc_ptr->errno_val == ENAMETOOLONG)
- do_ENAMETOOLONG(tc_ptr);
- else if (tc_ptr->errno_val == EINVAL)
- do_EINVAL(tc_ptr);
- else
- tst_resm(TBROK, "Test Case Declaration Error");
- }
- else if (ret == 1) { /* No setup function error */
-
- if (tc_ptr->errno_val != 0)
- tst_resm(TBROK, "Test Case Declaration Error");
- else {
- /*
- * Perform test verification function
- */
- ret=(tc_ptr->ck_test)(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1],
- tc_ptr->fn_arg[2], tc_ptr->errno_val);
-
- /* Perform requested symbolic link system call test */
-
- if ((cktcsid(tc_ptr->tcid, SYMLINK)) ||
- (cktcsid(tc_ptr->tcid, LSTAT))) {
- if (ret == 1)
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- tst_resm(TEST_RESULT, test_msg);
- }
- else if (ret == 0)
- tst_resm(TEST_RESULT, test_msg);
- else if (cktcsid(tc_ptr->tcid, READLINK))
- do_readlink(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, STAT))
- do_stat(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, CHDIR))
- do_chdir(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, LINK))
- do_link(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, UNLINK))
- do_unlink(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, CHMOD))
- do_chmod(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, UTIME))
- do_utime(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, RENAME))
- do_rename(tc_ptr);
- else if (cktcsid(tc_ptr->tcid, OPEN))
- do_open(tc_ptr);
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
- }
- }
- else
- tst_resm(TBROK, "Test Case Declaration Error");
- }
- return(0);
-}
-
-/***********************************************************************
- * This routine checks for the return of EEXIST errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_EEXIST(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (cktcsid(tc_ptr->tcid, SYMLINK)) {
-
- TEST( symlink(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1]) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == EEXIST))
- if ( STD_FUNCTIONAL_TEST )
- tst_resm(TPASS, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s",
- "Expected EEXIST error when creating a symbolic link file",
- "which already existed");
- }
- else if (cktcsid(tc_ptr->tcid, MKDIR)) {
-
- TEST ( mkdir(tc_ptr->fn_arg[1],MODE) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == EEXIST))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else {
-
- tst_resm(TFAIL, "%s %s",
- "Expected EEXIST error when creating a directory by a symbolic",
- "link file which pointed at no object file");
- rmdir(tc_ptr->fn_arg[1]);
- }
- }
- else if (cktcsid(tc_ptr->tcid, OPEN)) {
-
- TEST( open(tc_ptr->fn_arg[1], (O_EXCL | O_CREAT)) )
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == EEXIST))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected EEXIST error for exclusively opening an object file",
- "through a symbolic link file was not received:",
- errno, strerror(errno));
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks for the return of ENOENT errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_ENOENT(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (cktcsid(tc_ptr->tcid, STAT)) {
-
- if ((stat(tc_ptr->fn_arg[1], &asymlink) == -1) && (errno == ENOENT))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOENT error for stating a non-existent directory",
- "through a symbolic link file was not received:",
- errno, strerror(errno));
- }
- else if (cktcsid(tc_ptr->tcid, CHDIR)) {
- if ((chdir(tc_ptr->fn_arg[1]) == -1) && (errno == ENOENT))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else {
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOENT error for changing to a non-existent",
- "directory through a symbolic link file was not received:",
- errno, strerror(errno));
- chdir(TESTDIR);
- }
- }
- else if (cktcsid(tc_ptr->tcid, LINK)) {
-
- if ((link(tc_ptr->fn_arg[1], "nick") == -1) && (errno == ENOENT))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- {
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOENT error condition when link(2) a symbolic",
- "link which pointed at no object:", errno, strerror(errno));
- delete_files("nick", NULL);
- }
- }
- else if (cktcsid(tc_ptr->tcid, CHMOD)) {
-
- if ((chmod(tc_ptr->fn_arg[1], MODE) == -1) && (errno == ENOENT))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOENT error condition when chmod(2) a symbolic",
- "link which pointed at no object,", errno, strerror(errno));
- }
- else if (cktcsid(tc_ptr->tcid, UTIME)) {
-
- if ((utime(tc_ptr->fn_arg[1], NULL) == -1) && (errno == ENOENT))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOENT error condition when utime(2) a symbolic",
- "link which pointed at no object:", errno, strerror(errno));
- }
- else if (cktcsid(tc_ptr->tcid, OPEN)) {
-
- if ((open(tc_ptr->fn_arg[1], O_RDWR) == -1) && (errno == ENOENT))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOENT error for opening a non-existent object",
- " file through a symbolic link file was not received,",
- errno, strerror(errno));
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks for the return of ELOOP errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_ELOOP(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (cktcsid(tc_ptr->tcid, STAT)) {
-
- TEST( stat(tc_ptr->fn_arg[1], &asymlink) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == ELOOP))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, "%s errno:%d %s",
- "Expected ELOOP errno from stat(2) (nested symb link),",
- errno, strerror(errno));
- else
- Tst_count++;
- }
- else if (cktcsid(tc_ptr->tcid, CHDIR)) {
-
- TEST( chdir(tc_ptr->fn_arg[1]) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == ELOOP))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else {
-
- tst_resm(TFAIL, "%s errno:%d %s",
- "Expected ELOOP error condition when chdir(2) a nested symbolic link:",
- errno, strerror(errno));
- chdir(TESTDIR);
- }
- }
- else if (cktcsid(tc_ptr->tcid, LINK)) {
-
- TEST ( link(tc_ptr->fn_arg[1], O_FILE) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == ELOOP))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s errno:%d %s",
- "Expected ELOOP error condition when link(2) a nested symbolic link:",
- errno, strerror(errno));
- }
- else if (cktcsid(tc_ptr->tcid, CHMOD)) {
-
- TEST ( chmod(tc_ptr->fn_arg[1], MODE) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == ELOOP))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s errno:%d %s",
- "Expected ELOOP error condition when chmod(2) a nested symbolic link:",
- errno, strerror(errno));
- return;
- }
- else if (cktcsid(tc_ptr->tcid, UTIME)) {
-
- TEST( utime(tc_ptr->fn_arg[1], NULL) );
- errno=TEST_ERRNO;
-
- if ((TEST_RETURN == -1) && (errno == ELOOP))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s errno:%d %s",
- "Expected ELOOP error condition when utime(2) a nested symbolic link:",
- errno, strerror(errno));
- }
- else if (cktcsid(tc_ptr->tcid, OPEN)) {
-
- int fd;
- TEST( open(tc_ptr->fn_arg[1], O_CREAT) );
- fd=TEST_RETURN;
- errno=TEST_ERRNO;
- if ((fd == -1) && (errno == ELOOP))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s errno:%d %s",
- "Expected ELOOP error condition when open(2) a nested symbolic link:",
- errno, strerror(errno));
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks for the return of ENOTDIR errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_ENOTDIR(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (cktcsid(tc_ptr->tcid, RMDIR)) {
-
- TEST( mkdir(tc_ptr->fn_arg[0], MODE) );
- errno=TEST_ERRNO;
- if (TEST_RETURN == -1)
- tst_resm(TBROK, "mkdir(2) Failure when creating %s",
- tc_ptr->fn_arg[0]);
- else if ((rmdir(tc_ptr->fn_arg[1]) == -1) && (errno == ENOTDIR)) {
-
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- rmdir(tc_ptr->fn_arg[0]);
- }
- else
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected ENOTDIR error for removing a non-existent",
- "directory through a symbolic link file was not received,",
- errno, strerror(errno));
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks for the return of EXDEV errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_EXDEV(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (cktcsid(tc_ptr->tcid, RENAME)) {
-
- TEST( rename(tc_ptr->fn_arg[1], Y_A_S_FILE) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == EXDEV)) {
- if (see_if_a_symlink(Y_A_S_FILE) == -1)
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s %s file outside of current file system",
- "rename(3) returned -1 when trying to move symbolic link file",
- "outside of current file system, but created", Y_A_S_FILE);
- }
- else {
- tst_resm(TFAIL, "%s %s errno:%d %s",
- "Expected EXDEV error for renaming an existing symbolic",
- "link file to a location outside of existing file system,",
- errno, strerror(errno));
- delete_files("/NiCkEr", NULL);
- }
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks for the return of ENAMETOOLONG errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_ENAMETOOLONG(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- int ret;
-
- if (cktcsid(tc_ptr->tcid, SYMLINK)) {
-
- TEST( symlink(tc_ptr->fn_arg[0], full_path) );
- errno=TEST_ERRNO;
- if ((TEST_RETURN == -1) && (errno == ENAMETOOLONG))
- if (see_if_a_symlink(full_path) == -1)
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s %d %s",
- "symlink(2) returned -1 when trying to create a symbolic",
- "link file whose name exceeded", (PATH_MAX+1),
- "characters, but it created the symbolic link file");
- else
- tst_resm(TFAIL,
- "Expected ENAMETOOLONG error when creating %s symbolic link file with a path exceeding %d characters: errno:%d %s",
- tc_ptr->fn_arg[1], (PATH_MAX+1), errno, strerror(errno));
- }
- else if (cktcsid(tc_ptr->tcid, READLINK)) {
-
- char scratch[PATH_MAX+1];
-
- ret=readlink(full_path, scratch, strlen(full_path));
- if (( ret == -1) && (errno == ENAMETOOLONG))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL,
- "Expected ENAMETOOLONG error when reading %s symbolic link file with a path exceeding %d characters: errno:%d %s",
- tc_ptr->fn_arg[1], (PATH_MAX+1), errno, strerror(errno));
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks for the return of EINVAL errno from requested
- * system call
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_EINVAL(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (cktcsid(tc_ptr->tcid, READLINK)) {
- TEST( readlink(tc_ptr->fn_arg[0], test_msg, BUFMAX) );
- errno=TEST_ERRNO;
- if (TEST_RETURN == -1) {
- if (errno == EINVAL) {
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- } else
- tst_resm(TFAIL, "readlink(2) ret:-1, errno:%d, : Exp errno:%d",
- errno, EINVAL);
- }
- else {
- tst_resm(TFAIL, "readlink(2) did not returned -1 when reading %s",
- "a file which is not a symbolic link file");
- }
- }
- else
- tst_resm(TBROK, "Unknown test case processing actions declared");
-}
-
-/***********************************************************************
- * This routine checks out the readlink(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_readlink(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- char scratch[PATH_MAX];
- int ret;
-
- ret=readlink(tc_ptr->fn_arg[1], scratch, strlen(tc_ptr->fn_arg[0]));
-
- /*** the TEST macro cannot be used here for some reason ****/
-
- if (ret == -1) {
- tst_resm(TFAIL,
- "readlink(2) failure on %s symbolic link file, errno=%d",
- tc_ptr->fn_arg[1], errno);
-
- }
- else if (strncmp(tc_ptr->fn_arg[0], scratch,
- strlen(tc_ptr->fn_arg[0])) != 0) {
-
- /* Must null terminate scratch because readlink(2) doesn't */
-
- scratch[strlen(tc_ptr->fn_arg[0])] = '\0';
-
- tst_resm(TFAIL,
- "readlink(2) Error : Expected %s symbolic link file contents but %s actual contents were returned",
- tc_ptr->fn_arg[0], scratch);
- }
- else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
-}
-
-/***********************************************************************
- * This routine checks out the stat(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_stat(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (statter.st_dev != asymlink.st_dev)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object device info %ld != stat of object file device info %ld",
- statter.st_dev, asymlink.st_dev);
-
- else if (statter.st_mode != asymlink.st_mode)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object file permissions %ld != stat of object file permissions %ld",
- statter.st_mode, asymlink.st_mode);
-
- else if (statter.st_nlink != asymlink.st_nlink)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object file link count %ld != stat of object file link count %ld",
- statter.st_nlink, asymlink.st_nlink);
-
- else if (statter.st_uid != asymlink.st_uid)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object file uid %ld != stat of object file uid %ld",
- statter.st_uid, asymlink.st_uid);
-
- else if (statter.st_gid != asymlink.st_gid)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object file gid %ld != stat of object file gid %ld",
- statter.st_gid, asymlink.st_gid);
-
- else if (statter.st_size != asymlink.st_size)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object file size %ld != stat of object file size %ld",
- statter.st_size, asymlink.st_size);
-
- else if (statter.st_atime != asymlink.st_atime)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object access time %ld != stat of object file access time %ld",
- statter.st_atime, asymlink.st_atime);
-
- else if (statter.st_mtime != asymlink.st_mtime)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object modify time %ld != stat of object file modify time %ld",
- statter.st_atime, asymlink.st_atime);
-
- else if (statter.st_ctime != asymlink.st_ctime)
- tst_resm(TFAIL,
- "stat of symbolic link reference to object change time %ld != stat of object file change time %ld",
- statter.st_atime, asymlink.st_atime);
- else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
-}
-
-/***********************************************************************
- * This routine checks out the chdir(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_chdir(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (mkdir(tc_ptr->fn_arg[2],MODE) == -1)
- tst_resm(TFAIL, "Could not create a setup directory file");
- else {
-
- sprintf(Buf, "mkdir(%s, %#o) was successful\n", tc_ptr->fn_arg[2],MODE);
- strcat(Buffer, Buf);
-
- if (chdir(tc_ptr->fn_arg[1]) == -1)
- tst_resm(TFAIL, "%sCould not change a directory file through a %s",
- Buffer, "symbolic link which which pointed at object");
- else {
-
- char *cwd, *getcwd();
- char expected_location[PATH_MAX];
- /*
- * Build expected current directory position
- */
- strcpy(expected_location, TESTDIR);
- strcat(expected_location, "/");
- strcat(expected_location, tc_ptr->fn_arg[2]);
-
- if ((cwd = getcwd((char *)NULL, 64)) == NULL)
- tst_resm(TFAIL, "getcwd(3) FAILURE");
- else if (strcmp(cwd, expected_location) == 0)
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else {
- tst_resm(TFAIL, "%s%s %s %s not equal to expected %s", Buffer,
- "chdir(2) returned successfully, but getcwd(3) indicated",
- "new current working directory location", cwd, expected_location);
- }
- chdir(TESTDIR);
- }
- rmdir(tc_ptr->fn_arg[2]);
- }
-}
-
-/***********************************************************************
- * This routine checks out the link(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_link(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- struct stat stbuf;
-
- if (link(tc_ptr->fn_arg[1], "nick") == -1) {
- tst_resm(TFAIL, "%slink(%s, \"nick\") failed, errno: %d\n%s %s",
- Buffer, tc_ptr->fn_arg[1], errno,
- "link of new file to object file via symbolic link file failed",
- "when expected not to");
- }
- else {
- sprintf(Buf, "link(%s, \"nick\") was successful\n", tc_ptr->fn_arg[1]);
- strcat(Buffer, Buf);
-
- if ( STD_FUNCTIONAL_TEST ) {
- /*
- * Check that links counts were properly set
- */
- if (lstat(tc_ptr->fn_arg[1], &asymlink) == -1) {
- tst_resm(TBROK, "lstat(%s) failed. errno: %d",
- tc_ptr->fn_arg[1], errno);
-
- } else if (lstat("nick", &statter) == -1) {
- tst_resm(TBROK, "lstat(nick) failed, errno:%d", errno);
- } else {
- if (statter.st_ino == asymlink.st_ino) {
- if ((statter.st_nlink ==2) && (asymlink.st_nlink == 2)) {
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- } else {
- lstat(tc_ptr->fn_arg[2], &stbuf);
-
- tst_resm(TFAIL,
- "%slink(%s, %s) failed to adjust link count.\n\
- count for nick is %d, count for %s is %d, count for %s is %d.",
- Buffer, tc_ptr->fn_arg[1], "nick",
- statter.st_nlink, tc_ptr->fn_arg[1], asymlink.st_nlink,
- tc_ptr->fn_arg[2], stbuf.st_nlink);
- }
- } else {
- tst_resm(TFAIL,
- "%sA lstat of %s (ino:%d) and of\n\t\t\
-%s (ino:%d), does not show them being the same ino.", Buffer,
- tc_ptr->fn_arg[1], asymlink.st_ino, "nick", statter.st_ino);
- }
- }
- }
- delete_files("nick", NULL);
- }
-}
-
-/***********************************************************************
- * This routine checks out the unlink(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_unlink(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (stat(tc_ptr->fn_arg[2], &asymlink) == -1)
- tst_resm(TBROK,
- "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]);
- else if (unlink(tc_ptr->fn_arg[1]) == -1)
- tst_resm(TFAIL, "unlink(2) failed when removing symbolic link file");
- else {
- sprintf(Buf, "unlink(%s) was successful\n", tc_ptr->fn_arg[1]);
- strcat(Buffer, Buf);
- if (stat(tc_ptr->fn_arg[2], &statter) == -1)
- tst_resm(TFAIL,"%s %s",
- "unlink(2) failed because it not only removed symbolic link",
- "file which pointed at object file, but object file as well");
-
- else
- if ((statter.st_ino == asymlink.st_ino) &&
- (statter.st_dev == asymlink.st_dev) &&
- (statter.st_size == asymlink.st_size))
-
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s%s %s %s", Buffer,
- "unlink(2) failed because it not only removed symbolic link",
- "file which pointed at object file, but it changed object",
- "file inode information");
- }
-
-}
-
-/***********************************************************************
- * This routine checks out the chmod(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_chmod(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- if (stat(tc_ptr->fn_arg[2], &asymlink) == -1)
- tst_resm(TBROK,
- "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]);
- else if (chmod(tc_ptr->fn_arg[1], (MODE | MASK)) == -1)
- tst_resm(TFAIL, "%s%s %s", Buffer,
- "chmod(2) failed when changing file permission",
- "through symbolic link file");
- else {
- sprintf(Buf, "chmod(%s, %#o) was successful\n", tc_ptr->fn_arg[1],
- (MODE | MASK));
- strcat(Buffer, Buf);
-
- if (stat(tc_ptr->fn_arg[2], &statter) == -1)
- tst_resm(TBROK,
- "stat(2) Failure when accessing %s object file", tc_ptr->fn_arg[2]);
- else
- if ((statter.st_mode == (MODE | MASK)) &&
- (statter.st_mode != asymlink.st_mode))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s%s %o to %o %s", Buffer,
- "chmod(2) failed to change object file permissions from",
- asymlink.st_mode, (MODE | MASK),
- "through symbolic link file");
- }
-
-}
-
-/***********************************************************************
- * This routine checks out the utime(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_utime(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- struct utimbuf utimes;
-
- if (stat(tc_ptr->fn_arg[2], &asymlink) == -1)
- tst_resm(TBROK, "stat(2) Failure when accessing %s object file",
- tc_ptr->fn_arg[2]);
- else {
- /* Now add a few values to access and modify times */
-
- utimes.actime = asymlink.st_atime + a_time_value;
- utimes.modtime = asymlink.st_mtime + a_time_value;
-
- /* Now hand off to utime(2) via symbolic link file*/
-
- if (utime(tc_ptr->fn_arg[1], &utimes) == -1)
- tst_resm(TFAIL, "%s %s",
- "utime(2) failed to process object file access and modify",
- "time updates through symbolic link");
- else {
- /* Now verify changes were made */
-
- if (stat(tc_ptr->fn_arg[2], &statter) == -1)
- tst_resm(TBROK,
- "stat(2) Failure when accessing %s object file",
- tc_ptr->fn_arg[2]);
- else {
- time_t temp, diff;
-
- temp = statter.st_atime - asymlink.st_atime;
- diff = (statter.st_mtime - asymlink.st_mtime) - temp;
-
- if (! diff)
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, "%s %s %d greater than original times",
- "utime(2) failed to change object file access and",
- "modify times through symbolic link to a value",
- a_time_value);
- }
- }
- }
-}
-
-/***********************************************************************
- * This routine checks out the rename(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_rename(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- int pts_at_object = 0;
-
-
- if (stat(tc_ptr->fn_arg[2], &statter) != -1)
- pts_at_object=1;
-
- TEST (rename(tc_ptr->fn_arg[1], A_S_FILE) );
- errno=TEST_ERRNO;
- if (TEST_RETURN == -1)
- tst_resm(TFAIL, "rename(3) failed to rename %s symbolic link file to %s",
- tc_ptr->fn_arg[2], A_S_FILE);
- else if (pts_at_object)
- if (ck_both(tc_ptr->fn_arg[0], A_S_FILE, tc_ptr->fn_arg[2]))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, test_msg);
- else if ( ! ck_symlink(tc_ptr->fn_arg[0], A_S_FILE, NULL))
- tst_resm(TFAIL, test_msg);
- else if (stat(tc_ptr->fn_arg[1], &asymlink) != -1)
- tst_resm(TFAIL,
- "rename(3) did not remove %s when renaming to %s",
- tc_ptr->fn_arg[1], A_S_FILE);
- else if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
-}
-
-/***********************************************************************
- * This routine checks out the open(2) system call for a successful
- * invocation
- *
- * Argument is pointer to test_objects array of structures of type
- * all_test_cases
- ***********************************************************************/
-void
-do_open(tc_ptr)
-struct all_test_cases *tc_ptr;
-{
- int fd = -1;
- int ret, pts_at_object = 0;
- char scratch[PATH_MAX];
-
-
- if (stat(tc_ptr->fn_arg[2], &statter) != -1)
- pts_at_object=1;
-
- if (pts_at_object) {
- TEST( open(tc_ptr->fn_arg[1], O_RDWR) );
- errno=TEST_ERRNO;
- if ((fd=TEST_RETURN) == -1) {
- tst_resm(TFAIL,
- "open(2) Failure when opening object file through symbolic link file");
- return;
- }
- }
- else {
- TEST(open(tc_ptr->fn_arg[1], (O_CREAT | O_RDWR), MODE) );
- errno=TEST_ERRNO;
- if ((fd=TEST_RETURN) == -1) {
- tst_resm(TFAIL,
- "open(2) Failure when creating object file through symbolic link file");
- return;
- }
- }
- if ((ret=write(fd, BIG_STRING, strlen(BIG_STRING))) == -1) {
- tst_resm(TFAIL,
- "write(2) Failure to object file opened through a symbolic link file: errno:%d",
- errno);
- }
- else if (ret != strlen(BIG_STRING)) {
- tst_resm(TFAIL,
- "write(2) Failed to write %d bytes to object file opened through a symbolic link file",
- strlen(BIG_STRING));
- }
- else if (lseek(fd, 0L, 0) == -1) {
- tst_resm(TFAIL,
- "lseek(2) Failed to position to beginning of object file opened through a symbolic link file: errno = %d",
- errno);
- }
- else if ((ret=read(fd, scratch, strlen(BIG_STRING))) == -1) {
- tst_resm(TFAIL,
- "read(2) Failure of object file opened through a symbolic link file: errno = %d",
- errno);
- }
- else if (ret != strlen(BIG_STRING)) {
- tst_resm(TFAIL,
- "read(2) Failed to read %d bytes to object file opened through a symbolic link file",
- strlen(BIG_STRING));
- }
- else if (strncmp(BIG_STRING, scratch, strlen(BIG_STRING)) != 0) {
- tst_resm(TFAIL,
- "Content of write(2) and read(2) Failed to object file through symbolic link file was not as expected. Expected %s and read returned %s",
- BIG_STRING, scratch);
- }
- else {
- /*
- * Close off symbolic link file to object file access
- */
- if (close(fd) == -1) {
- tst_resm(TFAIL,
- "close(2) Failure when closing object file accessed symbolic link file");
- }
- /*
- * Now, lets open up and read object file and compare contents
- */
- else if ((fd=open(tc_ptr->fn_arg[0], O_RDONLY)) == -1) {
- tst_resm(TFAIL, "open(2) Failure when opening %s file: errno:%d %s",
- tc_ptr->fn_arg[0], errno, strerror(errno));
- }
- else if ((ret=read(fd, scratch, strlen(BIG_STRING))) == -1) {
- tst_resm(TFAIL,
- "read(2) Failure of object file opened through a symbolic link file: errno:%d", errno);
- }
- else if (ret != strlen(BIG_STRING)) {
- tst_resm(TFAIL,
- "read(2) Failed to read %d bytes to object file opened through a symbolic link file",
- strlen(BIG_STRING));
- }
- else if (strncmp(BIG_STRING, scratch, strlen(BIG_STRING)) != 0) {
- tst_resm(TFAIL,
- "Content of write(2) and read(2) Failed to object file through symbolic link file was not as expected. Expected %s and read returned %s",
- BIG_STRING, scratch);
- }
- else if (pts_at_object) {
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- }
- else { /* Insure newly created object file is pointed at */
- if (ck_both(tc_ptr->fn_arg[0], tc_ptr->fn_arg[1], tc_ptr->fn_arg[0]))
- if ( TEST_RESULT != TPASS || STD_FUNCTIONAL_TEST )
- tst_resm(TEST_RESULT, msgs[tc_ptr->pass_msg]);
- else
- Tst_count++;
- else
- tst_resm(TFAIL, test_msg);
- }
- close(fd);
- }
-}
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* create a temporary directory and go to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- */
- TEST_CLEANUP;
-
- /* remove temporary directory and all files in it. */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-
-/*
- *
- */
-void help()
-{
- int ind;
-
- printf(" -T id Determines which tests cases to execute:\n");
-
- for (ind=0; ind<sizeof(all_tcses)/sizeof(struct tcses ); ind++) {
- printf(" %s/%s - %s\n", all_tcses[ind].tcid, all_tcses[ind].syscall,
- all_tcses[ind].desc);
- }
-}
diff --git a/winsup/testsuite/winsup.api/ltp/symlink02.c b/winsup/testsuite/winsup.api/ltp/symlink02.c
deleted file mode 100644
index 9fbecf202..000000000
--- a/winsup/testsuite/winsup.api/ltp/symlink02.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : symlink02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for symlink(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) symlink(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the symlink(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * symlink(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="symlink02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255], symlnk[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call symlink(2)
- */
- TEST(symlink(fname, symlnk));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "symlink(%s, %s) Failed, errno=%d : %s",
- fname, symlnk, TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "symlink(%s, %s) returned %d",
- fname, symlnk, TEST_RETURN);
- }
- if (unlink(symlnk) == -1) {
- tst_brkm(TBROK, cleanup,
- "unlink(%s) Failed, errno=%d : %s",
- symlnk, errno, strerror(errno));
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- if (close(fd) == -1 ) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- sprintf(symlnk,"st_%d",getpid());
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/sync01.c b/winsup/testsuite/winsup.api/ltp/sync01.c
deleted file mode 100644
index a32b24ba8..000000000
--- a/winsup/testsuite/winsup.api/ltp/sync01.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : sync01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for sync(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) sync(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the sync(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * sync(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="sync01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call sync(2)
- */
- TEST_VOID(sync());
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "sync() Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "sync() returned %d", TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/time01.c b/winsup/testsuite/winsup.api/ltp/time01.c
deleted file mode 100644
index 570dedc6b..000000000
--- a/winsup/testsuite/winsup.api/ltp/time01.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : time01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for time(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) time(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the time(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * time(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <time.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="time01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call time(2)
- */
- TEST(time(0));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "time(0) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "time(0) returned %d", TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- void trapper();
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/times01.c b/winsup/testsuite/winsup.api/ltp/times01.c
deleted file mode 100644
index 0d8d1d0ca..000000000
--- a/winsup/testsuite/winsup.api/ltp/times01.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : times01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for times(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) times(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the times(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * times(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/times.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="times01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-struct tms mytimes;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call times(2)
- */
- TEST(times(&mytimes));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "times(&mytimes) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "times(&mytimes) returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- void trapper();
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/ulimit01.c b/winsup/testsuite/winsup.api/ltp/ulimit01.c
deleted file mode 100644
index 655c9e32e..000000000
--- a/winsup/testsuite/winsup.api/ltp/ulimit01.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : ulimit01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for ulimit(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 6
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) ulimit(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * The libcuts.a and libsys.a libraries must be included in
- * the compilation of this test.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the ulimit(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * ulimit(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <ulimit.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-
-char *TCID="ulimit01"; /* Test program identifier. */
-int TST_TOTAL=6; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int cmd;
-long limit; /* saved limit */
-
-struct limits_t {
- int cmd;
- long newlimit;
- int nlim_flag; /* special flag for UL_SETFSIZE records */
- int exp_fail;
-} Scenarios[] = {
-
- { UL_GETFSIZE, -1, 0, 0 },
- { UL_SETFSIZE, -1, 0, 1 }, /* negative test */
- { UL_SETFSIZE, -2, 1, 0 }, /* case case: must be after UL_GETFSIZE */
- { UL_SETFSIZE, -2, 2, 0 }, /* case case: must be after UL_GETFSIZE */
-
-#if UL_GMEMLIM
- { UL_GMEMLIM, -1, 0, 0 },
-#endif
-#if UL_GDESLIM
- { UL_GDESLIM, -1, 0, 0 },
-#endif
-#if UL_GSHMEMLIM
- { UL_GSHMEMLIM, -1, 0, 0 },
-#endif
-
-};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- int i; /* inner loop (test case) counter */
- const char *msg; /* message returned from parse_opts */
- int tmp;
-
- TST_TOTAL = sizeof(Scenarios)/sizeof(struct limits_t);
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- for ( i=0; i<TST_TOTAL; i++) {
-
- cmd=Scenarios[i].cmd;
- limit=Scenarios[i].newlimit;
-
- /*
- * Call ulimit(2)
- */
- TEST(ulimit(cmd, limit));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( Scenarios[i].exp_fail ) {
- if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS, "ulimit(%d, %d) Failed, errno=%d : %s", cmd, limit,
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- } else {
- tst_resm(TFAIL, "ulimit(%d, %d) Failed, errno=%d : %s", cmd, limit,
- TEST_ERRNO, strerror(TEST_ERRNO));
- }
- } else {
- if ( Scenarios[i].exp_fail ) {
- tst_resm(TFAIL, "ulimit(%d, %d) returned %d",
- cmd, limit, TEST_RETURN);
- } else if ( STD_FUNCTIONAL_TEST ) {
- tst_resm(TPASS, "ulimit(%d, %d) returned %d",
- cmd, limit, TEST_RETURN);
- }
-
- /*
- * Save the UL_GETFSIZE return value in the newlimit field
- * for UL_SETFSIZE test cases.
- */
- if ( cmd == UL_GETFSIZE ) {
- for (tmp=i+1; tmp<TST_TOTAL; tmp++) {
- if ( Scenarios[tmp].nlim_flag == 1 ) {
- Scenarios[tmp].newlimit = TEST_RETURN;
- }
- if ( Scenarios[tmp].nlim_flag == 2 ) {
- Scenarios[tmp].newlimit = TEST_RETURN-1;
- }
- }
- }
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/umask01.c b/winsup/testsuite/winsup.api/ltp/umask01.c
deleted file mode 100644
index 04b385145..000000000
--- a/winsup/testsuite/winsup.api/ltp/umask01.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : umask01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for umask(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) umask(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the umask(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * umask(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="umask01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call umask(2)
- */
- TEST(umask(022));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "umask(022) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "umask(022) returned %d", TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- void trapper();
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/uname01.c b/winsup/testsuite/winsup.api/ltp/uname01.c
deleted file mode 100644
index e2f8f8b0c..000000000
--- a/winsup/testsuite/winsup.api/ltp/uname01.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : uname01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for uname(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) uname(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the uname(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * uname(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/utsname.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="uname01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-struct utsname un;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call uname(2)
- */
- TEST(uname(&un));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "uname(&un) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "uname(&un) returned %d", TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- void trapper();
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
diff --git a/winsup/testsuite/winsup.api/ltp/unlink05.c b/winsup/testsuite/winsup.api/ltp/unlink05.c
deleted file mode 100644
index 63e97df89..000000000
--- a/winsup/testsuite/winsup.api/ltp/unlink05.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : unlink05
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for unlink(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) unlink(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the unlink(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * unlink(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-void create_file();
-
-
-
-char *TCID="unlink05"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call unlink(2)
- */
- TEST(unlink(fname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "unlink(%s) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "unlink(%s) returned %d", fname, TEST_RETURN);
- }
- /* recreate file for next loop */
- create_file();
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- create_file();
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-void
-create_file()
-{
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-}
diff --git a/winsup/testsuite/winsup.api/ltp/unlink06.c b/winsup/testsuite/winsup.api/ltp/unlink06.c
deleted file mode 100644
index 3d0690383..000000000
--- a/winsup/testsuite/winsup.api/ltp/unlink06.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : unlink06
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : unlink(2) of a FIFO
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 03/30/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) unlink(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the unlink(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * unlink(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void create_file();
-void cleanup();
-
-
-char *TCID="unlink06"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char Fname[255];
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- create_file();
-
- /*
- * Call unlink(2)
- */
- TEST(unlink(Fname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "unlink(%s) Failed, errno=%d : %s", Fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else if ( STD_FUNCTIONAL_TEST ) {
- if ( access(Fname, F_OK) != -1 ) {
- tst_resm(TFAIL,
- "unlink(%s) returned %d, but access says file still exists.",
- Fname, TEST_RETURN);
- }
- else {
- tst_resm(TPASS, "unlink(%s) returned %d", Fname, TEST_RETURN);
- }
- }
- else
- Tst_count++;
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- sprintf(Fname, "fifo_unlink%d", getpid());
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-/******************************************************************
- *
- ******************************************************************/
-void
-create_file()
-{
- if(mkfifo(Fname, 0777) == -1) {
- tst_brkm(TBROK, cleanup,
- "mkfifo(%s, 0777) failed errno:%d %s\n", Fname,
- errno, strerror(errno));
- }
-}
diff --git a/winsup/testsuite/winsup.api/ltp/unlink07.c b/winsup/testsuite/winsup.api/ltp/unlink07.c
deleted file mode 100644
index 889b60959..000000000
--- a/winsup/testsuite/winsup.api/ltp/unlink07.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : unlink07
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : unlink(2) negative testcases
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : Richard Logan
- *
- * CO-PILOT : William Roske
- *
- * DATE STARTED : 03/30/94
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1-8) See Testcases structure below.
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the unlink(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * unlink(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/param.h> /* for PATH_MAX */
-#include "test.h"
-#include "usctest.h"
-
-void setup();
-void cleanup();
-
-
-extern char *get_high_address();
-
-char *TCID="unlink07"; /* Test program identifier. */
-int TST_TOTAL=6; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int longpath_setup();
-int no_setup();
-int filepath_setup();
-char Longpathname[PATH_MAX+2];
-char High_address[64];
-
-struct test_case_t {
- char *pathname;
- char *desc;
- int exp_errno;
- int (*setupfunc)();
-} Test_cases[] = {
- { "nonexistfile", "non-existent file", ENOENT, no_setup},
- { "", "path is empty string", ENOENT, no_setup},
- { "nefile/file", "path contains a non-existent file",
- ENOENT, no_setup },
- { High_address, "address beyond address space", EFAULT, no_setup },
-#ifndef __CYGWIN__
- { "file/file", "path contains a regular file",
- ENOTDIR, filepath_setup },
-#endif
- { High_address, "address beyond address space", EFAULT, no_setup },
- { Longpathname, "pathname too long", ENAMETOOLONG, longpath_setup },
- { (char *)-1, "negative address", EFAULT, no_setup },
- { NULL, NULL, 0, no_setup }
-};
-
-/***********************************************************************
- * Main
- ***********************************************************************/
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
- char *fname;
- char *desc;
- int ind;
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
-
- for (ind=0; Test_cases[ind].desc != NULL; ind++ ) {
-
- fname = Test_cases[ind].pathname;
- desc = Test_cases[ind].desc;
-
- if ( fname == High_address )
- fname = get_high_address();
-
- /*
- * Call unlink(2)
- */
- TEST(unlink(fname));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- if ( STD_FUNCTIONAL_TEST ) {
- if ( TEST_ERRNO == Test_cases[ind].exp_errno )
- tst_resm(TPASS, "unlink(<%s>) Failed, errno=%d",
- desc, TEST_ERRNO);
- else
- tst_resm(TFAIL,
- "unlink(<%s>) Failed, errno=%d, expected errno:%d",
- desc, TEST_ERRNO, Test_cases[ind].exp_errno);
- }
- else
- Tst_count++;
- } else {
- tst_resm(TFAIL,
- "unlink(<%s>) returned %d, expected -1, errno:%d",
- desc, TEST_RETURN, Test_cases[ind].exp_errno);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- int ind;
-
- /* capture signals */
- tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- for (ind=0; Test_cases[ind].desc != NULL; ind++ ) {
- Test_cases[ind].setupfunc();
- }
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- chmod("unwrite_dir", 0777);
- chmod("unsearch_dir", 0777);
-
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-
-} /* End cleanup() */
-
-/******************************************************************
- *
- ******************************************************************/
-int
-no_setup()
-{
- return 0;
-}
-
-/******************************************************************
- *
- ******************************************************************/
-int
-longpath_setup()
-{
- int ind;
-
- for(ind=0; ind<= PATH_MAX+1; ind++) {
- Longpathname[ind] = 'a';
- }
- return 0;
-
-}
-/******************************************************************
- *
- ******************************************************************/
-int
-filepath_setup()
-{
- int fd;
-
- if ( (fd=creat("file", 0777)) == -1 ) {
- tst_brkm(TBROK, cleanup, "creat(file) failed, errno:%d %s",
- errno, strerror(errno));
- }
- close(fd);
- return 0;
-}
-
diff --git a/winsup/testsuite/winsup.api/ltp/wait02.c b/winsup/testsuite/winsup.api/ltp/wait02.c
deleted file mode 100644
index 8b4f41b09..000000000
--- a/winsup/testsuite/winsup.api/ltp/wait02.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : wait02
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for wait(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) wait(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the wait(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * wait(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="wait02"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-int fork_pid, ret_code;
-void trapper();
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL )
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /* create a child to wait for */
- if ((fork_pid=fork()) == -1) {
- tst_brkm(TBROK, cleanup, "fork() Failure. errno=%d : %s", errno, strerror(errno));
- } else if (fork_pid == 0) {
- /* Child, sleep a second then exit */
- sleep(1);
- exit(1);
- }
-
- /* Parent, wait for child to die */
- TEST(wait(&ret_code));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "wait(1) Failed, errno=%d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "wait(&ret_code) returned %d", TEST_RETURN);
- }
- }
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/ltp/write01.c b/winsup/testsuite/winsup.api/ltp/write01.c
deleted file mode 100644
index 0fae9aea1..000000000
--- a/winsup/testsuite/winsup.api/ltp/write01.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
- *
- */
-/* $Id$ */
-/**********************************************************
- *
- * OS Test - Silicon Graphics, Inc.
- *
- * TEST IDENTIFIER : write01
- *
- * EXECUTED BY : anyone
- *
- * TEST TITLE : Basic test for write(2)
- *
- * PARENT DOCUMENT : usctpl01
- *
- * TEST CASE TOTAL : 1
- *
- * WALL CLOCK TIME : 1
- *
- * CPU TYPES : ALL
- *
- * AUTHOR : William Roske
- *
- * CO-PILOT : Dave Fenner
- *
- * DATE STARTED : 03/30/92
- *
- * INITIAL RELEASE : UNICOS 7.0
- *
- * TEST CASES
- *
- * 1.) write(2) returns...(See Description)
- *
- * INPUT SPECIFICATIONS
- * The standard options for system call tests are accepted.
- * (See the parse_opts(3) man page).
- *
- * OUTPUT SPECIFICATIONS
- *
- * DURATION
- * Terminates - with frequency and infinite modes.
- *
- * SIGNALS
- * Uses SIGUSR1 to pause before test if option set.
- * (See the parse_opts(3) man page).
- *
- * RESOURCES
- * None
- *
- * ENVIRONMENTAL NEEDS
- * No run-time environmental needs.
- *
- * SPECIAL PROCEDURAL REQUIREMENTS
- * None
- *
- * INTERCASE DEPENDENCIES
- * None
- *
- * DETAILED DESCRIPTION
- * This is a Phase I test for the write(2) system call. It is intended
- * to provide a limited exposure of the system call, for now. It
- * should/will be extended when full functional tests are written for
- * write(2).
- *
- * Setup:
- * Setup signal handling.
- * Pause for SIGUSR1 if option specified.
- *
- * Test:
- * Loop if the proper options are given.
- * Execute system call
- * Check return code, if system call failed (return=-1)
- * Log the errno and Issue a FAIL message.
- * Otherwise, Issue a PASS message.
- *
- * Cleanup:
- * Print errno log and/or timing stats if options given
- *
- * UPDATE HISTORY
- * user date description
- * ------------------------------------------------------
- * wermager 3/00 Switched sequence of calls to TEST_PAUSE
- * and tst_tmpdir() in setup().
- *
- *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include "test.h"
-#include "usctest.h"
-
-extern void setup();
-extern void cleanup();
-
-
-
-char *TCID="write01"; /* Test program identifier. */
-int TST_TOTAL=1; /* Total number of test cases. */
-extern int Tst_count; /* Test Case counter for tst_* routines */
-
-int exp_enos[]={0, 0};
-
-char fname[255];
-int fd;
-char buf = 'w';
-
-int
-main(int ac, char **av)
-{
- int lc; /* loop counter */
- const char *msg; /* message returned from parse_opts */
-
- /***************************************************************
- * parse standard options
- ***************************************************************/
- if ( (msg=parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL ) {
- tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- /***************************************************************
- * perform global setup for test
- ***************************************************************/
- setup();
-
- /* set the expected errnos... */
- TEST_EXP_ENOS(exp_enos);
-
- /***************************************************************
- * check looping state if -c option given
- ***************************************************************/
- for (lc=0; TEST_LOOPING(lc); lc++) {
-
- /* reset Tst_count in case we are looping. */
- Tst_count=0;
-
- /*
- * Call write(2)
- */
- TEST(write(fd, &buf, 1));
-
- /* check return code */
- if ( TEST_RETURN == -1 ) {
- TEST_ERROR_LOG(TEST_ERRNO);
- tst_resm(TFAIL, "write(%s, F_CLRALF, 1) Failed, errno=%d : %s", fname,
- TEST_ERRNO, strerror(TEST_ERRNO));
- } else {
- /***************************************************************
- * only perform functional verification if flag set (-f not given)
- ***************************************************************/
- if ( STD_FUNCTIONAL_TEST ) {
- /* No Verification test, yet... */
- tst_resm(TPASS, "write(%s, F_CLRALF, 1) returned %d", fname, TEST_RETURN);
- }
- }
-
- } /* End for TEST_LOOPING */
-
- /***************************************************************
- * cleanup and exit
- ***************************************************************/
- cleanup();
-
- return 0;
-} /* End main */
-
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- ***************************************************************/
-void
-setup()
-{
- /* capture signals */
- tst_sig(FORK, DEF_HANDLER, cleanup);
-
-
- /* Pause if that option was specified */
- TEST_PAUSE;
-
- /* make a temp directory and cd to it */
- tst_tmpdir();
-
- sprintf(fname,"tfile_%d",getpid());
- if ((fd = open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-} /* End setup() */
-
-
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ***************************************************************/
-void
-cleanup()
-{
- /*
- * print timing stats if that option was specified.
- * print errno log if that option was specified.
- */
- TEST_CLEANUP;
-
- /* close the file we have open */
- if (close(fd) == -1) {
- tst_resm(TWARN, "close(%s) Failed, errno=%d : %s", fname, errno, strerror(errno));
- }
-
- /* Remove tmp dir and all files in it */
- tst_rmdir();
-
- /* exit with return code appropriate for results */
- tst_exit();
-} /* End cleanup() */
-
-
diff --git a/winsup/testsuite/winsup.api/mmaptest01.c b/winsup/testsuite/winsup.api/mmaptest01.c
deleted file mode 100644
index b400db7f4..000000000
--- a/winsup/testsuite/winsup.api/mmaptest01.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- Copyright 2001 Free Software Foundation, Inc.
- Written by Michael Chastain, <chastain@redhat.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- This program demonstrates a bug in cygwin's mmap.
- I open one file, mmap it, and close it.
- I open a different file, mmap it, and close it.
-
- The second file re-uses the file handle (which is OK),
- but then it re-uses the buffer as well! Ouch!
-
- This bug occurs on cygwin1.dll dated 2001-01-31.
- It causes gnu cpp to screw up its include file buffers.
-
- Compile with "gcc -o y1 y1.c".
-
- Output from a bad cygwin1.dll:
-
- y1.txt: 3 0x4660000 y1 y1 y1 y1 y1 y1 y1
- y2.txt: 3 0x4660000 y1 y1 y1 y1 y1 y1 y1
-
- Output from a good cygwin1.dll:
-
- y1.txt: 3 0x14060000 y1 y1 y1 y1 y1 y1 y1
- y2.txt: 3 0x14070000 y2 y2 y2 y2 y2 y2 y2
-
- Output from Red Hat Linux 7:
-
- y1.txt: 3 0x40017000 y1 y1 y1 y1 y1 y1 y1
- y2.txt: 3 0x40018000 y2 y2 y2 y2 y2 y2 y2
- */
-
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/* some systems have O_BINARY and some do not */
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-/* filler for file 1 */
-char const line1 [] = "y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1\n";
-#define size1 (sizeof(line1) - 1)
-#define count1 ((4096 / size1) + 1)
-
-/* filler for file 2 */
-char const line2 [] = "y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2 y2\n";
-#define size2 (sizeof(line2) - 1)
-#define count2 ((4096 / size2) + 1)
-
-int main ()
-{
- int fd1;
- char * buf1;
-
- int fd2;
- char * buf2;
-
- int i;
-
- /* create file 1 */
- fd1 = open ("y1.txt", O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);
- for (i = 0; i < count1; i++)
- write (fd1, line1, size1);
- close (fd1);
-
- /* create file 2 */
- fd2 = open ("y2.txt", O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);
- for (i = 0; i < count2; i++)
- write (fd2, line2, size2);
- close (fd2);
-
- /* mmap file 1 */
- fd1 = open ("y1.txt", O_RDONLY | O_BINARY, 0644);
- buf1 = mmap (0, 4096, PROT_READ, MAP_PRIVATE, fd1, 0);
- close (fd1);
-
- /* mmap file 2 */
- fd2 = open ("y2.txt", O_RDONLY | O_BINARY, 0644);
- buf2 = mmap (0, 4096, PROT_READ, MAP_PRIVATE, fd2, 0);
- close (fd2);
-
- /* the buffers have to be different */
- if (buf1 == buf2 || !memcmp (buf1, buf2, 20))
- return 1;
-
- return 0;
-}
-
diff --git a/winsup/testsuite/winsup.api/mmaptest02.c b/winsup/testsuite/winsup.api/mmaptest02.c
deleted file mode 100644
index 3e7b92997..000000000
--- a/winsup/testsuite/winsup.api/mmaptest02.c
+++ /dev/null
@@ -1,189 +0,0 @@
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-
-sigset_t unblock_sigsegv;
-jmp_buf r;
-size_t pg;
-
-int fd;
-
-/* Checks behaviour of anonymous mmap.
-
- test_1: If we map a 2-page region and unmap its second page, the first page
- must remain.
-
- test_2: If we map a 2-page region and unmap its first page, the second
- page must remain.
-
- test_3: If we map two consecutive 1-page regions and unmap them both with
- one munmap, both must go away.
-*/
-
-void
-perror_exit (char *str, int code)
-{
- perror (str);
- exit (code);
-}
-
-void
-anonmap_init ()
-{
- sigemptyset (&unblock_sigsegv);
- sigaddset (&unblock_sigsegv, SIGSEGV);
- pg = getpagesize ();
- fd = open ("/dev/zero", O_RDWR);
-}
-
-char *
-anonmap (size_t size)
-{
- return (char *) mmap (0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
-}
-
-void
-anonfree (char *loc, size_t size)
-{
- munmap (loc, size);
-}
-
-void
-sigsegv (int unused)
-{
- sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
- longjmp (r, 1);
-}
-
-int
-compare_pointers (const void *a, const void *b)
-{
- const char *x = *(const char *const *)a;
- const char *y = *(const char *const *)b;
-
- if (x > y)
- return 1;
- if (x < y)
- return -1;
- return 0;
-}
-
-void
-test_1 ()
-{
- char *x = anonmap (pg * 2);
- if (x == (char *)MAP_FAILED)
- perror_exit ("test 1 mmap", 1);
-
- signal (SIGSEGV, sigsegv);
- if (setjmp (r))
- perror_exit ("test 1 fault", 2);
-
- x[0] = 1;
- x[pg] = 1;
-
- anonfree (x + pg, pg);
- x[0] = 2;
-
- if (setjmp (r) == 0)
- {
- x[pg] = 1;
- perror_exit ("test 1 no fault", 3);
- }
-}
-
-void
-test_2 ()
-{
- char *x = anonmap (pg * 2);
- if (x == (char *)MAP_FAILED)
- perror_exit ("test 2 mmap", 4);
-
- signal (SIGSEGV, sigsegv);
- if (setjmp (r))
- perror_exit ("test 2 fault", 5);
-
- x[0] = 1;
- x[pg] = 1;
-
- anonfree (x, pg);
- x[pg] = 2;
-
- if (setjmp (r) == 0)
- {
- x[0] = 1;
- perror_exit ("test 2 no fault", 6);
- }
-}
-
-void
-test_3 ()
-{
- char *x[10];
- char *y;
- int i;
-
- /* There's no way to guarantee we get consecutive pages from the OS. The
- approach taken here is to allocate ten of them, sort the list, and
- look for consecutive pages. */
- for (i = 0; i < 10; i++)
- {
- x[i] = anonmap (pg);
- if (x[i] == (char *)MAP_FAILED)
- perror_exit ("test 3 mmap 1", 7);
- }
- qsort (x, 10, sizeof (char *), compare_pointers);
-
- y = 0;
- for (i = 0; i < 9; i++)
- if (x[i] + pg == x[i+1])
- {
- y = x[i];
- break;
- }
- if (y == 0)
- {
- fputs ("test 3: couldn't get two consecutive pages, giving up\n", stderr);
- exit (65);
- }
-
- signal (SIGSEGV, sigsegv);
- if (setjmp (r))
- perror_exit ("test 3 fault", 8);
-
- y[0] = 1;
- y[pg] = 1;
-
- anonfree (y, pg * 2);
-
- if (setjmp (r) == 0)
- {
- y[0] = 1;
- perror_exit ("test 3 no fault 1", 9);
- }
-
- signal (SIGSEGV, sigsegv);
- if (setjmp (r) == 0)
- {
- y[pg] = 1;
- perror_exit ("test 3 no fault 2", 10);
- }
-}
-
-int
-main ()
-{
- anonmap_init();
-
- test_1();
- test_2();
- test_3();
-
- exit(0);
-}
diff --git a/winsup/testsuite/winsup.api/mmaptest03.c b/winsup/testsuite/winsup.api/mmaptest03.c
deleted file mode 100644
index 6cff97106..000000000
--- a/winsup/testsuite/winsup.api/mmaptest03.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <setjmp.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-/* - Checks if mapping of already closed file survives fork()
- - Checks if mapping the same region of the same file twice
- is done correctly.
-*/
-
-sigset_t unblock_sigsegv;
-jmp_buf r;
-
-/* filler for file */
-char const line[] = "y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1 y1";
-
-void
-perror_exit (char *str)
-{
- perror (str);
- exit (1);
-}
-
-void
-sigsegv (int unused)
-{
- sigprocmask (SIG_UNBLOCK, &unblock_sigsegv, 0);
- longjmp (r, 1);
-}
-
-int
-main(int argc, char **argv)
-{
- int i, fd, status;
- struct stat statbuf;
- char c, *buf1, *buf2;
- pid_t pid;
-
- /* Create data file */
- if ((fd = open("y.txt", O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1)
- perror_exit ("Can't create data file");
- write (fd, line, sizeof(line) - 1);
- close (fd);
-
- /* Open data file */
- if ((fd = open("y.txt", O_RDONLY)) == -1)
- perror_exit ("Can't open data file");
-
- if (fstat(fd, &statbuf) < 0)
- perror_exit ("fstat failed");
-
- if (!statbuf.st_size)
- perror_exit ("filesize is 0");
-
- if ((buf1 = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))
- == MAP_FAILED)
- perror_exit ("mmap 1 failed");
-
- close(fd);
-
- /* Open data file a second time */
- if ((fd = open("y.txt", O_RDONLY)) == -1)
- perror_exit ("Can't open data file in second run");
-
- if ((buf2 = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0))
- == MAP_FAILED)
- perror_exit ("mmap 2 failed");
-
- close(fd);
-
- sigemptyset (&unblock_sigsegv);
- sigaddset (&unblock_sigsegv, SIGSEGV);
- signal (SIGSEGV, sigsegv);
-
- if (setjmp (r))
- perror_exit ("SEGV in fork");
-
- pid = fork();
-
- if (pid == -1)
- perror_exit ("fork failed");
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent" : "SEGV in child");
-
- c = buf1[0];
- c = buf2[0];
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap");
-
- if (munmap(buf1, statbuf.st_size))
- perror_exit (pid ? "munmap failed in parent" : "munmap failed in child");
-
- if (setjmp (r) == 0)
- {
- c = buf1[0];
- perror_exit (pid ? "no SEGV in parent after munmap" : "no SEGV in child after munmap");
- }
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent after munmap" : "SEGV in child after munmap");
-
- c = buf2[0];
-
- if (setjmp (r))
- perror_exit (pid ? "SEGV in parent's munmap" : "SEGV in child's munmap");
-
- if (munmap(buf2, statbuf.st_size))
- perror_exit (pid ? "munmap failed in parent" : "munmap failed in child");
-
- if (pid)
- {
- waitpid (pid, &status, 0);
- unlink ("y.txt");
- if (!WIFEXITED (status) || WEXITSTATUS (status))
- return 1;
- }
-
- return 0;
-}
diff --git a/winsup/testsuite/winsup.api/mmaptest04.c b/winsup/testsuite/winsup.api/mmaptest04.c
deleted file mode 100644
index e8cc0a61f..000000000
--- a/winsup/testsuite/winsup.api/mmaptest04.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-int
-main ()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = 65536; //getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = (char *) malloc (pagesize);
- if (!data)
- exit (1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand ();
- umask (0);
- fd = creat ("conftestmmap", 0600);
- if (fd < 0)
- {
- printf ("creat: %d\n", errno);
- exit (1);
- }
- if (write (fd, data, pagesize) != pagesize)
- {
- printf ("write: %d\n", errno);
- exit (1);
- }
- close (fd);
-
- /*
- * Next, try to mmap the file.
- */
- fd = open ("conftestmmap", O_RDWR);
- if (fd < 0)
- {
- printf ("write: %d\n", errno);
- exit (1);
- }
- if ((data2 = mmap (data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE, fd, 0L)) == MAP_FAILED)
- {
- printf ("mmap: %d\n", errno);
- exit (1);
- }
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- {
- printf ("check-if: %d\n", errno);
- exit (1);
- }
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = (char *) malloc (pagesize);
- if (!data3)
- {
- printf ("malloc2: %d\n", errno);
- exit (1);
- }
- if (read (fd, data3, pagesize) != pagesize)
- {
- printf ("read: %d\n", errno);
- exit (1);
- }
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- {
- printf ("check-if2: %d\n", errno);
- exit (1);
- }
- if (msync (data2, pagesize, MS_SYNC))
- {
- printf ("msync: %d\n", errno);
- exit (1);
- }
- if (munmap (data2, pagesize))
- {
- printf ("munmap: %d\n", errno);
- exit (1);
- }
- close (fd);
- unlink ("conftestmmap");
- exit (0);
-}
diff --git a/winsup/testsuite/winsup.api/samples/sample-fail.c b/winsup/testsuite/winsup.api/samples/sample-fail.c
deleted file mode 100644
index d8beb90be..000000000
--- a/winsup/testsuite/winsup.api/samples/sample-fail.c
+++ /dev/null
@@ -1,4 +0,0 @@
-main()
-{
- return 1;
-}
diff --git a/winsup/testsuite/winsup.api/samples/sample-miscompile.c b/winsup/testsuite/winsup.api/samples/sample-miscompile.c
deleted file mode 100644
index bc0d21d2e..000000000
--- a/winsup/testsuite/winsup.api/samples/sample-miscompile.c
+++ /dev/null
@@ -1 +0,0 @@
-foo bar grill
diff --git a/winsup/testsuite/winsup.api/samples/sample-pass.c b/winsup/testsuite/winsup.api/samples/sample-pass.c
deleted file mode 100644
index 893a0b605..000000000
--- a/winsup/testsuite/winsup.api/samples/sample-pass.c
+++ /dev/null
@@ -1,4 +0,0 @@
-main()
-{
- return 0;
-}
diff --git a/winsup/testsuite/winsup.api/sigchld.c b/winsup/testsuite/winsup.api/sigchld.c
deleted file mode 100644
index a7d1069b7..000000000
--- a/winsup/testsuite/winsup.api/sigchld.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <signal.h>
-
-int no_signal_caught = 1;
-
-void handler ( int signo )
-{
- no_signal_caught = 0;
-}
-
-main()
-{
- pid_t pid;
- signal ( SIGCHLD, handler );
- pid = fork();
- if ( pid == 0 ) exit ( 0 );
- sleep ( 2 );
- exit ( no_signal_caught );
-}
diff --git a/winsup/testsuite/winsup.api/waitpid.c b/winsup/testsuite/winsup.api/waitpid.c
deleted file mode 100644
index 9845cd1a4..000000000
--- a/winsup/testsuite/winsup.api/waitpid.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <stdio.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-int
-main (int argc, char **argv)
-{
- int pid, n;
- if ((pid = fork ()) == 0)
- exit (0);
- sleep (2);
- if ((n = waitpid (pid, NULL, 0)) != pid)
- {
- printf ("wait pid failed, pid %d, n %d, errno %d\n", pid, n, errno);
- exit(1);
- }
- else
- {
- printf ("wait pid succeeded, pid %d, n %d, errno %d\n", pid, n, errno);
- exit (0);
- }
-}
diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp
deleted file mode 100644
index 743f4cfaa..000000000
--- a/winsup/testsuite/winsup.api/winsup.exp
+++ /dev/null
@@ -1,70 +0,0 @@
-source "site.exp"
-source "$srcdir/winsup.api/known_bugs.tcl"
-
-if { ! [isnative] } {
- verbose "skipping winsup.api because it's not native"
- return
-}
-
-set rv ""
-set add_includes ""
-set add_libs ""
-
-set ltp_includes "-I$ltp_includes"
-set ltp_libs "$rootme/libltp.a"
-
-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 { [lsearch -exact $xfail_list $basename] >= 0 } {
- set xfail_expected 1
- setup_xfail "*-*-*"
- } else {
- set xfail_expected 0
- clear_xfail
- }
-
- if { [regexp "^ltp/" $testcase ] } {
- set add_includes $ltp_includes
- set add_libs $ltp_libs
- }
-
- ws_spawn "$CC -g3 $CFLAGS $src $add_includes $add_libs $runtime_root/new-libcygwin.a -o $base.exe"
- if { $rv != "" } {
- verbose -log "$rv"
- fail "$testcase (compile)"
- } else {
- if { $verbose } {
- set redirect_output "./$base.log"
- } else {
- set redirect_output /dev/null
- }
- ws_spawn "$runtime_root/cygrun ./$base.exe > $redirect_output"
- if { $rv != "" } {
- verbose -log "$testcase: $rv"
- fail "$testcase (execute)"
- if { $xfail_expected } {
- catch { file delete "$base.exe" } err
- if { $err != "" } {
- note "error deleting $base.exe: $err"
- }
- }
- } else {
- pass "$testcase"
- catch { file delete "$base.exe" } err
- if { $err != "" } {
- note "error deleting $base.exe: $err"
- }
- }
- }
-}