Path: blob/main/contrib/libarchive/cpio/test/test_option_J_upper.c
39536 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_J_upper)9{10char *p;11int r;12size_t s;1314/* Create a file. */15assertMakeFile("f", 0644, "a");1617/* Archive it with xz compression. */18r = systemf("echo f | %s -o -J >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 xz support");26free(p);27return;28}29failure("-J option is broken");30assertEqualInt(r, 0);31goto done;32}33free(p);34/* Check that the archive file has an xz signature. */35p = slurpfile(&s, "archive.out");36assert(s > 2);37assertEqualMem(p, "\3757zXZ", 5);38done:39free(p);40}414243