From bb8b28f86acd73a5e780765667b7c94f67aaf397 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 21 Jun 2022 13:54:29 +0200 Subject: update local tests --- podman/arch-testenv | 5 +++-- podman/testdata/testscript.sh | 6 ++++-- podman/ubuntu-testenv | 5 +++-- run-tests.sh | 31 +++++++++++++++++++++++++------ 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/podman/arch-testenv b/podman/arch-testenv index 37236c9..ec05243 100644 --- a/podman/arch-testenv +++ b/podman/arch-testenv @@ -2,8 +2,9 @@ FROM docker.io/archlinux:latest MAINTAINER gerbolyze@jaseg.de RUN pacman --noconfirm -Syu -RUN pacman --noconfirm -Sy pugixml opencv pango cairo git python make clang rustup cargo python-pip base-devel +RUN pacman --noconfirm -Sy pugixml opencv pango cairo git python make clang rustup cargo python-pip base-devel gerbv rsync +RUN python3 -m pip install pytest-parallel RUN rustup install stable RUN rustup default stable -RUN cargo install usvg +RUN cargo install usvg resvg diff --git a/podman/testdata/testscript.sh b/podman/testdata/testscript.sh index 59d8b0e..d36560d 100755 --- a/podman/testdata/testscript.sh +++ b/podman/testdata/testscript.sh @@ -1,5 +1,7 @@ #!/bin/sh -pip3 install --user /data/gerbolyze-*.tar.gz --no-binary gerbolyze -/root/.local/bin/svg-flatten --clear-color black --dark-color white --format svg /data/test_svg_readme.svg /out/test_out.svg +set -e +rsync -av /data/git git +cd git +python3 -m pytest $@ diff --git a/podman/ubuntu-testenv b/podman/ubuntu-testenv index 2665d9b..5bd275e 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 libopencv-dev libpugixml-dev libpangocairo-1.0-0 libpango1.0-dev libcairo2-dev clang make python3 git python3-wheel curl python3-pip python3-venv cargo -RUN cargo install usvg +RUN env DEBIAN_FRONTEND=noninteractive apt install -y libopencv-dev libpugixml-dev libpangocairo-1.0-0 libpango1.0-dev libcairo2-dev clang make python3 git python3-wheel curl python3-pip python3-venv cargo rsync gerbv +RUN cargo install usvg resvg +RUN python3 -m pip install numpy slugify lxml click pillow scipy sphinx pytest beautifulsoup4 pytest-parallel diff --git a/run-tests.sh b/run-tests.sh index dae718b..996c1e7 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -2,13 +2,32 @@ set -e -python setup.py sdist build -cp dist/*.tar.gz podman/testdata +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 fedora debian ubuntu +for distro in ubuntu-old ubuntu arch do - podman build -t gerbolyze-$distro-testenv -f podman/$distro-testenv - mkdir -p /tmp/gerbolyze-test-out - podman run --mount type=bind,src=podman/testdata,dst=/data,ro --mount type=bind,src=/tmp/gerbolyze-test-out,dst=/out gerbolyze-$distro-testenv /data/testscript.sh + 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 -- cgit