-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.sh
executable file
·197 lines (162 loc) · 6.25 KB
/
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
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
#!/bin/bash
# ########################################################################## #
# Frame (©2023 Lelanthran Manickum) #
# #
# This program comes with ABSOLUTELY NO WARRANTY. This is free software #
# and you are welcome to redistribute it under certain conditions; see #
# the LICENSE file for details. #
# ########################################################################## #
export DBPATH=/tmp/frame/
export PROG="./recent/bin/x86_64-linux-gnu/frame.elf --quiet"
if [ ! -z "$VG" ]; then
export VG="valgrind -q --leak-check=full --show-leak-kinds=all --error-exitcode=1"
fi
die () {
echo testcommand failure: $@
exit -1
}
export NC="\e[0m"
export INV="\e[7m"
export RED="\e[31m"
export GREEN="\e[32m"
export BLUE="\e[34m"
export CYAN="\e[36m"
export YELLOW="\e[33m"
export HI_ON="${RED}${INV}"
if [ ! -t 1 ]; then
export NC=""
export INV=""
export RED=""
export GREEN=""
export BLUE=""
export CYAN=""
export YELLOW=""
export HI_ON=""
fi
export STMT_NUM=0
if [ -z "$DEBUG" ]; then
export DEBUG=-1
fi
execute () {
echo -ne "${RED}Executing${NC} ${GREEN}$STMT_NUM:${NC} "
echo -e "${BLUE}$@${NC}"
if [ ! -z "$VG" ]; then
$VG $@ --dbpath=$DBPATH
export RET=$?
export STMT_NUM=$(($STMT_NUM + 1))
return $RET
fi
if [ "$DEBUG" -eq "$STMT_NUM" ]; then
gdb --args $@ --dbpath=$DBPATH
export RET=$?
export STMT_NUM=$(($STMT_NUM + 1))
return $RET
fi
export STMT_NUM=$(($STMT_NUM + 1))
$@ --dbpath=$DBPATH
}
die () {
echo testcommand failure: $@
execute $PROG status
exit -1
}
rm -rf $DBPATH
execute $PROG create || die failed to create
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG replace --message="Root: replacement" || die failed replace
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG push one --message="One: message one" || die failed push
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG append --message="\nMessage: 1\n" || die failed append
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG up || die failed uptree
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG push two --message="Two: message two" || die failed push
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG top || die failed top
execute $PROG down one || die failed down one
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG back 1 || die failed back
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG back 1 || die failed back
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG push three --message="three: three" || die failed push
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG pop || die failed pop
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG push four --message="four: four" || die failed push
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG delete root/two || die failed delete
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG top || die failed top
execute $PROG status || die failed status
execute $PROG history || die failed history
execute $PROG push five --message="five: five" || die failed push
execute $PROG up || die failed up
execute $PROG push six --message="six: six" || die failed push
execute $PROG up || die failed up
execute $PROG push seven --message="seven: seven" || die failed push
execute $PROG up || die failed up
execute $PROG push eight --message="eight: eight" || die failed push
execute $PROG up || die failed up
execute $PROG push eighteen --message="eight: eight" || die failed push
execute $PROG up || die failed up
execute $PROG push eighty --message="eight: eight" || die failed push
execute $PROG up || die failed up
execute $PROG down one || die failed down
execute $PROG push one --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push two --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push three --message="new one" || die failed push
execute $PROG up || die failed up
# execute $PROG push four --message="new one" || die failed push
# execute $PROG up || die failed up
execute $PROG push five --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push six --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push seven --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push eight --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push nine --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG push ten --message="new one" || die failed push
execute $PROG up || die failed up
execute $PROG status || die failed status
execute $PROG list || die failed list
# Current node is root/one
execute $PROG match --from-root "e" || die failed match
execute $PROG match --from-root "ei" || die failed match
execute $PROG match --from-root "eigh" || die failed match
execute $PROG match "e" || die failed match
execute $PROG match "ei" || die failed match
execute $PROG match "eigh" || die failed match
execute $PROG match "eigh" --invert || die failed match
execute $PROG status || die failed status
execute $PROG match "one/egh" > t
if [ `wc -l t | cut -f 1 -d \ ` -ne 1 ]; then
die expected failed match
fi
# Rename root/one/five
execute $PROG switch root/one/five
execute $PROG rename 'FIVE' || die failed rename
# Current node is root/one/FIVE
execute $PROG status || die failed status
execute $PROG match --from-root "one/ei" || die failed match
execute $PROG tree || die failed tree
echo 'Use [sed "s:(.\+)::g"] to strip the dates'