test_extract_tar_grz.c revision 256281
1139749Simp/*-
2102445Sjhb * Copyright (c) 2012 Michihiro NAKAJIMA
3102445Sjhb * All rights reserved.
4102445Sjhb *
5102445Sjhb * Redistribution and use in source and binary forms, with or without
6102445Sjhb * modification, are permitted provided that the following conditions
7102445Sjhb * are met:
8102445Sjhb * 1. Redistributions of source code must retain the above copyright
9102445Sjhb *    notice, this list of conditions and the following disclaimer.
10102445Sjhb * 2. Redistributions in binary form must reproduce the above copyright
11102445Sjhb *    notice, this list of conditions and the following disclaimer in the
12102445Sjhb *    documentation and/or other materials provided with the distribution.
13102445Sjhb *
14102445Sjhb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15102445Sjhb * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16102445Sjhb * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17102445Sjhb * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18102445Sjhb * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19102445Sjhb * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20102445Sjhb * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21102445Sjhb * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22102445Sjhb * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23102445Sjhb * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24102445Sjhb */
25102445Sjhb#include "test.h"
26102445Sjhb__FBSDID("$FreeBSD$");
27102445Sjhb
28102445SjhbDEFINE_TEST(test_extract_tar_grz)
29119418Sobrien{
30119418Sobrien	const char *reffile = "test_extract.tar.grz";
31119418Sobrien	int f;
32257251Skib
33257251Skib	extract_reference_file(reffile);
34102445Sjhb	f = systemf("%s -tf %s >test.out 2>test.err", testprog, reffile);
35102445Sjhb	if (f == 0 || canGrzip()) {
36102445Sjhb		assertEqualInt(0, systemf("%s -xf %s >test.out 2>test.err",
37102445Sjhb		    testprog, reffile));
38102445Sjhb
39102445Sjhb		assertFileExists("file1");
40102445Sjhb		assertTextFileContents("contents of file1.\n", "file1");
41193530Sjkim		assertFileExists("file2");
42193530Sjkim		assertTextFileContents("contents of file2.\n", "file2");
43193530Sjkim		assertEmptyFile("test.out");
44102445Sjhb		assertEmptyFile("test.err");
45297679Sjhb	} else {
46102445Sjhb		skipping("It seems grzip is not supported on this platform");
47102445Sjhb	}
48102445Sjhb}
49102445Sjhb