Debian Codegraph @

texk/kpathsea/tests/cnfline.test

raw
1 #!/bin/sh -vx
2 # $Id: cnfline.test 68082 2023-08-27 14:18:10Z takuji $
3 # Copyright 2019 Karl Berry <[email protected]>
4 # You may freely use, modify and/or distribute this file.
5
6 BinDir=${BinDir:-.}
7 ExeExt=${ExeExt:-}
8 _kpsewhich=$BinDir/kpsewhich$ExeExt
9
10 cnf_dir=$srcdir/tests/cnfline
11
12 # just in case they are set in the environment
13 unset maxpr
14 unset othervar
15
16 remove_cr() {
17 if [ "$ExeExt" = ".exe" ]; then
18 val=`echo $val | sed -e 's/\\r//'`
19 fi
20 }
21
22 # Just for fun, let's first try the --cnf-line feature to set TEXMFCNF.
23 val=`$_kpsewhich "--cnf-line=TEXMFCNF=$cnf_dir" --var-value=othervar`; remove_cr
24 test x"$val" = x300 || exit 1
25
26 # But for the rest, just use the environment, to keep things simpler.
27 TEXMFCNF=$cnf_dir; export TEXMFCNF
28 # In Windows, exe binaries fail to get environment variables from sh scripts
29 # and still we need --cnf-line.
30 if [ "$ExeExt" = ".exe" ]; then
31 _kpsewhich="$BinDir/kpsewhich$ExeExt --cnf-line=TEXMFCNF=$cnf_dir"
32 fi
33
34 # Make sure we get expected values from the test texmf.cnf.
35 val=`$_kpsewhich --var-value=maxpr`; remove_cr
36 test x"$val" = x200 || exit 2
37 #
38 val=`$_kpsewhich --progname=foo --var-value=maxpr`; remove_cr
39 test x"$val" = x100 || exit 3
40 #
41 val=`$_kpsewhich --var-value=othervar`; remove_cr
42 test x"$val" = x300 || exit 4
43
44 # Now override on cmd line -- both texmf.cnf values should get overridden.
45 val=`$_kpsewhich --cnf-line=maxpr=99 --var-value=maxpr`; remove_cr
46 test x"$val" = x99 || exit 5