-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (208 loc) · 7.08 KB
/
Copy pathzipfuse-fstab.yml
File metadata and controls
246 lines (208 loc) · 7.08 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: zipfuse-fstab
on:
push:
branches:
- master
- main
pull_request:
permissions:
contents: read
jobs:
zipfuse:
name: fstab
runs-on: ubuntu-latest
steps:
- name: Install FUSE
run: |
sudo apt-get update
sudo apt-get install -y fuse3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.25.1
cache: false
- name: Checkout code
uses: actions/checkout@v4
- name: Clean the environment
run: make clean
- name: Vendor dependencies
run: make vendor
- name: Build debug binaries
run: make debug
- name: Install debug binaries
run: |
sudo cp zipfuse /bin/zipfuse
sudo chmod +x /bin/zipfuse
sudo cp mount.zipfuse /sbin/mount.zipfuse
sudo chmod +x /sbin/mount.zipfuse
- name: Create test environment
run: |
mkdir -p source
mkdir -p mountpoint
mkdir -p test1/subdir1/subdir2
echo "Hello from test1.txt" > test1/test1.txt
echo "Second file in test1" > test1/file2.txt
echo "File in subdir1" > test1/subdir1/nested1.txt
echo "File in subdir2" > test1/subdir1/subdir2/nested2.txt
(cd test1 && zip -r ../source/archive1.zip .)
mkdir -p test2/docs/reports
echo "Hello from test2.txt" > test2/test2.txt
echo "Another file in test2" > test2/another.txt
echo "Document file" > test2/docs/document.txt
echo "Report file" > test2/docs/reports/report.txt
(cd test2 && zip -r ../source/archive2.zip .)
rm -rf test1 test2
- name: Mount filesystem
run: |
if ! sudo mount -t zipfuse source mountpoint; then
echo "ERROR: Filesystem mount has failed"
exit 1
fi
for i in {1..20}; do
if mountpoint -q mountpoint; then
echo "Filesystem mounted successfully"
break
fi
if [ $i -eq 30 ]; then
echo "Mount timeout"
exit 1
fi
sleep 0.5
done
mount | grep zipfuse || true
ls -la mountpoint/
- name: Test filesystem
run: |
echo "Testing archive1..."
if [ ! -f "mountpoint/archive1/test1.txt" ]; then
echo "ERROR: test1.txt not found in archive1"
exit 1
fi
CONTENT1=$(cat mountpoint/archive1/test1.txt)
if [ "$CONTENT1" != "Hello from test1.txt" ]; then
echo "ERROR: Content mismatch in test1.txt"
echo "Expected: 'Hello from test1.txt'"
echo "Got: '$CONTENT1'"
exit 1
fi
echo "archive1/test1.txt content verified"
CONTENT2=$(cat mountpoint/archive1/file2.txt)
if [ "$CONTENT2" != "Second file in test1" ]; then
echo "ERROR: Content mismatch in file2.txt"
echo "Expected: 'Second file in test1'"
echo "Got: '$CONTENT2'"
exit 1
fi
echo "archive1/file2.txt content verified"
CONTENT3=$(cat mountpoint/archive1/subdir1/nested1.txt)
if [ "$CONTENT3" != "File in subdir1" ]; then
echo "ERROR: Content mismatch in subdir1/nested1.txt"
echo "Expected: 'File in subdir1'"
echo "Got: '$CONTENT3'"
exit 1
fi
echo "archive1/subdir1/nested1.txt content verified"
CONTENT4=$(cat mountpoint/archive1/subdir1/subdir2/nested2.txt)
if [ "$CONTENT4" != "File in subdir2" ]; then
echo "ERROR: Content mismatch in subdir1/subdir2/nested2.txt"
echo "Expected: 'File in subdir2'"
echo "Got: '$CONTENT4'"
exit 1
fi
echo "archive1/subdir1/subdir2/nested2.txt content verified"
echo "Testing archive2..."
if [ ! -f "mountpoint/archive2/test2.txt" ]; then
echo "ERROR: test2.txt not found in archive2"
exit 1
fi
CONTENT5=$(cat mountpoint/archive2/test2.txt)
if [ "$CONTENT5" != "Hello from test2.txt" ]; then
echo "ERROR: Content mismatch in test2.txt"
echo "Expected: 'Hello from test2.txt'"
echo "Got: '$CONTENT5'"
exit 1
fi
echo "archive2/test2.txt content verified"
CONTENT6=$(cat mountpoint/archive2/another.txt)
if [ "$CONTENT6" != "Another file in test2" ]; then
echo "ERROR: Content mismatch in another.txt"
echo "Expected: 'Another file in test2'"
echo "Got: '$CONTENT6'"
exit 1
fi
echo "archive2/another.txt content verified"
CONTENT7=$(cat mountpoint/archive2/docs/document.txt)
if [ "$CONTENT7" != "Document file" ]; then
echo "ERROR: Content mismatch in docs/document.txt"
echo "Expected: 'Document file'"
echo "Got: '$CONTENT7'"
exit 1
fi
echo "archive2/docs/document.txt content verified"
CONTENT8=$(cat mountpoint/archive2/docs/reports/report.txt)
if [ "$CONTENT8" != "Report file" ]; then
echo "ERROR: Content mismatch in docs/reports/report.txt"
echo "Expected: 'Report file'"
echo "Got: '$CONTENT8'"
exit 1
fi
echo "archive2/docs/reports/report.txt content verified"
echo "All file content tests passed!"
- name: Unmount filesystem
if: always()
run: |
if ! sudo umount mountpoint; then
echo "ERROR: Filesystem unmount has failed"
exit 1
fi
for i in {1..10}; do
if ! mountpoint -q mountpoint; then
echo "Filesystem unmounted successfully"
break
fi
sleep 0.5
done
for i in {1..10}; do
if ! pgrep -fa zipfuse &>/dev/null; then
echo "Filesystem binary exited successfully"
exit 0
fi
sleep 0.5
done
echo "ERROR: Filesystem binary seems stuck after unmount"
exit 1
- name: Verify unmounted
if: always()
run: |
if mountpoint -q mountpoint; then
echo "ERROR: Filesystem still mounted after fusermount3"
mount | grep zipfuse || true
exit 1
fi
if pgrep -fa zipfuse &>/dev/null; then
echo "ERROR: Filesystem binary still alive after unmount"
pgrep -fa zipfuse || true
exit 1
fi
if [ -f "mountpoint/archive1/test1.txt" ]; then
echo "ERROR: Files still accessible after unmount"
exit 1
fi
echo "Filesystem properly unmounted"
- name: Show logs on failure
if: failure()
run: |
echo "=== Mount points ==="
mount | grep zipfuse || echo "No zipfuse mounts found"
echo ""
echo "=== Mountpoint directory ==="
ls -la mountpoint/ || true
echo ""
echo "=== Process list ==="
ps aux | grep zipfuse || echo "No zipfuse processes found"
echo ""
echo "=== Dmesg (last 25 lines) ==="
sudo dmesg | tail -n 25 || true
echo ""
echo "=== ZipFUSE Events (last 25 lines) ==="
sudo cat /var/log/zipfuse.log | tail -n 25 || true