From: Tim Kientzle Date: Mon, 31 Aug 2009 04:07:44 +0000 (-0400) Subject: Update test_copy style. X-Git-Tag: v2.8.0~400 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3b8d27a0d0f0c3ade2460aac8f07aac8a673ec7;p=thirdparty%2Flibarchive.git Update test_copy style. Fix bug where directory on command line got mis-reported. SVN-Revision: 1407 --- diff --git a/tar/test/test_copy.c b/tar/test/test_copy.c index c48cdfea6..7e0c6938b 100644 --- a/tar/test/test_copy.c +++ b/tar/test/test_copy.c @@ -164,10 +164,7 @@ verify_tree(int limit) char filename[260]; char name1[260]; char name2[260]; - char contents[260]; int i, j, LOOP_MAX; - FILE *f; - int len; LOOP_MAX = compute_loop_max(); @@ -186,18 +183,8 @@ verify_tree(int limit) strcpy(name1, "f/"); strcat(name1, filename); if (limit != LIMIT_USTAR || strlen(filename) <= 100) { - f = fopen(name1, "rb"); - failure("Couldn't open \"%s\": %s", - name1, strerror(errno)); - if (assert(f != NULL)) { - len = fread(contents, 1, i + 10, f); - fclose(f); - assertEqualInt(len, i + 2); - /* Verify contents of 'contents' */ - contents[len] = '\0'; - failure("Each test file contains its own name"); - assertEqualString(name1, contents); - } + assertFileExists(name1); + assertFileContents(name1, strlen(name1), name1); } /* @@ -210,7 +197,7 @@ verify_tree(int limit) if (limit != LIMIT_USTAR || strlen(name2) <= 100) { /* Verify hardlink "l/abcdef..." */ assertFileHardlinks(name1, name2); - /* Verify hardlink "m_abcdef..." */ + /* Verify hardlink "m/abcdef..." */ name2[0] = 'm'; assertFileHardlinks(name1, name2); } diff --git a/tar/tree.c b/tar/tree.c index abc3cfa65..67a7bbd61 100644 --- a/tar/tree.c +++ b/tar/tree.c @@ -410,7 +410,7 @@ tree_next(struct tree *t) /* Top stack item needs a regular visit. */ t->current = t->stack; tree_append(t, t->stack->name, strlen(t->stack->name)); - t->dirname_length = t->path_length; + //t->dirname_length = t->path_length; //tree_pop(t); t->stack->flags &= ~needsFirstVisit; return (t->visit_type = TREE_REGULAR);