Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: test/test_unmalicious_fonts.sh

Issue 408020: Upload test scripts which I'm currently using.... (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/test_malicious_fonts.sh ('k') | test/validator-checker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/test_unmalicious_fonts.sh
===================================================================
--- test/test_unmalicious_fonts.sh (revision 0)
+++ test/test_unmalicious_fonts.sh (revision 0)
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Usage: ./test_unmalicious_fonts.sh [ttf_or_otf_file_name]
+
+BLACKLIST=./BLACKLIST.txt
+CHECKER=./idempotent
+
+if [ ! -r "$BLACKLIST" ] ; then
+ echo "$BLACKLIST is not found."
+ exit 1
+fi
+
+if [ ! -x "$CHECKER" ] ; then
+ echo "$CHECKER is not found."
+ exit 1
+fi
+
+if [ $# -eq 0 ] ; then
+ # No font file is specified. Apply this script to all TT/OT files under the
+ # BASE_DIR below.
+
+ # On Ubuntu Linux (>= 8.04), You can install ~1800 TrueType/OpenType fonts
+ # to /usr/share/fonts/truetype by:
+ # % sudo apt-get install ttf-.*[^0]$
+ BASE_DIR=/usr/share/fonts/truetype/
+ if [ ! -d $BASE_DIR ] ; then
+ # Mac OS X
+ BASE_DIR="/Library/Fonts/ /System/Library/Fonts/"
+ fi
+ # TODO(yusukes): Support Cygwin.
+
+ # Recursively call this script.
+ find $BASE_DIR -type f -name '*tf' -exec "$0" {} \;
+ echo
+ exit 0
+fi
+
+if [ $# -gt 1 ] ; then
+ echo "Usage: $0 [ttf_or_otf_file_name]"
+ exit 1
+fi
+
+# Check the font file using idempotent iff the font is not blacklisted.
+base=`basename "$1"`
+egrep -i -e "^$base" "$BLACKLIST" > /dev/null 2>&1 || "$CHECKER" "$1" > /dev/null 2>&1 || (echo ; echo "FAIL: $1 (Run $CHECKER $1 for more information.)")
+echo -n "."
Property changes on: test/test_unmalicious_fonts.sh
___________________________________________________________________
Added: svn:executable
+ *
« no previous file with comments | « test/test_malicious_fonts.sh ('k') | test/validator-checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698