| 1 | # -*-perl-*-
|
|---|
| 2 |
|
|---|
| 3 | $description = "Test the -L option.";
|
|---|
| 4 |
|
|---|
| 5 | $details = "Verify that symlink handling with and without -L works properly.";
|
|---|
| 6 |
|
|---|
| 7 | # Only run these tests if the system sypports symlinks
|
|---|
| 8 | if (eval { symlink("",""); 1 }) {
|
|---|
| 9 |
|
|---|
| 10 | # Set up a symlink sym -> dep
|
|---|
| 11 | # We'll make both dep and targ older than sym
|
|---|
| 12 | $pwd =~ m%/([^/]+)$%;
|
|---|
| 13 | $dirnm = $1;
|
|---|
| 14 | &utouch(-10, 'dep');
|
|---|
| 15 | &utouch(-5, 'targ');
|
|---|
| 16 | symlink("../$dirnm/dep", 'sym');
|
|---|
| 17 |
|
|---|
| 18 | # Without -L, nothing should happen
|
|---|
| 19 | # With -L, it should update targ
|
|---|
| 20 | run_make_test('targ: sym ; @echo make $@ from $<', '',
|
|---|
| 21 | "#MAKE#: `targ' is up to date.");
|
|---|
| 22 | run_make_test(undef, '-L', "make targ from sym");
|
|---|
| 23 |
|
|---|
| 24 | # Now update dep; in all cases targ should be out of date.
|
|---|
| 25 | &touch('dep');
|
|---|
| 26 | run_make_test(undef, '', "make targ from sym");
|
|---|
| 27 | run_make_test(undef, '-L', "make targ from sym");
|
|---|
| 28 |
|
|---|
| 29 | # Now update targ; in all cases targ should be up to date.
|
|---|
| 30 | &touch('targ');
|
|---|
| 31 | run_make_test(undef, '', "#MAKE#: `targ' is up to date.");
|
|---|
| 32 | run_make_test(undef, '-L', "#MAKE#: `targ' is up to date.");
|
|---|
| 33 |
|
|---|
| 34 | # Add in a new link between sym and dep. Be sure it's newer than targ.
|
|---|
| 35 | sleep(1);
|
|---|
| 36 | rename('dep', 'dep1');
|
|---|
| 37 | symlink('dep1', 'dep');
|
|---|
| 38 |
|
|---|
| 39 | # Without -L, nothing should happen
|
|---|
| 40 | # With -L, it should update targ
|
|---|
| 41 | run_make_test(undef, '', "#MAKE#: `targ' is up to date.");
|
|---|
| 42 | run_make_test(undef, '-L', "make targ from sym");
|
|---|
| 43 |
|
|---|
| 44 | rmfiles('targ', 'dep', 'sym', 'dep1');
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | 1;
|
|---|