Skip to content

example/Makefile: remove writable home, use TEMPDIR #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
SHELL := $(shell which bash)
IMAGE := vim-testbed-example
PLUGINS := test/plugins
# A writable home directory, required for Neovim.
WRITABLE_HOME:=$(shell tmpdir=$$(mktemp -d --dry-run); \
mkdir -m 777 $${tmpdir}; \
cd $(CURDIR)/test; \
cp -a vimrc *.vader $${tmpdir}/; \
echo $${tmpdir})
DOCKER = docker run -a stderr --rm \
-v $(CURDIR):/testplugin \
-v $(WRITABLE_HOME):/home \
-v $(CURDIR)/$(PLUGINS):/home/plugins "$(IMAGE)"

test: TEMPDIR:=$(shell mktemp -d -u)
test: test-setup
docker build -f Dockerfile.tests -t "$(IMAGE)" .
set -ex; \
mkdir -m 0777 $(TEMPDIR); \
vims="$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep vim)"; \
if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \
count_vims=0; \
Expand All @@ -29,31 +24,31 @@ test: test-setup
fi; \
for vim in "neovim-master --headless" vim-master; do \
$(DOCKER) $${vim} -u NONE \
"+py import sys; open('/home/py2', 'w').write(str(sys.version_info[0]))" \
"+py3 import sys; open('/home/py3', 'w').write(str(sys.version_info[0]))" \
"+py import sys; open('$(TEMPDIR)/py2', 'w').write(str(sys.version_info[0]))" \
"+py3 import sys; open('$(TEMPDIR)/py3', 'w').write(str(sys.version_info[0]))" \
'+q'; \
if [ "$$(<$(WRITABLE_HOME)/py2)" != "2" ]; then \
if [ "$$(<$(TEMPDIR)/py2)" != "2" ]; then \
echo "Failed to get Python version from $${vim} (2)." >&2; exit 1; \
fi; \
if [ "$$(<$(WRITABLE_HOME)/py3)" != "3" ]; then \
if [ "$$(<$(TEMPDIR)/py3)" != "3" ]; then \
echo "Failed to get Python version from $${vim} (3)." >&2; exit 1; \
fi; \
$(RM) $(WRITABLE_HOME)/py*; \
$(RM) $(TEMPDIR)/py*; \
done; \
for vim in "neovim-master --headless" vim-master; do \
$(DOCKER) $${vim} -u NONE \
"+ruby open('/home/ruby', 'w') { |f| f << 'ruby was here' }" \
"+ruby open('$(TEMPDIR)/ruby', 'w') { |f| f << 'ruby was here' }" \
'+q'; \
if [ "$$(<$(WRITABLE_HOME)/ruby)" != "ruby was here" ]; then \
if [ "$$(<$(TEMPDIR)/ruby)" != "ruby was here" ]; then \
echo "Failed to get output from Ruby for $${vim}." >&2; exit 1; \
fi; \
$(RM) $(WRITABLE_HOME)/ruby; \
$(RM) $(TEMPDIR)/ruby; \
done; \
for vim in "neovim-master --headless" vim-master; do \
$(DOCKER) $${vim} -u NONE \
"+lua io.open('/home/lua', 'w'):write('lua was here')" \
"+lua io.open('$(TEMPDIR)/lua', 'w'):write('lua was here')" \
'+q'; \
if [ "$$(<$(WRITABLE_HOME)/lua)" != "lua was here" ]; then \
if [ "$$(<$(TEMPDIR)/lua)" != "lua was here" ]; then \
echo "Failed to get output from Lua for $${vim}." >&2; exit 1; \
fi; \
done; \
Expand Down