branch: elpa/pdf-tools
commit 7a51b38310014628fe4ada9731d6d63657e8f209
Author: Vedang Manerikar <[email protected]>
Commit: Vedang Manerikar <[email protected]>
Extend docker testing framework to test against Emacs versions
Until this commit, docker-based local testing only checked whether the
epdfinfo server compiled correctly. With this commit, local testing
now also runs elisp tests against the different versions of Emacs we
currently support.
All versions of Emacs are run on Ubuntu at the moment,
but going forward I expect that we will add more operating system
variants to this matrix as well.
As test coverage increases, this will help automate away a lot of the
tests!
Relates to: #130
---
server/test/.gitignore | 1 +
server/test/Makefile | 6 ++++--
server/test/docker/lib/run-tests | 21 ++++++++++++++++++---
server/test/docker/templates/Dockerfile.common.in | 6 +++---
server/test/docker/templates/emacs-26.Dockerfile.in | 5 +++++
server/test/docker/templates/emacs-27.Dockerfile.in | 5 +++++
server/test/docker/templates/emacs-28.Dockerfile.in | 5 +++++
server/test/docker/templates/emacs-29.Dockerfile.in | 5 +++++
8 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/server/test/.gitignore b/server/test/.gitignore
new file mode 100644
index 0000000000..aaedb1f2fc
--- /dev/null
+++ b/server/test/.gitignore
@@ -0,0 +1 @@
+.start-vm
diff --git a/server/test/Makefile b/server/test/Makefile
index 303b9a1204..26a0f36af2 100644
--- a/server/test/Makefile
+++ b/server/test/Makefile
@@ -39,10 +39,10 @@ docker/%.Dockerfile: docker/templates/%.Dockerfile.in \
@echo Creating Dockerfile for target $*
cat $^ > $@
-# Build the Docker Image
+# Build the Docker Image. Since we are building a new image, remove the
existing container.
docker/.%.build: docker/%.Dockerfile ../autobuild docker/lib
@echo Building target image $*
- podman image build $(DOCKER_BUILD_ARGS) epdfinfo/$* -f $< ../
+ podman image build $(DOCKER_BUILD_ARGS) epdfinfo/$* -f $< ../../
touch $@
# Build the Docker Container
@@ -68,6 +68,8 @@ docker/.%.clean:
docker/clean: $(patsubst %, docker/.%.clean, $(DOCKER_OS))
+test: docker/test
+
clean: docker/clean
rm -f -- docker/.[^.]*.build
rm -f -- docker/.[^.]*.container
diff --git a/server/test/docker/lib/run-tests b/server/test/docker/lib/run-tests
index 43fe5e5cd2..31887bf23f 100755
--- a/server/test/docker/lib/run-tests
+++ b/server/test/docker/lib/run-tests
@@ -2,8 +2,23 @@
PATH="$(dirname "$0")":$PATH
-set -e
+run_tests_exit_success()
+{
+ echo "==============================="
+ echo " Elisp Tests succeeded. :O) "
+ echo "==============================="
+ exit 0
+}
-yes-or-enter | ./autobuild -i /bin
-yes-or-enter | ./autobuild -i /usr/bin | \
+set -e
+# Check that install completes successfully
+yes-or-enter | ./server/autobuild -i /bin
+# Check that re-install skips package installation
+yes-or-enter | ./server/autobuild -i /usr/bin | \
grep -q "Skipping package installation (already installed)"
+# Check that lisp tests run correctly, if emacs is installed and available on
PATH
+echo
+if which emacs > /dev/null 2> /dev/null; then
+ echo "Emacs found installed! Running elisp tests"
+ make test && run_tests_exit_success
+fi
diff --git a/server/test/docker/templates/Dockerfile.common.in
b/server/test/docker/templates/Dockerfile.common.in
index 083b19a576..142f0620c2 100644
--- a/server/test/docker/templates/Dockerfile.common.in
+++ b/server/test/docker/templates/Dockerfile.common.in
@@ -1,4 +1,4 @@
-ADD . /epdfinfo
-WORKDIR /epdfinfo
+COPY . /pdf-tools
+WORKDIR /pdf-tools
RUN make -s distclean || true
-CMD ["sh", "./test/docker/lib/run-tests"]
+CMD ["sh", "./server/test/docker/lib/run-tests"]
diff --git a/server/test/docker/templates/emacs-26.Dockerfile.in
b/server/test/docker/templates/emacs-26.Dockerfile.in
new file mode 100644
index 0000000000..088a991f56
--- /dev/null
+++ b/server/test/docker/templates/emacs-26.Dockerfile.in
@@ -0,0 +1,5 @@
+# -*- dockerfile -*-
+FROM silex/emacs:26-ci-cask
+ARG DEBIAN_FRONTEND=noninteractive
+# Need to install make, tzdata here to avoid stupid prompts when running
package install via autobuild
+RUN apt-get update -y && apt-get install -y make tzdata
diff --git a/server/test/docker/templates/emacs-27.Dockerfile.in
b/server/test/docker/templates/emacs-27.Dockerfile.in
new file mode 100644
index 0000000000..50cd8209be
--- /dev/null
+++ b/server/test/docker/templates/emacs-27.Dockerfile.in
@@ -0,0 +1,5 @@
+# -*- dockerfile -*-
+FROM silex/emacs:27-ci-cask
+ARG DEBIAN_FRONTEND=noninteractive
+# Need to install make, tzdata here to avoid stupid prompts when running
package install via autobuild
+RUN apt-get update -y && apt-get install -y make tzdata
diff --git a/server/test/docker/templates/emacs-28.Dockerfile.in
b/server/test/docker/templates/emacs-28.Dockerfile.in
new file mode 100644
index 0000000000..c6895ac295
--- /dev/null
+++ b/server/test/docker/templates/emacs-28.Dockerfile.in
@@ -0,0 +1,5 @@
+# -*- dockerfile -*-
+FROM silex/emacs:28-ci-cask
+ARG DEBIAN_FRONTEND=noninteractive
+# Need to install make, tzdata here to avoid stupid prompts when running
package install via autobuild
+RUN apt-get update -y && apt-get install -y make tzdata
diff --git a/server/test/docker/templates/emacs-29.Dockerfile.in
b/server/test/docker/templates/emacs-29.Dockerfile.in
new file mode 100644
index 0000000000..edbf7647c8
--- /dev/null
+++ b/server/test/docker/templates/emacs-29.Dockerfile.in
@@ -0,0 +1,5 @@
+# -*- dockerfile -*-
+FROM silex/emacs:master-ci-cask
+ARG DEBIAN_FRONTEND=noninteractive
+# Need to install make, tzdata here to avoid stupid prompts when running
package install via autobuild
+RUN apt-get update -y && apt-get install -y make tzdata