Home | History | Annotate | Line # | Download | only in test
      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 
     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("%s -cf - --lrzip f >archive.out 2>archive.err",
     26 	    testprog));
     27 	p = slurpfile(&s, "archive.err");
     28 	p[s] = '\0';
     29 	free(p);
     30 	/* Check that the archive file has an lzma signature. */
     31 	p = slurpfile(&s, "archive.out");
     32 	assert(s > 2);
     33 	assertEqualMem(p, "LRZI\x00", 5);
     34 	free(p);
     35 }
     36