forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_kdb_internal_suite.sh
executable file
·85 lines (69 loc) · 1.79 KB
/
check_kdb_internal_suite.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
#!/bin/sh
@INCLUDE_COMMON@
echo
echo ELEKTRA KDB INTERNAL TEST SUITE
echo
check_version
#override for specific testing
#PLUGINS="quickdump"
for PLUGIN in $PLUGINS; do
if is_not_rw_storage; then
echo "$PLUGIN not a read-write storage"
continue
fi
case "$PLUGIN" in
"tcl")
MOUNT_PLUGIN="$PLUGIN ccode null"
TESTS="basic"
;;
"line")
TESTS="basic"
;;
"simpleini")
MOUNT_PLUGIN="$PLUGIN hexcode null"
TESTS="basic string"
;;
"dump")
MOUNT_PLUGIN="$PLUGIN"
# all tests for dump.. (takes long time)
TESTS=
# tests taking not soo long:
TESTS="basic string umlauts binary naming"
;;
"quickdump")
MOUNT_PLUGIN="$PLUGIN"
TESTS="basic string umlauts binary naming"
;;
*)
MOUNT_PLUGIN="$PLUGIN"
#if a new plugin can manage something we are happy
TESTS="basic string"
;;
esac
unset -f cleanup
FILE=test.$PLUGIN
check_remaining_files "$FILE"
"$KDB" mount "$FILE" "$MOUNTPOINT" "$MOUNT_PLUGIN" 1> /dev/null
exit_if_fail "could not mount $FILE at $MOUNTPOINT using $MOUNT_PLUGIN"
cleanup() {
"$KDB" umount "$MOUNTPOINT" > /dev/null
succeed_if "could not umount $MOUNTPOINT"
rm -f "$USER_FOLDER"/"$FILE"
rm -f "$SYSTEM_FOLDER"/"$FILE"
echo "Cleanup for $PLUGIN"
USER_REMAINING="$(find "$USER_FOLDER" -maxdepth 1 -name "$FILE"'*' -print -exec rm {} +)"
test -z "$USER_REMAINING"
succeed_if "found remaining files $USER_REMAINING in $USER_FOLDER"
SYSTEM_REMAINING="$(find "$SYSTEM_FOLDER" -maxdepth 1 -name "$FILE"'*' -print -exec rm {} +)"
test -z "$SYSTEM_REMAINING"
succeed_if "found remaining files $SYSTEM_REMAINING in $SYSTEM_FOLDER"
}
echo "Running tests for $PLUGIN"
for ROOT in $USER_ROOT $SYSTEM_ROOT; do
"$KDB" test "$ROOT" "$TESTS"
succeed_if "could not run test suite"
done
cleanup
done
unset -f cleanup
end_script basic commands