[Libsysio-commit] HEAD: libsysio/tests test_copy.c test_getcwd.c test_link.c test_list.c test_path.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2005-02-04 00:29:35
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11570 Modified Files: test_copy.c test_getcwd.c test_link.c test_list.c test_path.c test_regions.c test_rename.c test_stats.c test_stddir.c test_unlink.c Log Message: Modified to support tests of a build with SYSIO_LABEL_NAMES set so as to cause a unique. non-conflicting build of the POSIX functions. Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- test_copy.c 3 Jul 2004 05:47:13 -0000 1.10 +++ test_copy.c 4 Feb 2005 00:29:26 -0000 1.11 @@ -53,6 +53,9 @@ #include <sys/uio.h> #include <sys/queue.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -136,7 +139,7 @@ open_file(const char *path, int flags, m { int fd; - fd = open(path, flags, mode); + fd = SYSIO_INTERFACE_NAME(open)(path, flags, mode); if (fd < 0) perror(path); @@ -165,8 +168,8 @@ copy_file(const char *spath, const char if (dfd < 0) goto out; - while ((cc = read(sfd, buf, sizeof(buf))) > 0) - if ((wcc = write(dfd, buf, cc)) != cc) { + while ((cc = SYSIO_INTERFACE_NAME(read)(sfd, buf, sizeof(buf))) > 0) + if ((wcc = SYSIO_INTERFACE_NAME(write)(dfd, buf, cc)) != cc) { if (wcc < 0) { perror(dpath); break; @@ -182,9 +185,11 @@ copy_file(const char *spath, const char perror(spath); out: - if (sfd >= 0 && close(sfd) != 0) + if (sfd >= 0 && SYSIO_INTERFACE_NAME(close)(sfd) != 0) perror(spath); - if (dfd >= 0 && (fsync(dfd) != 0 || close(dfd) != 0)) + if (dfd >= 0 && + (SYSIO_INTERFACE_NAME(fsync)(dfd) != 0 || + SYSIO_INTERFACE_NAME(close)(dfd) != 0)) perror(dpath); return 0; Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_getcwd.c 3 Jul 2004 05:47:13 -0000 1.5 +++ test_getcwd.c 4 Feb 2005 00:29:26 -0000 1.6 @@ -53,6 +53,9 @@ #include <sys/queue.h> #include <dirent.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "mount.h" @@ -144,11 +147,11 @@ doit(const char *path) { char *buf; - if (chdir(path) != 0) { + if (SYSIO_INTERFACE_NAME(chdir)(path) != 0) { perror(path); return -1; } - buf = getcwd(NULL, 0); + buf = SYSIO_INTERFACE_NAME(getcwd)(NULL, 0); if (!buf) { perror(path); return -1; Index: test_link.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_link.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- test_link.c 3 Jul 2004 05:47:13 -0000 1.3 +++ test_link.c 4 Feb 2005 00:29:26 -0000 1.4 @@ -54,6 +54,9 @@ #include <sys/uio.h> #include <sys/queue.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -106,11 +109,11 @@ main(int argc, char *const argv[]) old = argv[optind++]; new = argv[optind++]; - if ((err = link(old, new)) != 0) { + if ((err = SYSIO_INTERFACE_NAME(link)(old, new)) != 0) { perror("link"); break; } - if ((err = lstat(new, &stbuf)) != 0) { + if ((err = SYSIO_INTERFACE_NAME(lstat)(new, &stbuf)) != 0) { perror(new); break; } Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- test_list.c 3 Jul 2004 05:47:13 -0000 1.9 +++ test_list.c 4 Feb 2005 00:29:26 -0000 1.10 @@ -55,6 +55,9 @@ #include <sys/uio.h> #include <sys/queue.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -149,7 +152,7 @@ listit(const char *path) off_t base; ssize_t cc; - fd = open(path, O_RDONLY); + fd = SYSIO_INTERFACE_NAME(open)(path, O_RDONLY); if (fd < 0) { perror(path); return -1; @@ -164,7 +167,10 @@ listit(const char *path) } base = 0; - while ((cc = getdirentries(fd, (char *)buf, n, &base)) > 0) { + while ((cc = SYSIO_INTERFACE_NAME(getdirentries)(fd, + (char *)buf, + n, + &base)) > 0) { dp = buf; while (cc > 0) { (void )printf("\t%s: ino %llu type %u\n", Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -b -B -p -r1.10 -r1.11 --- test_path.c 15 Jul 2004 20:17:38 -0000 1.10 +++ test_path.c 4 Feb 2005 00:29:26 -0000 1.11 @@ -52,6 +52,9 @@ #include <unistd.h> #include <sys/uio.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -149,7 +152,7 @@ statit(const char *path) /* * Get file attrs. */ - err = lstat(path, &stbuf); + err = SYSIO_INTERFACE_NAME(lstat)(path, &stbuf); if (err) { perror(path); return -1; @@ -197,7 +200,7 @@ statit(const char *path) * Print path and type. */ if (S_ISLNK(stbuf.st_mode)) { - cc = readlink(path, buf, sizeof(buf)); + cc = SYSIO_INTERFACE_NAME(readlink)(path, buf, sizeof(buf)); if (cc < 0) { perror(path); return -1; Index: test_regions.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_regions.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_regions.c 3 Jul 2004 05:47:13 -0000 1.5 +++ test_regions.c 4 Feb 2005 00:29:26 -0000 1.6 @@ -65,6 +65,9 @@ #include <fcntl.h> #include <sys/uio.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -197,7 +200,7 @@ main(int argc, char * const argv[]) if (use64) flags |= O_LARGEFILE; #endif - fd = open(path, flags, 0666); + fd = SYSIO_INTERFACE_NAME(open)(path, flags, 0666); if (fd < 0) { perror(path); err = 1; @@ -205,11 +208,11 @@ main(int argc, char * const argv[]) } #ifdef GO64 if (use64) - off64 = lseek64(fd, off64, SEEK_SET); + off64 = SYSIO_INTERFACE_NAME(lseek64)(fd, off64, SEEK_SET); else off64 = #endif - off = lseek(fd, off, SEEK_SET); + off = SYSIO_INTERFACE_NAME(lseek)(fd, off, SEEK_SET); #ifdef GO64 if ((use64 && off64 < 0) || (!use64 && off < 0)) { perror(use64 ? "lseek64" : "lseek"); @@ -224,9 +227,9 @@ main(int argc, char * const argv[]) } #endif if (which == 'r') - cc = read(fd, buf, nbytes); + cc = SYSIO_INTERFACE_NAME(read)(fd, buf, nbytes); else - cc = write(fd, buf, nbytes); + cc = SYSIO_INTERFACE_NAME(write)(fd, buf, nbytes); if (cc < 0) { perror(path); err = 1; @@ -234,11 +237,11 @@ main(int argc, char * const argv[]) } #ifdef GO64 if (use64) { - off64 = lseek64(fd, 0, SEEK_CUR); + off64 = SYSIO_INTERFACE_NAME(lseek64)(fd, 0, SEEK_CUR); } else off64 = #endif - off = lseek(fd, 0, SEEK_CUR); + off = SYSIO_INTERFACE_NAME(lseek)(fd, 0, SEEK_CUR); (void )printf(("%s%s@" #ifdef GO64 "%lld" @@ -269,7 +272,7 @@ main(int argc, char * const argv[]) ); error: - if (fd > 0 && close(fd) != 0) + if (fd > 0 && SYSIO_INTERFACE_NAME(close)(fd) != 0) perror(path); free(buf); out: Index: test_rename.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_rename.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_rename.c 3 Jul 2004 05:47:13 -0000 1.5 +++ test_rename.c 4 Feb 2005 00:29:26 -0000 1.6 @@ -52,6 +52,9 @@ #include <fcntl.h> #include <sys/uio.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -95,7 +98,7 @@ main(int argc, char * const argv[]) exit(1); } - (void )umask(022); + (void )SYSIO_INTERFACE_NAME(umask)(022); /* * Source @@ -110,7 +113,7 @@ main(int argc, char * const argv[]) if (argc - optind) usage(); - err = rename(spath, dpath); + err = SYSIO_INTERFACE_NAME(rename)(spath, dpath); if (err) perror("rename"); Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- test_stats.c 3 Jul 2004 05:47:13 -0000 1.7 +++ test_stats.c 4 Feb 2005 00:29:26 -0000 1.8 @@ -55,6 +55,9 @@ #endif #include <sys/uio.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -91,7 +94,7 @@ main(int argc, char * const argv[]) exit(1); } - (void )umask(022); + (void )SYSIO_INTERFACE_NAME(umask)(022); while (optind < argc) do_stats(argv[optind++]); @@ -124,19 +127,19 @@ do_stats(const char *path) struct statvfs stvfsbuf1, stvfsbuf2; #endif - fd = open(path, O_RDONLY); + fd = SYSIO_INTERFACE_NAME(open)(path, O_RDONLY); if (fd < 0) { perror(path); return; } - err = fstat(fd, &stbuf1); + err = SYSIO_INTERFACE_NAME(fstat)(fd, &stbuf1); if (!err) - err = stat(path, &stbuf2); + err = SYSIO_INTERFACE_NAME(stat)(path, &stbuf2); #ifdef notdef if (!err) - err = fstatvfs(fd, &stvfsbuf1); + err = SYSIO_INTERFACE_NAME(fstatvfs)(fd, &stvfsbuf1); if (!err) - err = statvfs(path, &stvfsbuf1); + err = SYSIO_INTERFACE_NAME(statvfs)(path, &stvfsbuf1); #endif if (err) { perror(path); @@ -182,6 +185,6 @@ do_stats(const char *path) (unsigned long )stbuf1.st_mtime, (unsigned long )stbuf1.st_ctime); out: - if (close(fd) != 0) + if (SYSIO_INTERFACE_NAME(close)(fd) != 0) perror("closing file"); } Index: test_stddir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stddir.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- test_stddir.c 30 Aug 2004 15:58:01 -0000 1.1 +++ test_stddir.c 4 Feb 2005 00:29:26 -0000 1.2 @@ -49,6 +49,9 @@ #include <dirent.h> #include <sys/types.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -139,17 +142,17 @@ testit(const char *path) printf("testing directory functions on %s\n", path); - if ((d = opendir(path)) == NULL) { + if ((d = SYSIO_INTERFACE_NAME(opendir)(path)) == NULL) { perror(path); return errno; } - while ((de = readdir(d)) != NULL) + while ((de = SYSIO_INTERFACE_NAME(readdir)(d)) != NULL) printf("\t %s: ino %lu off %lu type %u\n", de->d_name, (unsigned long )de->d_ino, (unsigned long )de->d_off, (int )de->d_type); - if (closedir(d)) { + if (SYSIO_INTERFACE_NAME(closedir)(d)) { perror("closedir"); return errno; } Index: test_unlink.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_unlink.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- test_unlink.c 3 Jul 2004 05:47:13 -0000 1.4 +++ test_unlink.c 4 Feb 2005 00:29:26 -0000 1.5 @@ -52,6 +52,9 @@ #endif #include <sys/uio.h> +#if defined(SYSIO_LABEL_NAMES) && SYSIO_LABEL_NAMES == 1 +#include "sysio.h" +#endif #include "xtio.h" #include "test.h" @@ -141,7 +144,7 @@ static int unlinkit(const char *path) { - if (unlink(path) != 0) { + if (SYSIO_INTERFACE_NAME(unlink)(path) != 0) { perror(path); return -1; } |