| 1 |
#!/bin/bash |
| 2 |
set -e |
| 3 |
|
| 4 |
cd "$(dirname "$0")/.." |
| 5 |
|
| 6 |
# Run autotools if configure doesn't exist |
| 7 |
if [ ! -f configure ]; then |
| 8 |
echo "==> Running autotools..." |
| 9 |
aclocal |
| 10 |
autoconf |
| 11 |
automake --add-missing |
| 12 |
autoreconf |
| 13 |
fi |
| 14 |
|
| 15 |
# Run configure if Makefile doesn't exist |
| 16 |
if [ ! -f Makefile ]; then |
| 17 |
echo "==> Running ./configure..." |
| 18 |
./configure |
| 19 |
fi |
| 20 |
|
| 21 |
# Build |
| 22 |
echo "==> Building..." |
| 23 |
make -j"$(nproc)" |
| 24 |
|
| 25 |
# Set up test venv if it doesn't exist |
| 26 |
if [ ! -f tests/.venv/bin/stestr ]; then |
| 27 |
echo "==> Setting up test venv..." |
| 28 |
python3 -m venv tests/.venv |
| 29 |
tests/.venv/bin/pip install -r test-requirements.txt |
| 30 |
fi |
| 31 |
|
| 32 |
# Generate test images if needed |
| 33 |
if [ ! -f testdata/with_text.png ]; then |
| 34 |
echo "==> Generating test images..." |
| 35 |
tests/.venv/bin/python tests/generate_test_images.py |
| 36 |
fi |
| 37 |
|
| 38 |
# Run tests |
| 39 |
echo "==> Running tests..." |
| 40 |
tests/.venv/bin/stestr run |