6
PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin"
8
. "$LIB_DIR/summary_common.sh"
10
p="$TMPDIR/get_var_samples"
12
echo "test1 abcdef" > "$p"
14
"$(get_var test1 "$p")" \
16
"Sanity check, get_var works"
18
echo "test2 abc def" > "$p"
20
"$(get_var test2 "$p")" \
22
"get_var works even if the value has spaces"
24
echo "test::1 abcdef" > "$p"
26
"$(get_var "test::1" "$p")" \
28
"get_var works if the 'key' has colons"
31
echo "1234/567 qwerty" > "$p"
33
"$(get_var "1234/567" "$p")" \
35
"get_var works if the 'key' has a dash in it"
38
echo ".* some_new_value" >> "$p"
40
"$(get_var ".*" "$p")" \
42
"get_var treats the variable as a literal, not a regex"
44
if get_var "definitely_does_not_exist" "$p" 1>/dev/null ; then
45
pass "get_var always returns true, even for variables that don't exist"
47
fail "get_var should always return true"
50
samples="$PERCONA_TOOLKIT_BRANCH/t/pt-mysql-summary/samples"
53
"$(get_var "table_open_cache" "$samples/temp002/mysql-variables")" \
55
"get_var works on a variables dump"
58
"$(get_var "Open_tables" "$samples/temp002/mysql-status")" \
60
"get_var works on a status dump"
63
internal::nice_of_2750 0
64
internal::nice_of_2571 0
65
internal::nice_of_2406 0
70
"$(get_var "internal::nice_of_2750" "$p")" \
72
"get_var doesn't get confused if \$2 is also found inside \$1"
77
"setup_data_dir $PERCONA_TOOLKIT_BRANCH" \
78
"setup_data_dir dies if passed a populated directory" 2>/dev/null