diff --git a/usr.bin/tar/test/test_patterns.c b/usr.bin/tar/test/test_patterns.c index 9f77436adde5..a90d711039ce 100644 --- a/usr.bin/tar/test/test_patterns.c +++ b/usr.bin/tar/test/test_patterns.c @@ -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); + + /* + * + */ } diff --git a/usr.bin/tar/test/test_patterns.tgz.err.uu b/usr.bin/tar/test/test_patterns_2.tgz.err.uu similarity index 71% rename from usr.bin/tar/test/test_patterns.tgz.err.uu rename to usr.bin/tar/test/test_patterns_2.tgz.err.uu index 437d0535548c..cb0593087d31 100644 --- a/usr.bin/tar/test/test_patterns.tgz.err.uu +++ b/usr.bin/tar/test/test_patterns_2.tgz.err.uu @@ -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("@H` ` end diff --git a/usr.bin/tar/test/test_patterns.tgz.uu b/usr.bin/tar/test/test_patterns_2.tgz.uu similarity index 90% rename from usr.bin/tar/test/test_patterns.tgz.uu rename to usr.bin/tar/test/test_patterns_2.tgz.uu index 50f61ed73b39..0f9c7153a99e 100644 --- a/usr.bin/tar/test/test_patterns.tgz.uu +++ b/usr.bin/tar/test/test_patterns_2.tgz.uu @@ -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*