190792Sgshapiro/*-
2261194Sgshapiro * Copyright (c) 2012 Michihiro NAKAJIMA
390792Sgshapiro * All rights reserved.
490792Sgshapiro *
590792Sgshapiro * Redistribution and use in source and binary forms, with or without
690792Sgshapiro * modification, are permitted provided that the following conditions
790792Sgshapiro * are met:
890792Sgshapiro * 1. Redistributions of source code must retain the above copyright
990792Sgshapiro *    notice, this list of conditions and the following disclaimer.
1090792Sgshapiro * 2. Redistributions in binary form must reproduce the above copyright
11266527Sgshapiro *    notice, this list of conditions and the following disclaimer in the
1290792Sgshapiro *    documentation and/or other materials provided with the distribution.
1390792Sgshapiro *
1490792Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
1590792Sgshapiro * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1690792Sgshapiro * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1790792Sgshapiro * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
1890792Sgshapiro * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1990792Sgshapiro * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2090792Sgshapiro * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2190792Sgshapiro * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2290792Sgshapiro * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2390792Sgshapiro * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2490792Sgshapiro */
2590792Sgshapiro#include "test.h"
2690792Sgshapiro__FBSDID("$FreeBSD$");
2790792Sgshapiro
2890792SgshapiroDEFINE_TEST(test_extract_cpio_lrz)
2990792Sgshapiro{
3090792Sgshapiro	const char *reffile = "test_extract.cpio.lrz";
3190792Sgshapiro	int f;
3290792Sgshapiro
3390792Sgshapiro	extract_reference_file(reffile);
34	f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
35	if (f == 0 || canLrzip()) {
36		assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err",
37		    testprog, reffile));
38
39		assertFileExists("file1");
40		assertTextFileContents("contents of file1.\n", "file1");
41		assertFileExists("file2");
42		assertTextFileContents("contents of file2.\n", "file2");
43		assertEmptyFile("test.out");
44		assertTextFileContents("1 block\n", "test.err");
45	} else {
46		skipping("It seems lrzip is not supported on this platform");
47	}
48}
49