forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_spec.sh
executable file
·62 lines (42 loc) · 1.56 KB
/
check_spec.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
#!/bin/sh
@INCLUDE_COMMON@
echo
echo ELEKTRA SPEC TESTS
echo
check_version
set -x
echo "Test specification get"
ROOT_FILE=spec_tests.ecf
ROOT_MOUNTPOINT=/test/script/spec
if is_plugin_available dump && is_plugin_available list && is_plugin_available sync; then
"$KDB" mount $ROOT_FILE $ROOT_MOUNTPOINT dump 1> /dev/null
succeed_if "could not mount root: $ROOT_FILE at $ROOT_MOUNTPOINT"
SYSTEM_FILE="$("$KDB" file -n system:$ROOT_MOUNTPOINT)"
[ ! -f "$SYSTEM_FILE" ]
exit_if_fail "System File $SYSTEM_FILE already exists"
"$KDB" mount $ROOT_FILE spec:$ROOT_MOUNTPOINT dump 1> /dev/null
succeed_if "could not mount spec root: $ROOT_FILE at spec:$ROOT_MOUNTPOINT"
SPEC_FILE="$("$KDB" file -n spec:$ROOT_MOUNTPOINT)"
[ ! -f "$SPEC_FILE" ]
exit_if_fail "Spec File $SPEC_FILE already exists"
"$KDB" get $ROOT_MOUNTPOINT
[ $? != 0 ]
succeed_if "getting cascading should fail if nothing is there"
"$KDB" set spec:$ROOT_MOUNTPOINT/test "" > /dev/null
succeed_if "could not create key"
"$KDB" get $ROOT_MOUNTPOINT
[ $? != 0 ]
succeed_if "getting cascading should fail if nothing is there"
"$KDB" meta-set spec:$ROOT_MOUNTPOINT/first default 20
succeed_if "could not set meta"
[ "x$("$KDB" get $ROOT_MOUNTPOINT/first)" = "x20" ]
succeed_if "could not get default value"
"$KDB" umount $ROOT_MOUNTPOINT
succeed_if "could not unmount previously mounted mountpoint"
"$KDB" umount spec:$ROOT_MOUNTPOINT
succeed_if "could not unmount previously mounted spec mountpoint"
rm -f "$SYSTEM_FILE"
rm -f "$SPEC_FILE"
fi
echo "Test mounting plugin stack"
end_script spec tests