diff options
| author | Alex Richardson | 2020-09-28 16:53:37 +0100 |
|---|---|---|
| committer | Alex Richardson | 2020-09-28 16:53:37 +0100 |
| commit | bc73f660dc1a4b119670e66def7041fd328a715a (patch) | |
| tree | 4ba1f203800b46e3a68cd8078ffda3417db2b55f | |
| parent | 1ed71fb2a5dbf1b1a44d25a8b9588c8e0f43144f (diff) | |
LaTeX tests: check that the generated code builds
| -rw-r--r-- | test/latex/main.tex | 44 | ||||
| -rwxr-xr-x | test/latex/run_tests.sh | 17 |
2 files changed, 58 insertions, 3 deletions
diff --git a/test/latex/main.tex b/test/latex/main.tex new file mode 100644 index 00000000..154ad0c2 --- /dev/null +++ b/test/latex/main.tex @@ -0,0 +1,44 @@ +\documentclass{article} +\usepackage{etoolbox} +\usepackage{hyperref} +\usepackage{xcolor} +\usepackage{listings} +\lstdefinelanguage{sail} + { morekeywords={val,function,mapping,cast,type,forall,overload,operator,enum,union,undefined,exit,and,assert,sizeof, + scattered,register,inc,dec,if,then,else,effect,let,as,@,in,end,Type,Int,Order,match,clause,struct, + foreach,from,to,by,infix,infixl,infixr,bitfield,default,try,catch,throw,constraint}, + keywordstyle={\bf\ttfamily\color{blue}}, + morestring=[b]", + stringstyle={\ttfamily\color{red}}, + morecomment=[l][\itshape\color{DarkGreen}]{//}, + morecomment=[s][\itshape\color{DarkGreen}]{/*}{*/}, + deletestring=[bd]{'}, + escapechar=\#, + emphstyle={\it}, + literate= + {\{|}{{$\{|$}}1 + {|\}}{{$|\}$}}1 + } + +\input{out/commands.tex} +\begin{document} + +\clearpage +type: \sailtype{cap_uperms_width} + +\clearpage +reftytpe: \sailreftype{cap\_uperms\_width}{ref to cap\_uperms\_width} + +\clearpage +val: \sailval{main} + +\clearpage +refval: \sailrefval{main}{ref to main} + +\clearpage +\sailfn{main} + +\clearpage +reffn: \sailreffn{main}{ref to main} + +\end{document} diff --git a/test/latex/run_tests.sh b/test/latex/run_tests.sh index 6ba3ce6f..8c317b98 100755 --- a/test/latex/run_tests.sh +++ b/test/latex/run_tests.sh @@ -26,7 +26,6 @@ for testfile in *.sail; do exp_prefix=${testfile//.sail/} errmsg="Missing .exp files for $testfile?" for expected in "${exp_prefix}"*.exp; do - echo "expected=$expected" # remove prefix and suffix exp_file_name=${expected//${exp_prefix}./} generated_file="$temp_dir/out/${exp_file_name//.exp/}" @@ -42,10 +41,22 @@ for testfile in *.sail; do fi done if [ -z "$errmsg" ]; then - green "LaTeX for $testfile" "ok" + green "Generating LaTeX for $testfile" "ok" else - yellow "LaTeX for $testfile" "$errmsg" + yellow "Generating LaTeX for $testfile" "$errmsg" fi; + # Check that the generated latex builds: + if command -v latexmk > /dev/null; then + cp -f "$DIR/main.tex" "$temp_dir" + if latexmk -pdf -cd -interaction=batchmode "$temp_dir/main.tex" > /dev/null 2>&1; then + green "Building LaTeX for $testfile" "ok" + else + tail -n 50 "$temp_dir/main.log" + yellow "Building LaTeX for $testfile" "failed to build" + fi + else + red "Building LaTeX for $testfile" "latexmk not installed" + fi else red "failed to generate latex for $testfile" "fail" fi |
