Path: blob/main/contrib/libarchive/cpio/test/test_option_Z_upper.c
39507 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2003-2009 Tim Kientzle4* All rights reserved.5*/6#include "test.h"78DEFINE_TEST(test_option_Z_upper)9{10char *p;11int r;12size_t s;1314/* Create a file. */15assertMakeFile("f", 0644, "a");1617/* Archive it with compress compression. */18r = systemf("echo f | %s -oZ >archive.out 2>archive.err",19testprog);20p = slurpfile(&s, "archive.err");21p[s] = '\0';22if (r != 0) {23if (strstr(p, "compression not available") != NULL) {24skipping("This version of bsdcpio was compiled "25"without compress support");26free(p);27return;28}29failure("-Z option is broken");30assertEqualInt(r, 0);31free(p);32return;33}34free(p);35/* Check that the archive file has a compress signature. */36p = slurpfile(&s, "archive.out");37assert(s > 2);38assertEqualMem(p, "\x1f\x9d", 2);39free(p);40}414243