Debian Codegraph @

test/rcup-hooks-run-in-situ.t

raw
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-up hook has found the right directory having found this file.
5
6 $ uniquish_file_prefix='test-hooks-run-in-situ-'
7 > uuid='820a557b-1acb-4e86-8c5b-feb2536b5777'
8 > uniquish_file=${uniquish_file_prefix}${uuid}
9
10 Pre-up and post-up 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-up .dotfiles/hooks/post-up
15 > touch .dotfiles/hooks/pre-up/00-test.sh .dotfiles/hooks/post-up/00-test.sh
16 > chmod +x .dotfiles/hooks/pre-up/00-test.sh .dotfiles/hooks/post-up/00-test.sh
17
18 $ echo "echo ../../${uniquish_file_prefix}* > /tmp/test-$uuid" > .dotfiles/hooks/pre-up/00-test.sh
19 > echo "cat /tmp/test-$uuid; rm /tmp/test-$uuid" > .dotfiles/hooks/post-up/00-test.sh
20
21 $ rcup
22 ../../test-hooks-run-in-situ-820a557b-1acb-4e86-8c5b-feb2536b5777
23
24 Ensure that hooks run when output of lsrc is non-empty
25 $ touch .dotfiles/testrc
26 > rcup
27 ../../test-hooks-run-in-situ-820a557b-1acb-4e86-8c5b-feb2536b5777