forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_real_world.sh
executable file
·165 lines (128 loc) · 5.3 KB
/
check_real_world.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
#!/bin/sh
@INCLUDE_COMMON@
echo
echo ELEKTRA CHECK REAL WORLD SUITE
echo
is_plugin_available sync || {
echo "Test requires sync plugin, aborting" >&2
exit 0
}
check_version
FILE_SUFFIX=test_real_world
check_remaining_files $FILE_SUFFIX
ROOT_FILE=${FILE_SUFFIX}_root.ecf
ROOT_MOUNTPOINT=/test/script
if is_plugin_available dump; then
"$KDB" mount $ROOT_FILE $ROOT_MOUNTPOINT dump 1> /dev/null
succeed_if "could not mount root: $ROOT_FILE at $ROOT_MOUNTPOINT"
fi
SYS_FILE=${FILE_SUFFIX}_sys.ni
SYS_MOUNTPOINT=/test/script/sys
if is_plugin_available ni; then
"$KDB" mount $SYS_FILE $SYS_MOUNTPOINT ni 1> /dev/null
succeed_if "could not mount SYS: $SYS_FILE at $SYS_MOUNTPOINT"
fi
HOSTS_FILE=${FILE_SUFFIX}_hosts
HOSTS_MOUNTPOINT=/test/script/sys/hosts
if is_plugin_available hosts; then
"$KDB" mount $HOSTS_FILE $HOSTS_MOUNTPOINT hosts 1> /dev/null
succeed_if "could not mount hosts: $HOSTS_FILE at $HOSTS_MOUNTPOINT/hosts"
fi
UNAME_FILE=${FILE_SUFFIX}_uname
UNAME_MOUNTPOINT=system:/test/script/sys/uname
if is_plugin_available uname; then
touch "$SYSTEM_FOLDER/$UNAME_FILE"
"$KDB" mount $UNAME_FILE $UNAME_MOUNTPOINT uname
succeed_if "could not mount uname: $UNAME_FILE at $UNAME_MOUNTPOINT"
# following keys must exist:
"$KDB" ls $UNAME_MOUNTPOINT | grep "system:/test/script/sys/uname/machine"
succeed_if "machine key missing"
"$KDB" ls $UNAME_MOUNTPOINT | grep "system:/test/script/sys/uname/nodename"
succeed_if "nodename key missing"
"$KDB" ls $UNAME_MOUNTPOINT | grep "system:/test/script/sys/uname/release"
succeed_if "release key missing"
"$KDB" ls $UNAME_MOUNTPOINT | grep "system:/test/script/sys/uname/sysname"
succeed_if "sysname key missing"
"$KDB" ls $UNAME_MOUNTPOINT | grep "system:/test/script/sys/uname/version"
succeed_if "version key missing"
"$KDB" get "system:/test/script/sys/uname/machine"
succeed_if "could not get machine key"
fi
APPS_FILE=${FILE_SUFFIX}_apps.ini
APPS_MOUNTPOINT=/test/script/apps
if is_plugin_available simpleini; then
"$KDB" mount $APPS_FILE $APPS_MOUNTPOINT base64 simpleini ccode
succeed_if "could not mount simpleini: $APPS_FILE at $APPS_MOUNTPOINT"
fi
DESKTOP_FILE=${FILE_SUFFIX}_desktop.yajl
DESKTOP_MOUNTPOINT=/test/script/apps/desktop
if is_plugin_available yajl && is_plugin_available directoryvalue; then
"$KDB" mount $DESKTOP_FILE $DESKTOP_MOUNTPOINT yajl
succeed_if "could not mount DESKTOP: $DESKTOP_FILE at $DESKTOP_MOUNTPOINT"
check_set_rm system:/test/script/apps/desktop/x y
check_set_rm user:/test/script/apps/desktop/x y
fi
if is_plugin_available dump; then
"$KDB" mount | grep "test_real_world_root.ecf on /test/script"
succeed_if "mountpoint $ROOT_MOUNTPOINT missing"
check_set_rm system:/test/script/next/key value
check_set_rm user:/test/script/next/key value
fi
if is_plugin_available ni; then
"$KDB" mount | grep "test_real_world_sys.ni on /test/script/sys"
succeed_if "mountpoint $SYS_MOUNTPOINT missing"
check_set_rm system:/test/script/sys/next/key value
check_set_rm user:/test/script/sys/next/key value
check_set_mv_rm system:/test/script/sys/next/key user:/test/script/next/key myvalue
fi
if is_plugin_available hosts; then
"$KDB" mount | grep "test_real_world_hosts on /test/script/sys/hosts"
succeed_if "mountpoint $HOSTS_MOUNTPOINT missing"
check_set_rm system:/test/script/sys/hosts/ipv4/localhost 127.0.0.1
check_set_rm user:/test/script/sys/hosts/ipv4/localhost 127.0.0.1
check_set_rm system:/test/script/sys/hosts/ipv6/localhost ::1
check_set_rm user:/test/script/sys/hosts/ipv6/localhost ::1
check_set_mv_rm user:/test/script/sys/hosts/ipv4/localhost system:/test/script/sys/hosts/ipv4/localhost 127.0.0.1
check_set_mv_rm user:/test/script/sys/hosts/ipv4/localhost system:/test/script/sys/next/key 127.0.0.1
fi
if is_plugin_available simpleini; then
"$KDB" mount | grep "test_real_world_apps.ini on /test/script/apps"
succeed_if "mountpoint $APPS_MOUNTPOINT missing"
check_set_rm system:/test/script/apps/next/x y
check_set_rm user:/test/script/apps/next/x y
check_set_mv_rm user:/test/script/apps/next/x/x/y system:/test/script/sys/hosts/ipv4/localhost 127.0.0.1
check_set_rm system:/test/script/apps/next/x/a/b y
check_set_rm user:/test/script/apps/next/x/x/y y
fi
if is_plugin_available yajl && is_plugin_available directoryvalue; then
"$KDB" umount $DESKTOP_MOUNTPOINT > /dev/null
succeed_if "could not umount $DESKTOP_MOUNTPOINT"
fi
if is_plugin_available simpleini; then
"$KDB" umount $APPS_MOUNTPOINT > /dev/null
succeed_if "could not umount $APPS_MOUNTPOINT"
fi
if is_plugin_available uname; then
"$KDB" umount $UNAME_MOUNTPOINT > /dev/null
succeed_if "could not umount $UNAME_MOUNTPOINT"
fi
if is_plugin_available hosts; then
"$KDB" mount | grep "test_real_world_hosts on /test/script/sys/hosts"
succeed_if "mountpoint $HOSTS_MOUNTPOINT missing"
"$KDB" umount $HOSTS_MOUNTPOINT > /dev/null
succeed_if "could not umount $HOSTS_MOUNTPOINT"
"$KDB" mount | grep "test_real_world_hosts on /test/script/sys/hosts"
[ "$!" != "0" ]
succeed_if "mountpoint $HOSTS_MOUNTPOINT still there"
fi
if is_plugin_available ni; then
"$KDB" umount $SYS_MOUNTPOINT > /dev/null
succeed_if "could not umount $SYS_MOUNTPOINT"
fi
if is_plugin_available dump; then
"$KDB" umount $ROOT_MOUNTPOINT > /dev/null
succeed_if "could not umount $ROOT_MOUNTPOINT"
fi
rm -f "$USER_FOLDER"/$FILE_SUFFIX*
rm -f "$SYSTEM_FOLDER"/$FILE_SUFFIX*
end_script basic commands