forked from zepinglee/gbt7714-bibtex-style
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.sh
67 lines (53 loc) · 1.47 KB
/
check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
testfiledir="testbst"
unpackdir="build/unpacked";
testdir="build/test";
texoptions="-file-line-error -halt-on-error -interaction=nonstopmode"
unpackexe="xetex $texoptions"
checkexe="xelatex $texoptions -no-pdf"
bibtexexe="bibtex -terse"
if [ ! -d "$unpackdir" ]; then
mkdir -p "$unpackdir";
fi
cp -f "gbt7714.dtx" "$unpackdir";
if [ ! -d "$testdir" ]; then
mkdir -p "$testdir";
fi
cp -f "$testfiledir/support/standard.bib" "$testdir";
succuss=true;
echo "Running checks on";
for file in $testfiledir/*.bib; do
filename=$(basename $file);
testname=$(basename $filename .bib);
echo " $testname";
options=${testname//-/,};
content="\\input docstrip.tex
\\keepsilent
\\askforoverwritefalse
\\nopostamble
\\generate{\\file{test.bst}{\\from{gbt7714.dtx}{$options}}}
\\endbatchfile";
echo "$content" > "$unpackdir/unpack.ins";
( cd "$unpackdir"; $unpackexe unpack.ins > /dev/null; )
cp -f "$unpackdir/test.bst" "$testdir"
content="\\relax
\\bibstyle{test}
\\citation{*}
\\bibdata{standard,cases,$testname}";
echo "$content" > "$testdir/test.aux";
cp -f "$file" "$testdir"; # test bib file
( cd $testdir; $bibtexexe test > /dev/null; )
bblfile="$testdir/test.bbl";
stdfile="$testfiledir/$testname.bbl";
if ! diff -q "$bblfile" "$stdfile"; then
echo "fails";
succuss=false;
cp -f "$bblfile" "$stdfile";
fi
done
if $succuss; then
echo "";
echo "All checks passed";
echo "";
else
exit 1;
fi