- cd lib/bup && \
- LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" "$(bup_python)" csetup.py build
- cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
-
-lib/bup/_version.py:
- @echo "Something has gone wrong; $@ should already exist."
- @echo 'Check "./configure-version --update"'
- @false
-
-t/tmp:
- mkdir t/tmp
-
-runtests: runtests-python runtests-cmdline
-
-# The "pwd -P" here may not be appropriate in the long run, but we
-# need it until we settle the relevant drecurse/exclusion questions:
-# https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0
-runtests-python: all t/tmp
- $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \
- "$(bup_python)" wvtest.py t/t*.py lib/*/t/t*.py 2>&1 \
- | tee -a t/tmp/test-log/$$$$.log
-
-cmdline_tests := \
- t/test-rm.sh \
- t/test-gc.sh \
- t/test-main.sh \
- t/test-list-idx.sh \
- t/test-index.sh \
- t/test-split-join.sh \
- t/test-fuse.sh \
- t/test-drecurse.sh \
- t/test-cat-file.sh \
- t/test-compression.sh \
- t/test-fsck.sh \
- t/test-index-clear.sh \
- t/test-index-check-device.sh \
- t/test-ls.sh \
- t/test-tz.sh \
- t/test-meta.sh \
- t/test-on.sh \
- t/test-restore-map-owner.sh \
- t/test-restore-single-file.sh \
- t/test-rm-between-index-and-save.sh \
- t/test-save-with-valid-parent.sh \
- t/test-sparse-files.sh \
- t/test-command-without-init-fails.sh \
- t/test-redundant-saves.sh \
- t/test-save-creates-no-unrefs.sh \
- t/test-save-restore-excludes.sh \
- t/test-save-strip-graft.sh \
- t/test-import-duplicity.sh \
- t/test-import-rdiff-backup.sh \
- t/test-xdev.sh \
- t/test.sh
-
-# For parallel runs.
-# The "pwd -P" here may not be appropriate in the long run, but we
-# need it until we settle the relevant drecurse/exclusion questions:
-# https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0
-tmp-target-run-test%: all t/tmp
- $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \
- t/test$* 2>&1 | tee -a t/tmp/test-log/$$$$.log
-
-runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
+ cd lib/bup && $(cfg_py) csetup.py build "$(CFLAGS)" "$(LDFLAGS)"
+ # Make sure there's just the one file we expect before we copy it.
+ $(cfg_py) -c \
+ "import glob; assert(len(glob.glob('lib/bup/build/*/_helpers*$(SOEXT)')) == 1)"
+ cp lib/bup/build/*/_helpers*$(SOEXT) "$@"
+
+test/tmp:
+ mkdir test/tmp
+
+ifeq (yes,$(shell config/bin/python -c "import xdist; print('yes')" 2>/dev/null))
+ # MAKEFLAGS must not be in an immediate := assignment
+ parallel_opt = $(lastword $(filter -j%,$(MAKEFLAGS)))
+ get_parallel_n = $(patsubst -j%,%,$(parallel_opt))
+ maybe_specific_n = $(if $(filter -j%,$(parallel_opt)),-n$(get_parallel_n))
+ xdist_opt = $(if $(filter -j,$(parallel_opt)),-nauto,$(maybe_specific_n))
+else
+ xdist_opt =
+endif
+
+test: all test/tmp
+ ./pytest $(xdist_opt)