-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshim_copy_post2.sh
executable file
·142 lines (96 loc) · 4.02 KB
/
shim_copy_post2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
set -x
cd shim_dirA
which bash
echo "FIXME: KNOWN ISSUE redirection close does not get posted!"
if [ "${KNOWN_REDIRECTION_BUG}" ]; then
echo "#test 1 sha512 000 work-around for capturing stdout"
cp ../pyiotest ./hoho
else
echo "#test 1 sha512 000 capturing stdout"
bash -c 'echo "hoho" >> ./hoho'
fi
echo "#test 0 comment 010 shim copy posting start"
echo "#test 1 sha512 c program run."
truncate --size=2 ./hoho
echo "#test 1 sha512 020 python program run"
/usr/bin/python3 ../pyiotest
grep lovely pyiotest
echo "#test 1 sha512 030 cp command"
cp ../libsr3shim.c hoho_my_darling.txt
echo "#test 1 sha512 040 cp command2"
cp ../libsr3shim.c file_to_delete
echo "#test 1 hlink 050 hard link command"
ln hoho hard_link_to_hoho
echo "#test 1 link 050 symlink to a broken place"
ln -sf broken_do_not_exist symlink_to_non_existent_place
echo "#test 1 link 050 symlink to a broken place"
ln -sf `pwd`/broken_do_not_exist `pwd`/symlink_to_non_existent_place
echo "#test 1 sha512 050 touch command"
touch hihi
echo "#test 1 link 060 symlink command"
ln -s hoho haha
echo lovely day eh
echo "#test 1 rename 070 moving a symlink"
mv haha hihi
# the testing framework cannot handle expecting two links of different types for one event.
# uncomment if you want to manually test this use case.
echo "#test 1,1 link,rename symlink -f to existing file... creates two posts: symlink to tmp name, and subsquent rename"
ln -sf ../libsr3shim.c file_to_delete
#echo "#test 1 rename hardlink to a symlink"
#ln hihi hoohoo
echo "#test 1,1 link,rename symlink -f absolute existing file... creates two posts: symlink to tmp name, and subsquent rename"
ln -sf `pwd`/../libsr3shim.c `pwd`/2nd_file_to_delete
echo "#test 1 rename 080 moving a file. "
mv hoho_my_darling.txt hoho2.log
echo "#test 1 remove 090 removing a file."
rm hoho2.log
echo "#test 1 directory 100 mkdir 1"
mkdir dirone
echo "#test 1 link 110 symlink to directory"
ln -s dirone link_to_dirone
echo "#test 1 sha512 120 stdout redirection in a subdir"
echo "fileone" >>link_to_dirone/fileone
echo "#test 1 sha512 120 2nd stdout redirection in a subdir"
echo "lovely" >>link_to_dirone/filefive
echo "#test 1 directory 130 mkdir 2"
mkdir dirone/dirtwo
echo "#test 1,1 link,rename 135 symlink in a sub-dir"
ln -sf `pwd`/link_to_dirone/fileone dirone/link_to_fileone
echo "#test 1 sha512 140 stdout redirection in a subsubdir"
echo "filetwo" >>dirone/dirtwo/filetwo
echo "#test 1 sha512 160 copy a file to one with spaces in the name"
cp dirone/dirtwo/filetwo "dirone/filetwo copy with spaces in the name"
echo "#test 1 sha512 160 copy a file with spaces in the name (both source and dest)"
cp "dirone/filetwo copy with spaces in the name" "dirone/second spaced file"
echo "#test 1 rename 145 rename in a sub-dir"
mv dirone/dirtwo/filetwo dirone/dirtwo/filefour
# sleep to allow copies to happen before renaming directory...
sleep 15
echo "#test 1 rename 150 renaming subdirs should cause file rename events."
mv dirone dirthree
echo "#test 1 link 135 symlink in a sub-dir"
ln -sf `pwd`/dirthree/dirtwo/filefour dirthree/dirtwo/link2four
echo "#test 1 link 156 symlink in a sub-dir"
ln -sf filefour `pwd`/dirthree/dirtwo/link32_to_file4
echo "#test 1 rename 156.5 symlink in a sub-dir"
mv `pwd`/dirthree/dirtwo/link32_to_file4 `pwd`/dirthree/dirtwo/renamed_link32_to_file4
echo "#test 1 sha512 create test_file with redirection."
echo 1 >test_file
echo "#test 1 sha512 update test_file"
touch test_file
echo "#test 1 rename move test_file into dirthree subdir"
mv test_file dirthree
echo "#test 1 sha512 create test_file (again) from redirection"
echo 2 >test_file
if [ ! "${KNOWN_REDIRECTION_BUG}" ]; then
echo "#no post from touch, refused as repeat"
touch test_file
fi
echo "#test 1 rename move test_file into dirthree subdir (new name)"
mv test_file dirthree/new_test_file
echo "#test 1 remove 165 symlink in a non sub-dir"
cd ../shim_dirC/thedir
rm filefive
echo "#test 1 rename move a file when in a linked dir.)"
mv new_test_file middle_aged_test_file
echo "#test 0 comment 160 shim copy posting end"