Debian Codegraph @

texk/web2c/luatexdir/luaoutputdir.test

raw
1 #! /bin/sh -vx
2 # luaoutputdir.test - check that Lua-level kpse.* reads from -output-directory.
3 # Public domain. Originally written by Karl Berry, 2023.
4 # https://github.com/latex3/latex3/issues/1070
5
6 BinDir=${BinDir:-.} # ordinarily run from the web2c builddir
7 ExeExt=${ExeExt:-}
8 _luatex=$BinDir/luatex$ExeExt
9
10 # in case we're invoked standalone instead of from make.
11 test -z "$srcdir" && srcdir=`cd \`dirname $0\`/.. && pwd` # web2c/
12 TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
13
14 outdir=tests/outdirlua
15 outfile=outfileLUA.tex
16 rm -rf $outdir # don't let previous runs interfere
17 test -d tests || mkdir -p tests # ensure subdir exists
18 mkdir $outdir || exit 1
19
20 $_luatex -ini -output-directory=$outdir '\immediate\openout1='$outfile'\end' \
21 || exit 3
22
23 ls -l $outdir/$outfile || exit 7
24
25 # Then we should be able to read it back in TeX.
26 $_luatex -ini -output-directory=$outdir '\input '$outfile' \end' || exit 9
27
28 # And we should also be able to read it back in Lua.
29 $_luatex -ini -output-directory=$outdir \
30 '\catcode123=1 \catcode125=2
31 \directlua{local file=kpse.find_file("'$outfile'");
32 if (file == nil) then os.exit(1); end}
33 \end
34 ' || exit 11
35
36 exit 0