| 1 |
$ . "$TESTDIR/helper.sh" |
| 2 |
|
| 3 |
Use a pre-generated UUID in a filename to make sure the filename is unique to this test |
| 4 |
and also that the pre-down hook has found the right directory having found this file. |
| 5 |
|
| 6 |
$ uniquish_file_prefix='test-hooks-run-in-situ-' |
| 7 |
> uuid='5b811e03-5977-40e6-80ef-dd6c35013e56' |
| 8 |
> uniquish_file=${uniquish_file_prefix}${uuid} |
| 9 |
|
| 10 |
Pre-down and post-down hooks should run by default. More importantly the hooks\' cwd should |
| 11 |
be the directory where they are situated. We test this by trying to find $uniquish_file. |
| 12 |
|
| 13 |
$ touch .dotfiles/$uniquish_file |
| 14 |
> mkdir -p .dotfiles/hooks/pre-down .dotfiles/hooks/post-down |
| 15 |
> touch .dotfiles/hooks/pre-down/00-test.sh .dotfiles/hooks/post-down/00-test.sh |
| 16 |
> chmod +x .dotfiles/hooks/pre-down/00-test.sh .dotfiles/hooks/post-down/00-test.sh |
| 17 |
|
| 18 |
$ echo "echo ../../${uniquish_file_prefix}* > /tmp/test-$uuid" > .dotfiles/hooks/pre-down/00-test.sh |
| 19 |
> echo "cat /tmp/test-$uuid; rm /tmp/test-$uuid" > .dotfiles/hooks/post-down/00-test.sh |
| 20 |
|
| 21 |
$ rcdn |
| 22 |
../../test-hooks-run-in-situ-5b811e03-5977-40e6-80ef-dd6c35013e56 |
| 23 |
|
| 24 |
Ensure that hooks run when output of lsrc is non-empty |
| 25 |
$ touch .dotfiles/testrc |
| 26 |
> rcup |
| 27 |
> rcdn |
| 28 |
../../test-hooks-run-in-situ-5b811e03-5977-40e6-80ef-dd6c35013e56 |