diff options
Diffstat (limited to 'usr.bin/tar/test/test_patterns.c')
-rw-r--r-- | usr.bin/tar/test/test_patterns.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/usr.bin/tar/test/test_patterns.c b/usr.bin/tar/test/test_patterns.c index 9f77436..a90d711 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); + + /* + * + */ } |