xref: /freebsd/contrib/libarchive/cpio/test/test_option_lrzip.c (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2003-2007 Tim Kientzle
5  * Copyright (c) 2012 Michihiro NAKAJIMA
6  * All rights reserved.
7  */
8 #include "test.h"
9 
DEFINE_TEST(test_option_lrzip)10 DEFINE_TEST(test_option_lrzip)
11 {
12 	char *p;
13 	size_t s;
14 
15 	if (!canLrzip()) {
16 		skipping("lrzip is not supported on this platform");
17 		return;
18 	}
19 
20 	/* Create a file. */
21 	assertMakeFile("f", 0644, "a");
22 
23 	/* Archive it with lrzip compression. */
24 	assertEqualInt(0,
25 	    systemf("echo f | %s -o --lrzip >archive.out 2>archive.err",
26 	    testprog));
27 	p = slurpfile(&s, "archive.err");
28 	free(p);
29 	/* Check that the archive file has an lzma signature. */
30 	p = slurpfile(&s, "archive.out");
31 	assert(s > 2);
32 	assertEqualMem(p, "LRZI\x00", 5);
33 	free(p);
34 }
35