121259Swollman/*-
221259Swollman * Copyright (c) 2012 Michihiro NAKAJIMA
321259Swollman * All rights reserved.
421259Swollman *
521259Swollman * Redistribution and use in source and binary forms, with or without
621259Swollman * modification, are permitted provided that the following conditions
721259Swollman * are met:
821259Swollman * 1. Redistributions of source code must retain the above copyright
921259Swollman *    notice, this list of conditions and the following disclaimer.
1021259Swollman * 2. Redistributions in binary form must reproduce the above copyright
1121259Swollman *    notice, this list of conditions and the following disclaimer in the
1221259Swollman *    documentation and/or other materials provided with the distribution.
1321259Swollman *
1421259Swollman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
1521259Swollman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1621259Swollman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1721259Swollman * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
1821259Swollman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1921259Swollman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2021259Swollman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2121259Swollman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2221259Swollman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2321259Swollman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2421259Swollman */
2521259Swollman#include "test.h"
2621259Swollman__FBSDID("$FreeBSD$");
2721259Swollman
2821259SwollmanDEFINE_TEST(test_extract_cpio_lz)
2921259Swollman{
3021259Swollman	const char *reffile = "test_extract.cpio.lz";
3121259Swollman	int f;
3221259Swollman
3321259Swollman	extract_reference_file(reffile);
3450477Speter	f = systemf("%s -it < %s >test.out 2>test.err", testprog, reffile);
3521259Swollman	if (f == 0 || canLzip()) {
3621259Swollman		assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err",
3721259Swollman		    testprog, reffile));
3821259Swollman
3921259Swollman		assertFileExists("file1");
4021259Swollman		assertTextFileContents("contents of file1.\n", "file1");
4121259Swollman		assertFileExists("file2");
4221259Swollman		assertTextFileContents("contents of file2.\n", "file2");
4321259Swollman		assertEmptyFile("test.out");
4421259Swollman		assertTextFileContents("1 block\n", "test.err");
4521259Swollman	} else {
4621259Swollman		skipping("It seems lzip is not supported on this platform");
4721259Swollman	}
4821259Swollman}
4921259Swollman