Skip to content

Commit ba10969

Browse files
committed
build(check): run tests in installcheck rather than check
With `VPATH` builds, `completions/` symlinks are not created in the source tree, but in the build one. This causes issues because the "main" completion files the symlinks point to are not actually in the build dir, and arranging them seems to be quite a chore with autotools it seems. So the symlinks are dangling, and tests that depend on their presence will fail. Run tests against the installed tree instead; there we must have everything in place, and testing the installed setup is a good thing anyway. Refs #968
1 parent 82ca8d9 commit ba10969

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ you simply don't want to use one, you can install bash completion using the
3434
standard commands for GNU autotools packages:
3535

3636
```shell
37-
autoreconf -i # if not installing from prepared release tarball
37+
autoreconf -i # if not installing from prepared release tarball
3838
./configure
39-
make # GNU make required
40-
make check # optional, requires python3 with pytest >= 3.6, pexpect
41-
make install # as root
39+
make # GNU make required
40+
make check # optional
41+
make install # as root
42+
make installcheck # optional, requires python3 with pytest >= 3.6, pexpect
4243
```
4344

4445
These commands install the completions and helpers, as well as a

test/t/Makefile.am

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,13 @@ all:
707707

708708
PYTEST = @PYTEST@
709709

710-
check-local:
710+
# Some tests require completions/ symlinks to be in place, which would be a
711+
# chore to achieve in the build dir with VPATH builds (well not the symlinks,
712+
# but the "main" files they target), e.g. "make distcheck". Therefore we test
713+
# the installed tree instead, which isn't a bad idea in the first place.
714+
installcheck-local:
711715
ABS_TOP_BUILDDIR="$(abs_top_builddir)" \
716+
BASH_COMPLETION_TEST_BASH_COMPLETION="$(DESTDIR)/$(pkgdatadir)/bash_completion" \
712717
$(PYTEST) $(PYTESTFLAGS) $(srcdir)
713718

714719
clean-local:

test/t/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,12 @@ def bash(request) -> pexpect.spawn:
273273
bash.expect_exact(PS1)
274274

275275
# Load bashrc and bash_completion
276+
bash_completion = os.environ.get(
277+
"BASH_COMPLETION_TEST_BASH_COMPLETION",
278+
"%s/../bash_completion" % testdir,
279+
)
276280
assert_bash_exec(bash, "source '%s/config/bashrc'" % testdir)
277-
assert_bash_exec(bash, "source '%s/../bash_completion'" % testdir)
281+
assert_bash_exec(bash, "source '%s'" % bash_completion)
278282

279283
# Use command name from marker if set, or grab from test filename
280284
cmd = None # type: Optional[str]

0 commit comments

Comments
 (0)