Browse Source

Add dependency for siunitx, test LaTeX compilation

Vecna 3 months ago
parent
commit
509dc31483
2 changed files with 13 additions and 1 deletions
  1. 1 1
      Dockerfile
  2. 12 0
      scripts/test.sh

+ 1 - 1
Dockerfile

@@ -5,7 +5,7 @@
 FROM rust:1.93.0
 WORKDIR /home/analysis/
 RUN apt update -y && apt upgrade -y
-RUN apt install -y curl python3 python3-numpy python3-pandas texlive texlive-fonts-extra texlive-publishers
+RUN apt install -y curl python3 python3-numpy python3-pandas texlive texlive-fonts-extra texlive-publishers texlive-science
 ADD belarus-2020-2021 /home/analysis/belarus-2020-2021
 ADD parsing-results /home/analysis/parsing-results
 ENV SHELL=/bin/bash

+ 12 - 0
scripts/test.sh

@@ -3,9 +3,21 @@
 # Cursory tests that things are set up
 
 docker run --name "tp-analysis-test" --rm -d -i tp-analysis:latest || exit 1
+
+# Check that dependencies are installed
 docker exec tp-analysis-test sh -c "cd /home/analysis/belarus-2020-2021 && command -v curl && command -v python3 && ./scripts/check-python-deps.py" || exit 1
+
+# Check that we can compile LaTeX
+cp parsing-results/table-header.tex test-table.tex && \
+    cat parsing-results/troll-patrol-table-header.tex >> test-table.tex && \
+    echo '1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\' >> test-table.tex && \
+    cat parsing-results/table-footer.tex >> test-table.tex && \
+    docker cp test-table.tex tp-analysis-test:/home/analysis/parsing-results/test-table.tex && \
+    docker exec tp-analysis-test sh -c "cd /home/analysis/parsing-results && while pdflatex test-table.tex && grep -q 'Rerun to get' test-table.log; do true; done" && \
+    docker cp tp-analysis-test:/home/analysis/parsing-results/test-table.pdf test-table.pdf || exit 1
 docker stop tp-analysis-test
 
+# Unit tests for the three versions of Lox
 docker run --name "lox-old-test" --rm -d -i lox-old:latest || exit 1
 for i in open_invite trust_promotion level0_migration level_up issue_invite redeem_invite mark_unreachable blockage_migration; do
     docker exec lox-old-test cargo test --release --features fast test_$i 2> /dev/null | grep "$i"