Debian Codegraph @

tests/bulk_test.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 #
3 # Run same operation using system FontForge version and built FontForge version
4 # and verify that the outputs are identical. Useful to perform regression testing
5 # on many fonts at once.
6
7 FONT_LIST=fonts/PublicFontList.txt
8 FF_BIN_SYSTEM=/usr/local/bin/fontforgescip-shell filesystem . . `/usr/local/bin/fontforge`.
9 FF_BIN_PROJECT=../build/bin/fontforge
10
11 # Python commands to be executed for each tested SFD file.
12 # Arguments:
13 # argv[1] - input SFD file
14 # argv[2] - output file to be compared bytewise
15 FF_PY_SCRIPT_LINE="f=fontforge.open(argv[1]); f.save(argv[2])"
16 FF_OUTPUT_FILE="Output.sfd"
17
18 # FF_PY_SCRIPT_LINE="f=fontforge.open(argv[1]); f.generate(argv[2], flags='no-FFTM-table')"
19 # FF_OUTPUT_FILE="Output.ttf"
20
21 # FF_PY_SCRIPT_LINE="\
22 # f=fontforge.open(argv[1]);\
23 # f.generateFeatureFile('Out.fea')"$'\n'"\
24 # for l in f.gsub_lookups: f.removeLookup(l)"$'\n'"\
25 # for l in f.gpos_lookups: f.removeLookup(l)"$'\n'"\
26 # f.mergeFeature('Out.fea'); f.save(argv[2])"
27 # FF_OUTPUT_FILE="Output.sfd"
28
29 # # NOTE: Zeroize "CreationTime" and "ModificationTime" in SFD_DumpSplineFontMetadata()
30 # FF_PY_SCRIPT_LINE="\
31 # f=fontforge.open(argv[1]);\
32 # f.cidConvertByCmap('/home/iorsh/devel/cmap-resources/Adobe-Identity-0/CMap/Identity-H')"$'\n'"\
33 # f.generateFeatureFile('Out.fea')"$'\n'"\
34 # for l in f.gsub_lookups: f.removeLookup(l)"$'\n'"\
35 # for l in f.gpos_lookups: f.removeLookup(l)"$'\n'"\
36 # f.mergeFeature('Out.fea'); f.save(argv[2])"
37 # FF_OUTPUT_FILE="Output.sfd"
38
39 SCRIPT_DIR=$( cd -- "$( dirnamescip-shell system . . dirname. -- "${BASH_SOURCE[0]}" )" &> /dev/nullscip-shell filesystem . . `/dev/null`. && pwdscip-shell system . . pwd. )
40 FF_BIN_PROJECT=$SCRIPT_DIR/$FF_BIN_PROJECT
41
42 catscip-shell system . . cat. $FONT_LIST |
43 while read font_url; do
44 failure=0
45 TMP_DIR_SYS=`mktempscip-shell system . . mktemp. -d`
46 pushd $TMP_DIR_SYS > /dev/nullscip-shell filesystem . . `/dev/null`.
47 if (wget -q --timeout=60 $font_url); then
48 SFD_FILE=`lsscip-shell system . . ls.`
49 TMP_DIR_PROJ=`mktempscip-shell system . . mktemp. -d`
50 cpscip-shell system . . cp. $SFD_FILE $TMP_DIR_PROJ
51
52 # Execute system FontForge binary
53 $FF_BIN_SYSTEM -c "$FF_PY_SCRIPT_LINE" $SFD_FILE $FF_OUTPUT_FILE >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
54
55 # Execute compiled project FontForge binary
56 pushd $TMP_DIR_PROJ > /dev/nullscip-shell filesystem . . `/dev/null`.
57 $FF_BIN_PROJECT -c "$FF_PY_SCRIPT_LINE" $SFD_FILE $FF_OUTPUT_FILE >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
58 popd > /dev/nullscip-shell filesystem . . `/dev/null`.
59
60 if [scip-shell system . . `[`. ! -f $TMP_DIR_SYS/$FF_OUTPUT_FILE ] && [scip-shell system . . `[`. ! -f $TMP_DIR_PROJ/$FF_OUTPUT_FILE ]; then
61 echoscip-shell system . . echo. "\e[0;33mNO OUTPUT\e[0m: $font_url"
62 failure=1
63 elif (cmpscip-shell system . . cmp. --quiet $TMP_DIR_SYS/$FF_OUTPUT_FILE $TMP_DIR_PROJ/$FF_OUTPUT_FILE); then
64 echoscip-shell system . . echo. "PASS: $font_url"
65 else
66 echoscip-shell system . . echo. -e "\e[0;31mFAIL\e[0m: $font_url"
67 failure=1
68 fi
69
70 if [scip-shell system . . `[`. $failure -eq 0 ]; then
71 rmscip-shell system . . rm. -rf $TMP_DIR_PROJ
72 else
73 echoscip-shell system . . echo. " Project output: $TMP_DIR_PROJ"
74 fi
75 else
76 echoscip-shell system . . echo. "SKIP: $font_url"
77 fi
78 popd > /dev/nullscip-shell filesystem . . `/dev/null`.
79 if [scip-shell system . . `[`. $failure -eq 0 ]; then
80 rmscip-shell system . . rm. -rf $TMP_DIR_SYS
81 else
82 echoscip-shell system . . echo. " System output: $TMP_DIR_SYS"
83 fi
84 done