diff --git a/usr.bin/tar/test/test_option_q.c b/usr.bin/tar/test/test_option_q.c index 7ce75e6a08a1..d1651194807e 100644 --- a/usr.bin/tar/test/test_option_q.c +++ b/usr.bin/tar/test/test_option_q.c @@ -29,6 +29,16 @@ DEFINE_TEST(test_option_q) { int fd; + /* + * Create an archive with several different versions of the + * same files. By default, the last version will overwrite + * any earlier versions. The -q/--fast-read option will + * stop early, so we can verify -q/--fast-read by seeing + * which version of each file actually ended up being + * extracted. This also exercises -r mode, since that's + * what we use to build up the test archive. + */ + fd = open("foo", O_CREAT | O_WRONLY, 0644); assert(fd >= 0); assertEqualInt(4, write(fd, "foo1", 4)); @@ -64,6 +74,11 @@ DEFINE_TEST(test_option_q) assertEqualInt(0, systemf("%s -rf archive.tar bar", testprog)); + /* + * Now, try extracting from the test archive with various + * combinations of -q. + */ + /* Test 1: -q foo should only extract the first foo. */ assertEqualInt(0, mkdir("test1", 0755)); assertEqualInt(0, chdir("test1"));