-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·52 lines (29 loc) · 1001 Bytes
/
test.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
#!/bin/bash
# *Very* simple test using a single logfile
set -ex
DIR=`mktemp -d`
echo Feb 24 08:30:07 line 1 > "$DIR/log"
echo Feb 24 08:30:08 line 2 >> "$DIR/log"
./logmerge-mkoffsets "$DIR/log" > "$DIR/offsets"
echo Should output two lines:
./logmerge --offsets "$DIR/offsets"
echo
echo Feb 24 08:30:09 line 3 >> "$DIR/log"
mv "$DIR/log" "$DIR/log.0"
echo Feb 24 08:30:10 line 4 > "$DIR/log"
echo Should output lines 3 and 4:
./logmerge --offsets "$DIR/offsets"
# Newer stuff moves to files ending .1, .2, etc without .0
rm "$DIR/log.0"
echo Feb 24 08:30:11 line 5 >> "$DIR/log"
mv "$DIR/log" "$DIR/log.1"
echo Feb 24 08:30:12 line 6 > "$DIR/log"
echo Should output lines 5 and 6:
./logmerge --offsets "$DIR/offsets"
echo Feb 24 08:30:09 line 7 >> "$DIR/log"
mv "$DIR/log" "$DIR/log.0"
chmod a-r "$DIR/log.0"
echo Feb 24 08:30:10 line 8 > "$DIR/log"
echo Should output line 8, complain about no read permissions and keep going:
./logmerge --offsets "$DIR/offsets"
rm -r "$DIR"