rbb 99/04/12 10:54:12
Modified: apr/test Makefile testfile.c Log: Basic cleanup of the test code. The test cases should work better now. This also removes all direct references to the internals of structures. It just had to wait until all the accessors were done. Revision Changes Path 1.2 +1 -1 apache-apr/apr/test/Makefile Index: Makefile =================================================================== RCS file: /home/cvs/apache-apr/apr/test/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile 1999/02/25 16:42:38 1.1 +++ Makefile 1999/04/12 17:54:11 1.2 @@ -17,7 +17,7 @@ EXTRA_DEPS= OSDIR= INCDIR=../../include -INCLUDES0=-I $(INCDIR) +INCLUDES0=-I ../file_io/unix -I $(INCDIR) SHELL=/bin/sh CC=gcc CPP=gcc -E 1.11 +14 -14 apache-apr/apr/test/testfile.c Index: testfile.c =================================================================== RCS file: /home/cvs/apache-apr/apr/test/testfile.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- testfile.c 1999/04/09 18:09:25 1.10 +++ testfile.c 1999/04/12 17:54:11 1.11 @@ -88,11 +88,11 @@ } fprintf(stdout, "\tChecking file......."); - if (thefile->filedes < 0) { + if (apr_valid_file(thefile) == APR_FAILURE) { fprintf(stderr, "Bad file des\n"); exit(-1); } - if (strcmp(thefile->fname, filename) != 0) { + if (strcmp(apr_get_filename(thefile), filename) != 0) { fprintf(stderr, "wrong filename\n"); exit(-1); } @@ -171,15 +171,6 @@ fprintf(stdout, "OK\n"); } - fprintf(stdout, "\tDeleting file while still open......."); - if (test_filedel() == APR_FAILURE) { - fprintf(stderr, "Something happened, please look into it.\n"); - exit(-1); - } - else { - fprintf(stdout, "OK\n"); - } - testdirs(); return 1; @@ -204,7 +195,7 @@ } thefile = apr_open("testdel", APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD); - if (thefile != NULL) { + if (thefile == NULL) { return APR_FAILURE; } @@ -219,7 +210,7 @@ fprintf(stdout, "Testing Directory functions.\n"); fprintf(stdout, "\tMakeing Directory......."); - if (apr_make_dir("testdir", 444) == APR_FAILURE) { + if (apr_make_dir("testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE | APR_GREAD | APR_GWRITE | APR_GEXECUTE | APR_WREAD | APR_WWRITE | APR_WEXECUTE) == APR_FAILURE) { fprintf(stderr, "Could not create directory\n"); return -1; } @@ -227,7 +218,7 @@ fprintf(stdout, "OK\n"); } - if (apr_open("testdir/testfile", APR_READ | APR_WRITE | APR_CREATE, APR_UREAD | APR_UWRITE | APR_UEXECUTE) != NULL) {; + if (apr_open("testdir/testfile", APR_READ | APR_WRITE | APR_CREATE, APR_UREAD | APR_UWRITE | APR_UEXECUTE) == NULL) {; return -1; } @@ -266,6 +257,15 @@ fprintf(stdout, "\tClosing Directory......."); if (apr_closedir(temp) == APR_FAILURE) { fprintf(stderr, "Could not close directory\n"); + return -1; + } + else { + fprintf(stdout, "OK\n"); + } + + fprintf(stdout, "\tRemoving file from directory......."); + if (apr_remove_file("testdir/testfile") == APR_FAILURE) { + fprintf(stderr, "Could not remove file\n"); return -1; } else {