]> arthur.barton.de Git - bup.git/commitdiff
Ensure "bup" invocations fail for all make targets
authorRob Browning <rlb@defaultvalue.org>
Sun, 1 May 2022 17:24:03 +0000 (12:24 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 9 Jul 2022 18:36:38 +0000 (13:36 -0500)
Add a test/shadow-bin/bup that fails, and always include shadow-bin in
the PATH to prevent accidentally invoking a local version.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
GNUmakefile
dev/shadow-bin/bup [new file with mode: 0755]

index 48725d2f5413659dad5d374f1ac6d0f558697d41..49d0c78d6f671b8ccdd3028e7649f6dbe6fdfdf9 100644 (file)
@@ -4,6 +4,9 @@ MAKEFLAGS += --warn-undefined-variables
 SHELL := bash
 .DEFAULT_GOAL := all
 
+# Guard against accidentally using/testing a local bup
+export PATH := $(CURDIR)/dev/shadow-bin:$(PATH)
+
 clean_paths :=
 generated_dependencies :=
 
@@ -208,6 +211,7 @@ lint: dev/bup-exec dev/bup-python
        ./pylint
 
 test: all test/tmp dev/python lint
+       ! bup version  # Ensure we can't test the local bup (cf. dev/shadow-bin)
        ./bup features
        if test yes = "$$(dev/python -c 'import xdist; print("yes")' 2>/dev/null)"; then \
           (set -x; ./pytest $(xdist_opt);) \
diff --git a/dev/shadow-bin/bup b/dev/shadow-bin/bup
new file mode 100755 (executable)
index 0000000..f2cda72
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+cat <<EOF
+error: something ran "bup"; bup imposter intentionally failing
+EOF
+
+exit 2