Files
freebsd/cpio/test/test_option_l.c
T
Martin Matuska a8dfdb79eb Update vendor/libarchive to 3.8.10
ChangeLog:
https://github.com/libarchive/libarchive/compare/v3.8.9...v3.8.10

Obtained from:		libarchive
Libarcive commit:	0c48412be2d94afe1859a807ea7896a18d8900bd
2026-10-26 14:25:48 +01:00

39 lines
944 B
C

/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*/
#include "test.h"
DEFINE_TEST(test_option_l)
{
int r;
/* Create a file. */
assertMakeFile("f", 0644, "a");
/* Copy the file to the "copy" dir. */
r = systemf("echo f | %s -pd copy >copy.out 2>copy.err",
testprog);
assertEqualInt(r, 0);
/* Check that the copy is a true copy and not a link. */
assertIsNotHardlink("f", "copy/f");
/* Copy the file to the "link" dir with the -l option. */
r = systemf("echo f | %s -pld link >link.out 2>link.err",
testprog);
assertEqualInt(r, 0);
/* Check that this is a link and not a copy. */
assertIsHardlink("f", "link/f");
/* A failed hard link must make pass mode fail. */
r = systemf("echo f | %s -pl missing/parent >invalid.out 2>invalid.err",
testprog);
assert(r != 0);
assertFileNotExists("missing/parent/f");
assertNonEmptyFile("invalid.err");
}