1caf54c4fSMartin Matuska /*- 2*bd66c1b4SMartin Matuska * SPDX-License-Identifier: BSD-2-Clause 3*bd66c1b4SMartin Matuska * 4caf54c4fSMartin Matuska * Copyright (c) 2003-2007 Tim Kientzle 5caf54c4fSMartin Matuska * All rights reserved. 6caf54c4fSMartin Matuska */ 7caf54c4fSMartin Matuska #include "test.h" 8caf54c4fSMartin Matuska DEFINE_TEST(test_option_l)9caf54c4fSMartin MatuskaDEFINE_TEST(test_option_l) 10caf54c4fSMartin Matuska { 11caf54c4fSMartin Matuska int r; 12caf54c4fSMartin Matuska 13caf54c4fSMartin Matuska /* Create a file. */ 14caf54c4fSMartin Matuska assertMakeFile("f", 0644, "a"); 15caf54c4fSMartin Matuska 16caf54c4fSMartin Matuska /* Copy the file to the "copy" dir. */ 17caf54c4fSMartin Matuska r = systemf("echo f | %s -pd copy >copy.out 2>copy.err", 18caf54c4fSMartin Matuska testprog); 19caf54c4fSMartin Matuska assertEqualInt(r, 0); 20caf54c4fSMartin Matuska 21caf54c4fSMartin Matuska /* Check that the copy is a true copy and not a link. */ 22caf54c4fSMartin Matuska assertIsNotHardlink("f", "copy/f"); 23caf54c4fSMartin Matuska 24caf54c4fSMartin Matuska /* Copy the file to the "link" dir with the -l option. */ 25caf54c4fSMartin Matuska r = systemf("echo f | %s -pld link >link.out 2>link.err", 26caf54c4fSMartin Matuska testprog); 27caf54c4fSMartin Matuska assertEqualInt(r, 0); 28caf54c4fSMartin Matuska 29caf54c4fSMartin Matuska /* Check that this is a link and not a copy. */ 30caf54c4fSMartin Matuska assertIsHardlink("f", "link/f"); 31caf54c4fSMartin Matuska } 32