summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVedang Manerikar <ved.manerikar@gmail.com>2022-11-24 19:00:30 +0530
committerVedang Manerikar <ved.manerikar@gmail.com>2022-11-25 12:57:23 +0530
commit7a51b38310014628fe4ada9731d6d63657e8f209 (patch)
treed0e766fb2f87600a2d2c4d7afae3352c4bda58a8
parente10d9cedad5007e9435788b31aec6eb4b5ce964f (diff)
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
-rw-r--r--server/test/.gitignore1
-rw-r--r--server/test/Makefile6
-rwxr-xr-xserver/test/docker/lib/run-tests21
-rw-r--r--server/test/docker/templates/Dockerfile.common.in6
-rw-r--r--server/test/docker/templates/emacs-26.Dockerfile.in5
-rw-r--r--server/test/docker/templates/emacs-27.Dockerfile.in5
-rw-r--r--server/test/docker/templates/emacs-28.Dockerfile.in5
-rw-r--r--server/test/docker/templates/emacs-29.Dockerfile.in5
8 files changed, 46 insertions, 8 deletions
diff --git a/server/test/.gitignore b/server/test/.gitignore
new file mode 100644
index 0000000..aaedb1f
--- /dev/null
+++ b/server/test/.gitignore
@@ -0,0 +1 @@
+.start-vm
diff --git a/server/test/Makefile b/server/test/Makefile
index 303b9a1..26a0f36 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 43fe5e5..31887bf 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 083b19a..142f062 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 0000000..088a991
--- /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 0000000..50cd820
--- /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 0000000..c6895ac
--- /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 0000000..edbf764
--- /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