diff options
author | kientzle <kientzle@FreeBSD.org> | 2008-08-15 06:12:02 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2008-08-15 06:12:02 +0000 |
commit | 393333b2add3af96410c4eefeacd432a697e24e8 (patch) | |
tree | d7c15007f334c30de6fd19c578c433015f566616 /usr.bin | |
parent | d5b61427baaaba63dbf136ff52566f7d78633990 (diff) | |
download | FreeBSD-src-393333b2add3af96410c4eefeacd432a697e24e8.zip FreeBSD-src-393333b2add3af96410c4eefeacd432a697e24e8.tar.gz |
Test updates: Handling of patterns on command line, error messages.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tar/test/test_copy.c | 3 | ||||
-rw-r--r-- | usr.bin/tar/test/test_option_T.c | 5 | ||||
-rw-r--r-- | usr.bin/tar/test/test_patterns.c | 13 | ||||
-rw-r--r-- | usr.bin/tar/test/test_patterns.tgz.err.uu | 6 | ||||
-rw-r--r-- | usr.bin/tar/test/test_patterns.tgz.out.uu | 5 | ||||
-rw-r--r-- | usr.bin/tar/test/test_patterns.tgz.uu | 9 |
6 files changed, 40 insertions, 1 deletions
diff --git a/usr.bin/tar/test/test_copy.c b/usr.bin/tar/test/test_copy.c index 52b9b78..6618a0e 100644 --- a/usr.bin/tar/test/test_copy.c +++ b/usr.bin/tar/test/test_copy.c @@ -196,6 +196,9 @@ verify_tree(int limit) char dir[2]; dir[0] = *dp; dir[1] = '\0'; d = opendir(dir); + failure("Unable to open dir '%s'", dir); + if (!assert(d != NULL)) + continue; while ((de = readdir(d)) != NULL) { p = de->d_name; switch(dp[0]) { diff --git a/usr.bin/tar/test/test_option_T.c b/usr.bin/tar/test/test_option_T.c index eec40bb..943182b 100644 --- a/usr.bin/tar/test/test_option_T.c +++ b/usr.bin/tar/test/test_option_T.c @@ -40,6 +40,7 @@ touch(const char *fn) DEFINE_TEST(test_option_T) { FILE *f; + int r; /* Create a simple dir heirarchy; bail if anything fails. */ if (!assertEqualInt(0, mkdir("d1", 0755))) return; @@ -67,8 +68,10 @@ DEFINE_TEST(test_option_T) fclose(f); /* Use -c -T to archive up the files. */ - systemf("%s -c -f test1.tar -T filelist > test1.out 2> test1.err", + r = systemf("%s -c -f test1.tar -T filelist > test1.out 2> test1.err", testprog); + failure("Failure here probably means that tar can't archive zero-length files without reading them"); + assert(r == 0); assertEmptyFile("test1.out"); assertEmptyFile("test1.err"); diff --git a/usr.bin/tar/test/test_patterns.c b/usr.bin/tar/test/test_patterns.c index e7b1679..9f77436 100644 --- a/usr.bin/tar/test/test_patterns.c +++ b/usr.bin/tar/test/test_patterns.c @@ -28,6 +28,9 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_patterns) { int fd, r; + const char *reffile1 = "test_patterns.tgz"; + const char *reffile1_out = "test_patterns.tgz.out"; + const char *reffile1_err = "test_patterns.tgz.err"; /* * Test basic command-line pattern handling. @@ -44,4 +47,14 @@ DEFINE_TEST(test_patterns) r = systemf("%s zxfv tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog); failure("tar should return non-zero because a file was given on the command line that's not in the archive"); assert(r != 0); + + extract_reference_file(reffile1); + extract_reference_file(reffile1_out); + extract_reference_file(reffile1_err); + + r = systemf("%s tf %s /tmp/foo/bar > tar2a.out 2> tar2a.err", + testprog, reffile1); + assertEqualInt(r, 0); + assertEqualFile("tar2a.out", reffile1_out); + assertEqualFile("tar2a.err", reffile1_err); } diff --git a/usr.bin/tar/test/test_patterns.tgz.err.uu b/usr.bin/tar/test/test_patterns.tgz.err.uu new file mode 100644 index 0000000..437d053 --- /dev/null +++ b/usr.bin/tar/test/test_patterns.tgz.err.uu @@ -0,0 +1,6 @@ +$FreeBSD$ +begin 644 test_patterns.tgz.err +M8G-D=&%R.B!296UO=FEN9R!L96%D:6YG("<O)R!F<F]M(&UE;6)E<B!N86UE +"<PH` +` +end diff --git a/usr.bin/tar/test/test_patterns.tgz.out.uu b/usr.bin/tar/test/test_patterns.tgz.out.uu new file mode 100644 index 0000000..8214536 --- /dev/null +++ b/usr.bin/tar/test/test_patterns.tgz.out.uu @@ -0,0 +1,5 @@ +$FreeBSD$ +begin 644 test_patterns.tgz.out +==&UP+V9O;R]B87(O"G1M<"]F;V\O8F%R+V)A>@H` +` +end diff --git a/usr.bin/tar/test/test_patterns.tgz.uu b/usr.bin/tar/test/test_patterns.tgz.uu new file mode 100644 index 0000000..50f61ed --- /dev/null +++ b/usr.bin/tar/test/test_patterns.tgz.uu @@ -0,0 +1,9 @@ +$FreeBSD$ +begin 644 test_patterns.tgz +M'XL(`,P5I4@``^W3T0J",!3&<1]E;[!SYC:?Q\`H2`PS@IZ^F5AV(PFMJ__O +MYB@;>.:W8X?V;/==9XM\1*0*P:2J59"QCN8ZO:A*4*<NAFA$G?=:F)"QIY?K +M9:C[U,IP;%?WW0Y-<UI9_SR4^6F/&=DY_UW=Y[H#V_(O4_ZE$T?^_[#(_Y[K +M&^E_1.^WS'^9'@HCN1I:(O_W_&>Z`]OR?\Y_C!7Y`P``````````````?.,! +(*>E$>P`H```` +` +end |