mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
Add Bash libs tmpdir and log_warn_die. Docu parse_options. Don't use TMPDIR in test-bash-functions; add ok() to test-bash-functions.
This commit is contained in:
44
t/lib/bash/tmpdir.sh
Normal file
44
t/lib/bash/tmpdir.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
TESTS=9
|
||||
|
||||
source "$LIB_DIR/log_warn_die.sh"
|
||||
source "$LIB_DIR/tmpdir.sh"
|
||||
|
||||
TEST_NAME="TMPDIR not defined"
|
||||
is "$TMPDIR" ""
|
||||
|
||||
TEST_NAME="set_TMPDIR makes secure tmpdir"
|
||||
set_TMPDIR
|
||||
ok "test -d $TMPDIR"
|
||||
|
||||
tmpdir=$TMPDIR;
|
||||
|
||||
TEST_NAME="rm_TMPDIR"
|
||||
rm_TMPDIR
|
||||
ok "test ! -d $tmpdir"
|
||||
|
||||
TEST_NAME="rm_TMPDIR resets TMPDIR"
|
||||
is "$TMPDIR" ""
|
||||
|
||||
# --tmpdir
|
||||
OPT_TMPDIR="/tmp/use--tmpdir"
|
||||
|
||||
TEST_NAME="TMPDIR not defined"
|
||||
is "$TMPDIR" ""
|
||||
|
||||
TEST_NAME="--tmpdir does not exist yet"
|
||||
ok "test ! -d $OPT_TMPDIR"
|
||||
|
||||
set_TMPDIR
|
||||
TEST_NAME="set_TMPDIR uses --tmpdir"
|
||||
is "$TMPDIR" "/tmp/use--tmpdir"
|
||||
|
||||
TEST_NAME="set_TMPDIR creates --tmpdir"
|
||||
ok "test -d $TMPDIR"
|
||||
|
||||
tmpdir=$TMPDIR;
|
||||
|
||||
TEST_NAME="rm_TMPDIR removes --tmpdir"
|
||||
rm_TMPDIR
|
||||
ok "test ! -d $tmpdir"
|
Reference in New Issue
Block a user