Lines Matching +full:test_option_s +full:. +full:tar +full:. +full:z

3  * All rights reserved.
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
12 * documentation and/or other materials provided with the distribution.
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 #include "test.h"
26 __FBSDID("$FreeBSD: releng/10.3/contrib/libarchive/tar/test/test_option_s.c 232153 2012-02-25 10:58:02Z mm $");
28 DEFINE_TEST(test_option_s)
32 /* Create a sample file hierarchy. */
44 /* Does tar support -s option ? */
45 systemf("%s -cf - -s /foo/bar/ in/d1/foo > NUL 2> check.err",
47 assertEqualInt(0, stat("check.err", &st));
48 if (st.st_size != 0) {
55 * Test 1: Filename substitution when creating archives.
58 systemf("%s -cf test1_1.tar -s /foo/bar/ in/d1/foo", testprog);
59 systemf("%s -xf test1_1.tar -C test1", testprog);
61 systemf("%s -cf test1_2.tar -s /d1/d2/ in/d1/foo", testprog);
62 systemf("%s -xf test1_2.tar -C test1", testprog);
66 * Test 2: Basic substitution when extracting archive.
69 systemf("%s -cf test2.tar in/d1/foo", testprog);
70 systemf("%s -xf test2.tar -s /foo/bar/ -C test2", testprog);
74 * Test 3: Files with empty names shouldn't be archived.
76 systemf("%s -cf test3.tar -s ,in/d1/foo,, in/d1/foo", testprog);
77 systemf("%s -tvf test3.tar > in.lst", testprog);
78 assertEmptyFile("in.lst");
81 * Test 4: Multiple substitutions when extracting archive.
84 systemf("%s -cf test4.tar in/d1/foo in/d1/bar",
86 systemf("%s -xf test4.tar -s /foo/bar/ -s }bar}baz} -C test4",
92 * Test 5: Name-switching substitutions when extracting archive.
95 systemf("%s -cf test5.tar in/d1/foo in/d1/bar",
97 systemf("%s -xf test5.tar -s /foo/bar/ -s }bar}foo} -C test5",
106 /* At extraction time. */
113 /* At creation time. */
126 /* At extraction. */
133 /* At creation. */
145 /* At extraction time. */
147 systemf("%s -cf test8a.tar in/d1", testprog);
148 systemf("%s -xf test8a.tar -s /d1/d2/ -C test8a", testprog);
150 /* At creation time. */
152 systemf("%s -cf test8b.tar -s /d1/d2/ in/d1", testprog);
153 systemf("%s -xf test8b.tar -C test8b", testprog);
159 /* At extraction. (assuming hardlink2 is the hardlink entry) */
161 systemf("%s -cf test9a.tar in/d1", testprog);
162 systemf("%s -xf test9a.tar -s /hardlink1/hardlink1-renamed/ -C test9a",
165 /* At extraction. (assuming hardlink1 is the hardlink entry) */
167 systemf("%s -cf test9b.tar in/d1", testprog);
168 systemf("%s -xf test9b.tar -s /hardlink2/hardlink2-renamed/ -C test9b",
171 /* At creation. (assuming hardlink2 is the hardlink entry) */
173 systemf("%s -cf test9c.tar -s /hardlink1/hardlink1-renamed/ in/d1",
175 systemf("%s -xf test9c.tar -C test9c", testprog);
177 /* At creation. (assuming hardlink1 is the hardlink entry) */
179 systemf("%s -cf test9d.tar -s /hardlink2/hardlink2-renamed/ in/d1",
181 systemf("%s -xf test9d.tar -C test9d", testprog);
188 /* At extraction. */
196 /* At creation. */
210 /* At extraction. */
218 /* At creation. */
229 * Test 12: renaming hardlink target without changing hardlink.
231 * which element will be stored as the hardlink.)
233 extract_reference_file("test_option_s.tar.Z");
235 systemf("%s -xf test_option_s.tar.Z -s /hardlink1/foo/H -s /foo/hardlink1/ %s -C test12a",
241 /* TODO: Expand this test to verify creation as well.
244 * pass, or some very creative renames that can be tested regardless.
250 * which element will be stored as the hardlink.)
252 extract_reference_file("test_option_s.tar.Z");
254 systemf("%s -xf test_option_s.tar.Z -s /hardlink1/foo/Rh -s /foo/hardlink1/Rh %s -C test13a",
260 /* TODO: See above; expand this test to verify renames at creation. */