forked from zepinglee/gbt7714-bibtex-style
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.sh
55 lines (43 loc) · 1.23 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
testfiledir="testbst"
testsuppdir="$testfiledir/support"
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"
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/test.aux" "$testdir";
cp -f "$testfiledir/support/standard.bib" "$testdir";
succuss=true;
echo "Running checks on";
for file in $testfiledir/*.dtx; do
filename=$(basename $file);
testname=$(basename $filename .dtx);
echo " $testname";
cp -f "$file" "$unpackdir"; # test bib file
( cd "$unpackdir"; $unpackexe $filename > /dev/null; )
cp -f "$unpackdir/test.bst" "$testdir"
cp -f "$unpackdir/test.bib" "$testdir"
( 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