# Assumes shell is Bash, and pipefail is set.
-bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd)
+bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd) || exit $?
+
+bup-python()
+{
+ "$bup_t_lib_script_home/../cmd/bup-python" "$@"
+}
force-delete()
{
{
test "$#" -eq 1 || return $?
echo "$1" | \
- PYTHONPATH="$bup_t_lib_script_home/../lib" python -c \
+ PYTHONPATH="$bup_t_lib_script_home/../lib" bup-python -c \
"import sys, bup.helpers; print bup.helpers.realpath(sys.stdin.readline())" \
|| return $?
}
#!/usr/bin/env bash
. ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
set -o pipefail
savename()
{
readonly secs="$1"
- WVPASS python -c "from time import strftime, localtime; \
+ WVPASS bup-python -c "from time import strftime, localtime; \
print strftime('%Y-%m-%d-%H%M%S', localtime($secs))"
}
WVPASS bup init
WVPASS cd "$tmpdir"
-savestamp1=$(WVPASS python -c 'import time; print int(time.time())') || exit $?
+savestamp1=$(WVPASS bup-python -c 'import time; print int(time.time())') || exit $?
savestamp2=$(($savestamp1 + 1))
+
savename1="$(savename "$savestamp1")" || exit $?
savename2="$(savename "$savestamp2")" || exit $?
#!/usr/bin/env bash
. ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
set -o pipefail
|| exit $?
if test "$(uname -s)" != NetBSD; then
- symlink_size="$(WVPASS python -c "import os
+ symlink_size="$(WVPASS bup-python -c "import os
print os.lstat('src/symlink').st_size")" || exit $?
else
# NetBSD appears to return varying sizes, so for now, just ignore it.
fi
uid="$(id -u)" || exit $?
-gid="$(python -c 'import os; print os.stat("src").st_gid')" || exit $?
+gid="$(bup-python -c 'import os; print os.stat("src").st_gid')" || exit $?
user="$(id -un)" || exit $?
-group="$(python -c 'import grp, os;
+group="$(bup-python -c 'import grp, os;
print grp.getgrgid(os.stat("src").st_gid)[0]')" || exit $?
WVPASSEQ "$(bup ls -l src/latest"$tmpdir"/src | tr -s ' ' ' ')" \
tmpdir="$(WVPASS wvmktempdir)" || exit $?
- first_group="$(WVPASS python -c 'import os,grp; \
+ first_group="$(WVPASS bup-python -c 'import os,grp; \
print grp.getgrgid(os.getgroups()[0])[0]')" || exit $?
- last_group="$(python -c 'import os,grp; \
+ last_group="$(bup-python -c 'import os,grp; \
print grp.getgrgid(os.getgroups()[-1])[0]')" || exit $?
last_group_erx="$(escape-erx "$last_group")"
WVPASS mkdir "$testfs"/src/foo
WVPASS touch "$testfs"/src/bar
PYTHONPATH="$TOP/lib" \
- WVPASS python -c "from bup import xstat; \
+ WVPASS bup-python -c "from bup import xstat; \
x = xstat.timespec_to_nsecs((42, 0));\
xstat.utime('$testfs/src/foo', (x, x));\
xstat.utime('$testfs/src/bar', (x, x));"
WVPASS cd "$testfs_limited"/src-restore
WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
| WVPASS grep -e '^Linux chattr:' \
- | WVPASS python -c \
+ | WVPASS bup-python -c \
'import sys; exit(not len(sys.stdin.readlines()) == 3)'
) || exit $?
) || exit $?
WVFAIL bup meta --extract --file "$testfs"/src.meta
WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
| WVPASS grep -e "^xattr\.set '" \
- | WVPASS python -c \
+ | WVPASS bup-python -c \
'import sys; exit(not len(sys.stdin.readlines()) == 2)'
) || exit $?
WVPASS cd "$testfs_limited"/src-restore
WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
| WVPASS grep -e '^POSIX1e ACL applyto:' \
- | WVPASS python -c \
+ | WVPASS bup-python -c \
'import sys; exit(not len(sys.stdin.readlines()) == 2)'
) || exit $?
#!/usr/bin/env bash
. ./wvtest-bup.sh || exit $?
+. t/lib.sh || exit $?
if [ $(t/root-status) != root ]; then
echo 'Not root: skipping restore --map-* tests.'
WVPASS grep -qE "^group: $other_group\$" foo-xstat
WVPASS grep -qE "^gid: $other_gid\$" foo-xstat
-has_uid_gid_0=$(WVPASS python -c "
+has_uid_gid_0=$(WVPASS bup-python -c "
import grp, pwd
try:
pwd.getpwuid(0)
# The 3MB guess is semi-arbitrary, but we've been informed that
# Lustre, for example, uses 1MB, so guess higher than that, at least.
-block_size=$(python -c \
+block_size=$(bup-python -c \
"import os; print getattr(os.stat('.'), 'st_blksize', 0) or $mb * 3") \
|| exit $?
data_size=$((block_size * 10))