3 $description = "Test the -L option.";
5 $details = "Verify that symlink handling with and without -L works properly.";
7 # Only run these tests if the system sypports symlinks
9 # Apparently the Windows port of Perl reports that it does support symlinks
10 # (in that the symlink() function doesn't fail) but it really doesn't, so
11 # check for it explicitly.
13 if ($port_type eq 'W32' || !( eval { symlink("",""); 1 })) {
18 # Set up a symlink sym -> dep
19 # We'll make both dep and targ older than sym
24 symlink("../$dirnm/dep", 'sym');
26 # Without -L, nothing should happen
27 # With -L, it should update targ
28 run_make_test('targ: sym ; @echo make $@ from $<', '',
29 "#MAKE#: 'targ' is up to date.");
30 run_make_test(undef, '-L', "make targ from sym");
32 # Now update dep; in all cases targ should be out of date.
34 run_make_test(undef, '', "make targ from sym");
35 run_make_test(undef, '-L', "make targ from sym");
37 # Now update targ; in all cases targ should be up to date.
39 run_make_test(undef, '', "#MAKE#: 'targ' is up to date.");
40 run_make_test(undef, '-L', "#MAKE#: 'targ' is up to date.");
42 # Add in a new link between sym and dep. Be sure it's newer than targ.
44 rename('dep', 'dep1');
45 symlink('dep1', 'dep');
47 # Without -L, nothing should happen
48 # With -L, it should update targ
49 run_make_test(undef, '', "#MAKE#: 'targ' is up to date.");
50 run_make_test(undef, '-L', "make targ from sym");
52 rmfiles('targ', 'dep', 'sym', 'dep1');
54 # Check handling when symlinks point to non-existent files. Without -L we
55 # should get an error: with -L we should use the timestamp of the symlink.
57 symlink("../$dirname/dep", 'sym');
58 run_make_test('targ: sym ; @echo make $@ from $<', '',
59 "#MAKE#: *** No rule to make target 'sym', needed by 'targ'. Stop.", 512);
61 run_make_test('targ: sym ; @echo make $@ from $<', '-L',
62 'make targ from sym');
65 rmfiles('targ', 'sym');