[Libsysio-commit] RedStorm_merge: libsysio/tests Makefile.am drv_init_all.c test_copy.c test_getcwd.
Brought to you by:
lward
From: Sonja T. <so...@us...> - 2003-10-10 13:43:30
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1:/tmp/cvs-serv24706/tests Modified Files: Tag: RedStorm_merge Makefile.am drv_init_all.c test_copy.c test_getcwd.c test_list.c test_mounts.c test_path.c test_stats.c test_stdfd.c Log Message: Adding tests Index: Makefile.am =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/Makefile.am,v retrieving revision 1.8.6.2 retrieving revision 1.8.6.2.2.1 diff -u -w -b -B -p -r1.8.6.2 -r1.8.6.2.2.1 --- Makefile.am 19 Jun 2003 17:48:13 -0000 1.8.6.2 +++ Makefile.am 10 Oct 2003 13:43:24 -0000 1.8.6.2.2.1 @@ -1,5 +1,5 @@ noinst_PROGRAMS = test_copy test_stats test_path test_mounts test_list \ - test_getcwd test_stdfd test_unlink + test_getcwd test_stdfd test_unlink test_driver CLEANFILES=drv_data.c @@ -33,52 +33,67 @@ STDFD_DEV_CFLAGS= STDFD_DEV_LIB= endif -DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(STFD_DEV_NAME) +if WITH_CPLANT_YOD +YOD_DRIVER_NAME=yod +YOD_DRIVER_CFLAGS= -DCPLANT_YOD +else +YOD_DRIVER_NAME= +YOD_DRIVER_CFLAGS= +endif + +DRIVERS=$(NATIVE_DRIVER_NAME) $(INCORE_DRIVER_NAME) $(YOD_DRIVER_NAME) $(STFD_DEV_NAME) CMNSRC=drv_init_all.c drv_data.c BUILT_SOURCES=drv_data.c +check_PROGRAMS=test_driver +if TEST_ALPHA_ARG +TESTS_ENVIRONMENT=IS_ALPHA=yes +else +TESTS_ENVIRONMENT=IS_ALPHA=no +endif +TESTS=test_all.pl -CFL=$(AM_CFLAGS) $(AM_CPPFLAGS) \ +AM_CFLAGS = $(AM_CPPFLAGS) \ $(NATIVE_DRIVER_CFLAGS) $(INCORE_DRIVER_CFLAGS) \ - $(STDFD_DEV_CFLAGS) + $(STDFD_DEV_CFLAGS) $(YOD_DRIVER_CFLAGS) LIBS=$(NATIVE_DRIVER_LIB) $(INCORE_DRIVER_LIB) \ - $(STDFD_DEV_LIB) \ + $(STDFD_DEV_LIB) $(YOD_DRIVER_LIB) \ $(top_builddir)/src/libsysio.a test_copy_SOURCES=test_copy.c $(CMNSRC) -test_copy_CFLAGS=$(CFL) +test_copy_CFLAGS=$(AM_CFLAGS) test_copy_LDADD=$(LIBS) test_copy_DEPENDENCIES=$(LIBS) test_stats_SOURCES=test_stats.c $(CMNSRC) -test_stats_CFLAGS=$(CFL) +test_stats_CFLAGS=$(AM_CFLAGS) test_stats_LDADD=$(LIBS) test_stats_DEPENDENCIES=$(LIBS) test_path_SOURCES=test_path.c $(CMNSRC) -test_path_CFLAGS=$(CFL) +test_path_CFLAGS=$(AM_CFLAGS) test_path_LDADD=$(LIBS) test_path_DEPENDENCIES=$(LIBS) test_mounts_SOURCES=test_mounts.c $(CMNSRC) -test_mounts_CFLAGS=$(CFL) +test_mounts_CFLAGS=$(AM_CFLAGS) test_mounts_LDADD=$(LIBS) test_mounts_DEPENDENCIES=$(LIBS) test_list_SOURCES=test_list.c $(CMNSRC) -test_list_CFLAGS=$(CFL) +test_list_CFLAGS=$(AM_CFLAGS) test_list_LDADD=$(LIBS) test_list_DEPENDENCIES=$(LIBS) test_getcwd_SOURCES=test_getcwd.c $(CMNSRC) -test_getcwd_CFLAGS=$(CFL) +test_getcwd_CFLAGS=$(AM_CFLAGS) test_getcwd_LDADD=$(LIBS) test_getcwd_DEPENDENCIES=$(LIBS) test_stdfd_SOURCES=test_stdfd.c $(CMNSRC) -test_stdfd_CFLAGS=$(CFL) +test_stdfd_CFLAGS=$(AM_CFLAGS) test_stdfd_LDADD=$(LIBS) test_stdfd_DEPENDENCIES=$(LIBS) @@ -87,7 +102,12 @@ test_unlink_CFLAGS=$(CFL) test_unlink_LDADD=$(LIBS) test_unlink_DEPENDENCIES=$(LIBS) -EXTRA_DIST=gendrvdata.sh test.h +test_driver_SOURCES=test_driver.c sysio_tests.c sysio_stubs.c help.c $(CMNSRC) +test_driver_CFLAGS=$(CFL) +test_driver_LDADD=$(LIBS) +test_driver_DEPENDENCIES=$(LIBS) + +EXTRA_DIST=gendrvdata.sh test.h test_driver.h drv_data.c: $(CONFIG_DEPENDENCIES) $(top_srcdir)/tests/gendrvdata.sh test -z "drv_data.c" && rm -f drv_data.c; \ Index: drv_init_all.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/drv_init_all.c,v retrieving revision 1.1 retrieving revision 1.1.10.1 diff -u -w -b -B -p -r1.1 -r1.1.10.1 --- drv_init_all.c 22 Feb 2003 18:25:11 -0000 1.1 +++ drv_init_all.c 10 Oct 2003 13:43:24 -0000 1.1.10.1 @@ -1,3 +1,5 @@ +#include <stdio.h> + extern int (*drvinits[])(void); /* @@ -13,9 +15,10 @@ drv_init_all() f = drvinits; while (*f) { err = (**f++)(); - if (err) + if (err) { return err; } + } return 0; } Index: test_copy.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_copy.c,v retrieving revision 1.5.6.1 retrieving revision 1.5.6.1.2.1 diff -u -w -b -B -p -r1.5.6.1 -r1.5.6.1.2.1 --- test_copy.c 27 May 2003 12:58:47 -0000 1.5.6.1 +++ test_copy.c 10 Oct 2003 13:43:24 -0000 1.5.6.1.2.1 @@ -92,7 +92,7 @@ main(int argc, char * const argv[]) #ifdef AUTOMOUNT_FILE_NAME "a" #endif - "i:m:")) != -1) + "r:m:")) != -1) switch (i) { #ifdef AUTOMOUNT_FILE_NAME @@ -112,6 +112,7 @@ main(int argc, char * const argv[]) if (!(argc - optind)) usage(); +#ifndef CPLANT_YOD if (_sysio_init() != 0) { perror("init sysio"); exit(1); @@ -127,7 +128,7 @@ main(int argc, char * const argv[]) perror(root_driver); exit(1); } - +#endif (void )umask(022); /* @@ -145,7 +146,9 @@ main(int argc, char * const argv[]) err = copy_file(spath, dpath); +#ifndef CPLANT_YOD _sysio_shutdown(); +#endif return err; } Index: test_getcwd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.c,v retrieving revision 1.1.10.1 retrieving revision 1.1.10.1.2.1 diff -u -w -b -B -p -r1.1.10.1 -r1.1.10.1.2.1 --- test_getcwd.c 27 May 2003 12:58:47 -0000 1.1.10.1 +++ test_getcwd.c 10 Oct 2003 13:43:24 -0000 1.1.10.1.2.1 @@ -112,7 +112,7 @@ main(int argc, char *const argv[]) default: usage(); } - +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -134,6 +134,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } +#endif n = argc - optind; @@ -169,10 +170,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_list.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_list.c,v retrieving revision 1.4.6.1 retrieving revision 1.4.6.1.2.1 diff -u -w -b -B -p -r1.4.6.1 -r1.4.6.1.2.1 --- test_list.c 27 May 2003 12:58:47 -0000 1.4.6.1 +++ test_list.c 10 Oct 2003 13:43:24 -0000 1.4.6.1.2.1 @@ -113,6 +113,7 @@ main(int argc, char *const argv[]) usage(); } +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -134,7 +135,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } - +#endif n = argc - optind; /* @@ -169,10 +170,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_mounts.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_mounts.c,v retrieving revision 1.3.10.1 retrieving revision 1.3.10.1.2.1 diff -u -w -b -B -p -r1.3.10.1 -r1.3.10.1.2.1 --- test_mounts.c 27 May 2003 12:58:47 -0000 1.3.10.1 +++ test_mounts.c 10 Oct 2003 13:43:24 -0000 1.3.10.1.2.1 @@ -107,6 +107,7 @@ main(int argc, char *const argv[]) usage(); } +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -128,7 +129,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } - +#endif n = argc - optind; @@ -164,10 +165,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } @@ -433,7 +436,7 @@ mountit(const char *arg) /* * Eat leading white. */ - while (*s && *s == ' ' && *s == '\t') + while (*s && *s == ' ' || *s == '\t') s++; /* * Get opts. @@ -442,7 +445,7 @@ mountit(const char *arg) while (*cp && *cp != ' ' && *cp != '\t') cp++; if (opts == cp) { - (void )fprintf(stderr, "%s: Missing target\n", arg); + (void )fprintf(stderr, "%s: Missing opts\n", arg); err = -1; goto out; } @@ -453,7 +456,7 @@ mountit(const char *arg) /* * Eat leading white. */ - while (*s && *s == ' ' && *s == '\t') + while (*s && *s == ' ' || *s == '\t') s++; /* * Get target @@ -468,6 +471,9 @@ mountit(const char *arg) if (*cp) *cp++ = '\0'; + err = mkdir(target, "0777"); + if (err && errno != EEXIST) + perror(target); err = mount(source, target, fstype, 0, opts); if (err) perror(arg); Index: test_path.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_path.c,v retrieving revision 1.3.10.1 retrieving revision 1.3.10.1.2.1 diff -u -w -b -B -p -r1.3.10.1 -r1.3.10.1.2.1 --- test_path.c 27 May 2003 12:58:47 -0000 1.3.10.1 +++ test_path.c 10 Oct 2003 13:43:24 -0000 1.3.10.1.2.1 @@ -113,6 +113,7 @@ main(int argc, char *const argv[]) usage(); } +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -134,7 +135,7 @@ main(int argc, char *const argv[]) perror("_sysio_mount_root"); exit(1); } - +#endif n = argc - optind; @@ -170,10 +171,12 @@ main(int argc, char *const argv[]) } } +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } @@ -188,7 +191,7 @@ statit(const char *path) /* * Get file attrs. */ - err = stat(path, &stbuf); + err = lstat(path, &stbuf); if (err) { perror(path); return -1; Index: test_stats.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stats.c,v retrieving revision 1.3.10.2 retrieving revision 1.3.10.2.2.1 diff -u -w -b -B -p -r1.3.10.2 -r1.3.10.2.2.1 --- test_stats.c 27 May 2003 12:58:47 -0000 1.3.10.2 +++ test_stats.c 10 Oct 2003 13:43:24 -0000 1.3.10.2.2.1 @@ -111,6 +111,7 @@ main(int argc, char * const argv[]) usage(); } +#ifndef CPLANT_YOD if (_sysio_init() != 0) { perror("init sysio"); exit(1); @@ -126,16 +127,18 @@ main(int argc, char * const argv[]) perror(root_driver); exit(1); } - +#endif (void )umask(022); while (optind < argc) do_stats(argv[optind++]); +#ifndef CPLANT_YOD /* * Clean up. */ _sysio_shutdown(); +#endif return 0; } Index: test_stdfd.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stdfd.c,v retrieving revision 1.2.6.1 retrieving revision 1.2.6.1.2.1 diff -u -w -b -B -p -r1.2.6.1 -r1.2.6.1.2.1 --- test_stdfd.c 27 May 2003 12:58:47 -0000 1.2.6.1 +++ test_stdfd.c 10 Oct 2003 13:43:24 -0000 1.2.6.1.2.1 @@ -121,6 +121,7 @@ main(int argc, char *const argv[]) if (argc - optind != 1) usage(); +#ifndef CPLANT_YOD /* * Init sysio lib. */ @@ -202,6 +203,7 @@ main(int argc, char *const argv[]) goto out; } +#endif /* * Read from stdin, write to stdout and stderr. */ @@ -228,8 +230,9 @@ main(int argc, char *const argv[]) * Clean up. */ out: +#ifndef CPLANT_YOD _sysio_shutdown(); - +#endif return 0; } |