summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gerbonara/tests/image_support.py8
-rw-r--r--podman/arch-testenv2
-rw-r--r--podman/testdata/.gitignore1
-rwxr-xr-xpodman/testdata/testscript.sh9
-rw-r--r--podman/ubuntu-testenv3
-rw-r--r--pytest.ini3
-rwxr-xr-xrun-tests.sh28
7 files changed, 38 insertions, 16 deletions
diff --git a/gerbonara/tests/image_support.py b/gerbonara/tests/image_support.py
index 0c47c8b..8941f82 100644
--- a/gerbonara/tests/image_support.py
+++ b/gerbonara/tests/image_support.py
@@ -151,8 +151,12 @@ def svg_soup(filename):
f.write(str(soup))
def cleanup_gerbv_svg(soup):
- soup.svg['width'] = f'{float(soup.svg["width"])/72*25.4:.4f}mm'
- soup.svg['height'] = f'{float(soup.svg["height"])/72*25.4:.4f}mm'
+ width = soup.svg["width"]
+ height = soup.svg["height"]
+ width = width[:-2] if width.endswith('pt') else width
+ height = height[:-2] if height.endswith('pt') else height
+ soup.svg['width'] = f'{float(width)/72*25.4:.4f}mm'
+ soup.svg['height'] = f'{float(height)/72*25.4:.4f}mm'
for group in soup.find_all('g'):
# gerbv uses Cairo's SVG canvas. Cairo's SVG canvas is kind of broken. It has no support for unit
# handling at all, which means the output files just end up being in pixels at 72 dpi. Further, it
diff --git a/podman/arch-testenv b/podman/arch-testenv
index e878362..2ab09a6 100644
--- a/podman/arch-testenv
+++ b/podman/arch-testenv
@@ -2,7 +2,7 @@
FROM docker.io/archlinux:latest
MAINTAINER gerbolyze@jaseg.de
RUN pacman --noconfirm -Syu
-RUN pacman --noconfirm -Sy git python python-pip base-devel python-numpy python-slugify python-lxml python-click python-pillow librsvg python-scipy python-sphinx python-pytest twine python-beautifulsoup4 gerbv rustup cargo
+RUN pacman --noconfirm -Sy git python python-pip base-devel python-numpy python-slugify python-lxml python-click python-pillow librsvg python-scipy python-sphinx python-pytest twine python-beautifulsoup4 gerbv rustup cargo rsync
RUN python3 -m pip install pytest-parallel
RUN rustup install stable
RUN rustup default stable
diff --git a/podman/testdata/.gitignore b/podman/testdata/.gitignore
new file mode 100644
index 0000000..5664e30
--- /dev/null
+++ b/podman/testdata/.gitignore
@@ -0,0 +1 @@
+git
diff --git a/podman/testdata/testscript.sh b/podman/testdata/testscript.sh
index 4e191b9..d36560d 100755
--- a/podman/testdata/testscript.sh
+++ b/podman/testdata/testscript.sh
@@ -1,12 +1,7 @@
#!/bin/sh
set -e
-git clone /data/git git
+rsync -av /data/git git
cd git
-if [ $# -ge 1 -a "$1" = "--parallel" ]; then
- python3 -m pytest --workers auto
-else
- python3 -m pytest -x
-fi
-
+python3 -m pytest $@
diff --git a/podman/ubuntu-testenv b/podman/ubuntu-testenv
index df8834a..1e02963 100644
--- a/podman/ubuntu-testenv
+++ b/podman/ubuntu-testenv
@@ -2,6 +2,7 @@
FROM docker.io/ubuntu:latest
MAINTAINER gerbolyze@jaseg.de
RUN env DEBIAN_FRONTEND=noninteractive apt update -y
-RUN env DEBIAN_FRONTEND=noninteractive apt install -y python3 git python3-wheel curl python3-pip python3-venv cargo
+RUN env DEBIAN_FRONTEND=noninteractive apt install -y python3 git python3-wheel curl python3-pip python3-venv cargo gerbv
RUN cargo install usvg resvg
RUN python3 -m pip install numpy slugify lxml click pillow scipy sphinx pytest beautifulsoup4 pytest-parallel
+RUN env DEBIAN_FRONTEND=noninteractive apt install -y rsync
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..06d3c26
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,3 @@
+[pytest]
+testpaths = gerbonara/tests
+norecursedirs=*
diff --git a/run-tests.sh b/run-tests.sh
index 76be006..1ed2b66 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -1,14 +1,32 @@
#!/bin/sh
set -e
-CONTAINER_ARGS="$@"
-rm -rf podman/testdata/git
-git clone --depth 1 . podman/testdata/git
+while [ $# -gt 0 ]; do
+ case $1 in
+ --parallel)
+ CONTAINER_ARGS="--workers auto $CONTAINER_ARGS"
+ shift;;
+ -x)
+ CONTAINER_ARGS="-x $CONTAINER_ARGS"
+ shift;;
+ --no-cache)
+ NO_CACHE=--no-cache
+ shift;;
+ *)
+ echo "Unknown argument \"$1\""
+ exit 1
+ shift;;
+ esac
+done
+
+mkdir -p podman/testdata/git
+git ls-tree --full-tree -r HEAD --name-only | rsync -lptgoDv --delete . --files-from - podman/testdata/git/
+#git clone --depth 1 . podman/testdata/git
-for distro in arch ubuntu
+for distro in ubuntu arch
do
- podman build -t gerbonara-$distro-testenv -f podman/$distro-testenv
+ podman build $NO_CACHE -t gerbonara-$distro-testenv -f podman/$distro-testenv
mkdir -p /tmp/gerbonara-test-out
podman run --mount type=bind,src=podman/testdata,dst=/data,ro --mount type=bind,src=/tmp/gerbonara-test-out,dst=/out gerbonara-$distro-testenv /data/testscript.sh $CONTAINER_ARGS
done