X Tutup
Skip to content

Commit 89ea179

Browse files
didrocksmartinpitt
authored andcommitted
Add mock fsck process
1 parent a80170f commit 89ea179

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/mocks/fsck

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
fd=0
3+
4+
OPTIND=1
5+
while getopts "C:aTlM" opt; do
6+
case "$opt" in
7+
C)
8+
fd=$OPTARG
9+
;;
10+
\?);;
11+
esac
12+
done
13+
14+
shift "$((OPTIND-1))"
15+
device=$1
16+
17+
echo "Running fake fsck on $device"
18+
19+
declare -a maxpass=(30 5 2 30 60)
20+
21+
for pass in {1..5}; do
22+
maxprogress=${maxpass[$((pass-1))]}
23+
for (( current=0; current<=${maxprogress}; current++)); do
24+
echo "$pass $current $maxprogress $device">&$fd
25+
sleep 0.1
26+
done
27+
done

0 commit comments

Comments
 (0)
X Tutup