summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2018-03-15 23:56:07 -0400
committerLuke Shumaker <lukeshu@parabola.nu>2018-10-07 19:11:28 -0400
commit0e4c8101b3d3461c3eb69c140ea7eee197ae3b8f (patch)
treef3fd05e87f54c2b762a70a564e1d8717db6b9df5
parentea9229cbc285fdeb0bf9ed67c7f0634bc9c2906b (diff)
Don't use Docker for the test suite / use libremakepkg
-rw-r--r--.travis.yml3
-rw-r--r--Makefile18
-rw-r--r--README.md2
-rw-r--r--test/Dockerfile20
-rw-r--r--test/Makefile5
-rw-r--r--test/lib/common.bash10
6 files changed, 17 insertions, 41 deletions
diff --git a/.travis.yml b/.travis.yml
index 0b0519c..ef3d669 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,8 +2,5 @@ sudo: required
language: bash
-services:
- - docker
-
script:
- make test
diff --git a/Makefile b/Makefile
index 988d335..ecb78c9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,11 @@
-IMAGE:=dbscripts/test
-RUN_OPTIONS:=--rm --network=none -v $(PWD):/dbscripts:ro --tmpfs=/tmp:exec -w /dbscripts/test
+all:
+.PHONY: all
-test-image:
- docker build --pull -t $(IMAGE) test
+test:
+ $(MAKE) -C test test
-test: test-image
- docker run $(RUN_OPTIONS) $(IMAGE) make test
-
-test-coverage: test-image
+test-coverage:
rm -rf ${PWD}/coverage
- mkdir -m 777 ${PWD}/coverage
- docker run $(RUN_OPTIONS) -v ${PWD}/coverage:/coverage -e COVERAGE_DIR=/coverage $(IMAGE) make test-coverage
+ $(MAKE) -C test test-coverage
-.PHONY: test-image test test-coverage
+.PHONY: test test-coverage
diff --git a/README.md b/README.md
index 0443801..258226d 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,6 @@ Things that haven't been mentioned yet:
- `cron-jobs/devlist-mailer`
- `cron-jobs/sourceballs`
## Testing
-* Install the `make` and `docker` packages. Start the docker daemon by issuing `systemctl start docker`.
+* Install the `base-devel` package group, as well as the `bash-bats`, `kcov`, `librelib`, and `subversion` packages.
* The test suite can now be run with `make test`.
* A coverage report can be generated with `make test-coverage`. Open `coverage/index.html` in your web browser to inspect the results.
diff --git a/test/Dockerfile b/test/Dockerfile
deleted file mode 100644
index cb40570..0000000
--- a/test/Dockerfile
+++ /dev/null
@@ -1,20 +0,0 @@
-FROM archlinux/base
-RUN pacman -Syu --noconfirm --needed sudo fakeroot awk subversion make kcov bash-bats gettext grep expac
-RUN pacman-key --init
-RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/wheel
-RUN useradd -N -g users -G wheel -d /build -m tester
-USER tester
-RUN echo -e "\
-Key-Type: RSA\n\
-Key-Length: 1024\n\
-Key-Usage: sign\n\
-Name-Real: Bob Tester\n\
-Name-Email: tester@localhost\n\
-Expire-Date: 0\n\
-%no-protection\n\
-%commit\n"\
-| gpg --quiet --batch --no-tty --no-permission-warning --gen-key
-RUN gpg --export | sudo pacman-key -a -
-RUN sudo pacman-key --lsign-key tester@localhost
-ENV BUILDDIR=/build
-ENV PACKAGER="Bob Tester <tester@localhost>"
diff --git a/test/Makefile b/test/Makefile
index d9437bf..3252374 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,10 +1,13 @@
+export BUILDDIR ?= $(or $(TMPDIR),/tmp)/dbscripts-build
+COVERAGE_DIR ?= $(CURDIR)/../coverage
+
test:
PATH=$(CURDIR)/../:$(CURDIR)/../cron-jobs/:$(PATH) bats cases
test-coverage:
PATH=$(CURDIR)/../:$(CURDIR)/../cron-jobs/:$(PATH) kcov \
--include-path=$(CURDIR)/../ \
- --exclude-path=$(CURDIR)/../test,$(CURDIR)/../cron-jobs/makepkg.conf,$(CURDIR)/../config \
+ --exclude-path=$(CURDIR)/../test,$(CURDIR)/../config \
$(COVERAGE_DIR) \
bats cases
diff --git a/test/lib/common.bash b/test/lib/common.bash
index c4053ec..6e9394c 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -47,12 +47,12 @@ __buildPackage() {
pkgarches=($(. PKGBUILD; echo ${arch[@]}))
for tarch in ${pkgarches[@]}; do
if [ "${tarch}" == 'any' ]; then
- PKGDEST=${pkgdest} PKGEXT=${PKGEXT} makepkg -c
- mapfile -tO "${#pkgfiles[@]}" pkgfiles < <(PKGDEST=${pkgdest} PKGEXT=${PKGEXT} makepkg --packagelist)
- else
- PKGDEST=${pkgdest} PKGEXT=${PKGEXT} CARCH=${tarch} makepkg -c
- mapfile -tO "${#pkgfiles[@]}" pkgfiles < <(PKGDEST=${pkgdest} PKGEXT=${PKGEXT} CARCH=${tarch} makepkg --packagelist)
+ tarch=$(source "$(librelib conf)" && load_conf makepkg.conf CARCH && printf '%s\n' "$CARCH")
fi
+ sudo librechroot -n "dbscripts@${tarch}" -A "$tarch" sync
+ mapfile -tO "${#pkgfiles[@]}" pkgfiles < <(PKGDEST=${pkgdest} PKGEXT=${PKGEXT} CARCH=${tarch} makepkg --packagelist)
+ sudo librechroot -n "dbscripts@${tarch}" run bash -c "$(printf '%q ' echo "PKGEXT=${PKGEXT@Q}") >> /etc/makepkg.conf"
+ sudo PKGDEST="${pkgdest}" libremakepkg -n "dbscripts@${tarch}"
done
for p in ${pkgfiles[@]}; do