-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add shell script to debug repeatable builds
to aid reproduce #647
- Loading branch information
1 parent
8ef01ff
commit 49f8e46
Showing
2 changed files
with
63 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# This script is used to test that fontc produces repeatable builds. | ||
|
||
if [ -z "$1" ]; then | ||
echo "Error: Please provide path to a font source to compile" | ||
exit 1 | ||
fi | ||
|
||
INPUT_SOURCE="$1" | ||
filename=$(basename "$INPUT_SOURCE") | ||
first="build/${filename%.*}.ttf" | ||
second="build/${filename%.*}#1.ttf" | ||
|
||
ttcmp() { | ||
if [ "$#" -lt 2 ] | ||
then | ||
echo "Usage: ttcmp FONT1.ttf FONT2.ttf" | ||
return 1 | ||
fi | ||
cmp $1 $2 | ||
if [ $? -ne 0 ]; then | ||
# tail -n +2 to skip past the first line because it emits the filename | ||
diff -u <(ttx -l $1 | tail -n +2) <(ttx -l $2 | tail -n +2) | ||
fi | ||
} | ||
|
||
echo "$ which fontc" | ||
which fontc | ||
|
||
echo "$ fontc $INPUT_SOURCE -o $first" | ||
fontc "$INPUT_SOURCE" -o $first | ||
|
||
echo "$ fontc $INPUT_SOURCE -o $second" | ||
fontc "$INPUT_SOURCE" -o $second | ||
|
||
echo "$ ttcmp $first $second" | ||
ttcmp $first $second | ||
if [ $? -eq 0 ]; then | ||
echo "Success: $first and $second are identical" | ||
else | ||
echo "Error: $first and $second are different" | ||
exit 1 | ||
fi |