Better comment the pattern tests; adjust the filenames for the

reference files to match the corresponding source.

MFC after:	3 days
This commit is contained in:
kientzle 2008-08-20 06:01:53 +00:00
parent fb39793d41
commit b49301b5cd
4 changed files with 22 additions and 12 deletions

View File

@ -28,15 +28,18 @@ __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";
const char *reffile2 = "test_patterns_2.tgz";
const char *reffile2_out = "test_patterns_2.tgz.out";
const char *reffile2_err = "test_patterns_2.tgz.err";
/*
* Test basic command-line pattern handling.
*/
/*
* Test 1: Files on the command line that don't get matched
* didn't produce an error.
*
* John Baldwin reported this problem in PR bin/121598
*/
fd = open("foo", O_CREAT | O_WRONLY, 0644);
@ -48,13 +51,20 @@ DEFINE_TEST(test_patterns)
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);
/*
* Test 2: Check basic matching of full paths that start with /
*/
extract_reference_file(reffile2);
extract_reference_file(reffile2_out);
extract_reference_file(reffile2_err);
r = systemf("%s tf %s /tmp/foo/bar > tar2a.out 2> tar2a.err",
testprog, reffile1);
testprog, reffile2);
assertEqualInt(r, 0);
assertEqualFile("tar2a.out", reffile1_out);
assertEqualFile("tar2a.err", reffile1_err);
assertEqualFile("tar2a.out", reffile2_out);
assertEqualFile("tar2a.err", reffile2_err);
/*
*
*/
}

View File

@ -1,5 +1,5 @@
$FreeBSD$
begin 644 test_patterns.tgz.err
begin 644 test_patterns_2.tgz.err
M8G-D=&%R.B!296UO=FEN9R!L96%D:6YG("<O)R!F<F]M(&UE;6)E<B!N86UE
"<PH`
`

View File

@ -1,5 +1,5 @@
$FreeBSD$
begin 644 test_patterns.tgz.out
begin 644 test_patterns_2.tgz.out
==&UP+V9O;R]B87(O"G1M<"]F;V\O8F%R+V)A>@H`
`
end

View File

@ -1,5 +1,5 @@
$FreeBSD$
begin 644 test_patterns.tgz
begin 644 test_patterns_2.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