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

Side by Side Diff: tests/PathOpsSkpClipTest.cpp

Issue 400033002: update pathops core and tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix uninitialized variable Created 6 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « tests/PathOpsSimplifyTest.cpp ('k') | tests/PathOpsSkpTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1 #include "CrashHandler.h"
2 // #include "OverwriteLine.h"
3 #include "Resources.h"
2 #include "SkBitmap.h" 4 #include "SkBitmap.h"
3 #include "SkCanvas.h" 5 #include "SkCanvas.h"
4 #include "SkColor.h" 6 #include "SkColor.h"
5 #include "SkColorPriv.h" 7 #include "SkColorPriv.h"
8 #include "SkCommandLineFlags.h"
6 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkForceLinking.h"
7 #include "SkGraphics.h" 11 #include "SkGraphics.h"
8 #include "SkImageDecoder.h" 12 #include "SkImageDecoder.h"
9 #include "SkImageEncoder.h" 13 #include "SkImageEncoder.h"
10 #include "SkOSFile.h" 14 #include "SkOSFile.h"
11 #include "SkPathOpsDebug.h" 15 #include "SkPathOpsDebug.h"
12 #include "SkPicture.h" 16 #include "SkPicture.h"
13 #include "SkRTConf.h" 17 #include "SkRTConf.h"
14 #include "SkTSort.h" 18 #include "SkTSort.h"
15 #include "SkStream.h" 19 #include "SkStream.h"
16 #include "SkString.h" 20 #include "SkString.h"
17 #include "SkTArray.h" 21 #include "SkTArray.h"
18 #include "SkTDArray.h" 22 #include "SkTDArray.h"
23 #include "SkTemplates.h"
19 #include "SkThreadPool.h" 24 #include "SkThreadPool.h"
20 #include "SkTime.h" 25 #include "SkTime.h"
21 #include "Test.h" 26
27 __SK_FORCE_IMAGE_DECODER_LINKING;
28
29 /* add local exceptions here */
30 /* TODO : add command flag interface */
31 const struct SkipOverTest {
32 int directory;
33 const char* filename;
34 bool blamePathOps;
35 } skipOver[] = {
36 { 2, "http___www_groupon_sg_.skp", false}, // SkAAClip::Builder::addRun SkA SSERT(fBounds.contains(x, y));
37 { 6, "http___www_googleventures_com_.skp", true}, // addTCoincident SkASSER T(test->fT < 1);
38 { 7, "http___www_foxsports_nl_.skp", true}, // (no repro on mac) addT SkASS ERT(this != other || fVerb == SkPath::kCubic_Verb)
39 {13, "http___www_modernqigong_com_.skp", false}, // SkAAClip::Builder::addR un SkASSERT(fBounds.contains(x, y));
40 {14, "http___www_devbridge_com_.skp", true}, // checkSmallCoincidence SkASS ERT(!next->fSmall || checkMultiple);
41 {16, "http___www_1023world_net_.skp", true}, // bitmap decode assert (corru pt skp?)
42 {19, "http___www_alamdi_com_.skp", true}, // cubic/quad intersection
43 {26, "http___www_liveencounters_net_.skp", true}, // (no repro on mac) chec kSmall addT:549 (line, expects cubic)
44 {28, "http___www_encros_fr_.skp", false}, // SkAAClip::Builder::addRun SkAS SERT(fBounds.contains(x, y));
45 {37, "http___www_familysurvivalprotocol_wordpress_com_.skp", true}, // bump Span SkASSERT(span->fOppValue >= 0);
46 {39, "http___sufeinet_com_.skp", false}, // bitmap decode assert (corrupt sk p?)
47 {41, "http___www_rano360_com_.skp", true}, // checkSmallCoincidence SkASSERT (!next->fSmall || checkMultiple);
48 {44, "http___www_firstunitedbank_com_.skp", true}, // addTCancel SkASSERT(o Index > 0);
49 {46, "http___www_shinydemos_com_.skp", true}, // addSimpleAngle SkASSERT(in dex == count() - 2);
50 {48, "http___www_familysurvivalprotocol_com_.skp", true}, // bumpSpan SkASS ERT "span->fOppValue >= 0"
51 {57, "http___www_lptemp_com_.skp", true}, // addTCoincident oPeek = &other-> fTs[++oPeekIndex];
52 {71, "http___www_1milyonkahraman_org_.skp", true}, // addTCoincident SkASSE RT(test->fT < 1);
53 {88, "http___www_apuntesdelechuza_wordpress_com_.skp", true}, // bumpSpan S kASSERT "span->fOppValue >= 0"
54 {89, "http___www_mobilizedconsulting_com_.skp", true}, // addTCancel SkASSER T(oIndex > 0);
55 {93, "http___www_simple_living_in_suffolk_co_uk_.skp", true}, // bumpSpan S kASSERT "span->fOppValue >= 0"
56 };
57
58 size_t skipOverCount = sizeof(skipOver) / sizeof(skipOver[0]);
59
60
61 /* customize file in/out here */
62 /* TODO : add command flag interface */
63 #define CHROME_VERSION "1e5dfa4-4a995df"
64 #define SUMMARY_RUN 1
22 65
23 #ifdef SK_BUILD_FOR_WIN 66 #ifdef SK_BUILD_FOR_WIN
67 #define DRIVE_SPEC "D:"
24 #define PATH_SLASH "\\" 68 #define PATH_SLASH "\\"
25 #define IN_DIR "D:\\skp\\slave"
26 #define OUT_DIR "D:\\skpOut\\1\\"
27 #else 69 #else
70 #define DRIVE_SPEC ""
28 #define PATH_SLASH "/" 71 #define PATH_SLASH "/"
29 #define IN_DIR "/skp/2311328-7fc2228/slave"
30 #define OUT_DIR "/skpOut/4/"
31 #endif 72 #endif
32 73
33 const struct { 74 #define IN_DIR_PRE DRIVE_SPEC PATH_SLASH "skps" PATH_SLASH "slave"
34 int directory; 75 #define OUT_DIR_PRE DRIVE_SPEC PATH_SLASH "skpOut" PATH_SLASH "slave"
35 const char* filename; 76 #define OUT_DIR_SUM DRIVE_SPEC PATH_SLASH "skpOut" PATH_SLASH "summary"
36 } skipOverSept[] = { 77 #define DIR_POST PATH_SLASH "All" PATH_SLASH CHROME_VERSION
37 { 3, "http___www_americascup_com_.skp"}, // !simple->closed()
38 {18, "http___www_argus_presse_fr_.skp"}, // can't find winding of remaining vertical edge
39 {31, "http___www_narayana_verlag_de_.skp"}, // !simple->closed()
40 {36, "http___www_educationalcraft_com_.skp"}, // cubic / cubic near end / a ssert in SkIntersections::insert
41 {44, "http___www_cooksnaps_com_.skp"}, // !simple->isClosed()
42 {48, "http___www_narayana_publishers_com_.skp"}, // !simple->isClosed()
43 {51, "http___www_freedominthe50states_org_.skp"}, // corrupt dash data
44 {52, "http___www_aceinfographics_com_.skp"}, // right angle winding assert
45 {53, "http___www_lojaanabotafogo_com_br_.skp"}, // rrect validate assert
46 {57, "http___www_vantageproduction_com_.skp"}, // !isClosed()
47 {64, "http___www_etiqadd_com_.skp"}, // !simple->closed()
48 {84, "http___www_swapspacesystems_com_.skp"}, // !simple->closed()
49 {90, "http___www_tcmevents_org_.skp"}, // !simple->closed()
50 {96, "http___www_paseoitaigara_com_br_.skp"}, // !simple->closed()
51 {98, "http___www_mortgagemarketguide_com_.skp"}, // !simple->closed()
52 {99, "http___www_kitcheninspirations_wordpress_com_.skp"}, // checkSmall / bumpSpan
53 };
54 78
55 /* stats 79 static const char outOpDir[] = "opClip";
56 97 http___www_brandyandvinca_com_.skp pixelError=3 80 static const char outOldDir[] = "oldClip";
57 95 http___www_into_asia_com_.skp pixelError=12 81 static const char outStatusDir[] = "statusTest";
58 93 http___www_lunarplanner_com_.skp pixelError=14
59 98 http___www_lovelyitalia_com_.skp pixelError=17
60 90 http___www_inter_partner_blogspot_com_.skp pixelError=18
61 99 http___www_maxarea_com_.skp pixelError=26
62 98 http___www_maroonsnet_org_.skp pixelError=33
63 92 http___www_belinaart_ru_.skp pixelError=50
64 100 http___www_chroot_ro_.skp pixelError=62
65 99 http___www_hsbrands_com_.skp pixelError=98
66 95 http___www_tournamentindicator_com_.skp pixelError=122
67 93 http___www_businesses_com_au_.skp pixelError=162
68 90 http___www_regenesys_net_.skp pixelError=182
69 88 http___www_1863544208148625103_c18eac63985503fa85b06358959c1ba27fc36f82_blogs pot_com_.skp pixelError=186
70 97 http___www_pregacoesevangelica_com_br_.skp pixelError=240
71 77 http___www_zhenggang_org_.skp pixelError=284
72 96 http___slidesharemailer_com_.skp pixelError=522
73 94 http___www_gensteel_com_.skp pixelError=555
74 68 http___www_jf_eti_br_.skp pixelError=610
75 83 http___www_swishiat_com_.skp pixelError=706
76 96 http___www_matusikmissive_com_au_.skp pixelError=2580
77 95 http___www_momentumnation_com_.skp pixelError=3938
78 92 http___www_rssowl_com_.skp pixelError=5113
79 96 http___www_sexxygirl_tv_.skp pixelError=7605
80 99 http___www_georgevalah_wordpress_com_.skp pixelError=8386
81 78 http___www_furbo_org_.skp pixelError=8656
82 78 http___www_djxhemary_wordpress_com_.skp pixelError=8976
83 100 http___www_mindcontrolblackassassins_com_.skp pixelError=31950
84 98 http___bababillgates_free_fr_.skp pixelError=40237
85 98 http___hepatite_ro_.skp pixelError=44370
86 86 http___www_somethingwagging_com_.skp pixelError=47794
87 84 http___www_beverageuniverse_com_.skp pixelError=65450
88 50 http___www_aveksa_com_.skp pixelError=68194
89 10 http___www_publiker_pl_.skp pixelError=89997
90 61 http___www_dominos_co_id_.skp pixelError=476868
91 87 http___www_du_edu_om_.skp time=46
92 87 http___www_bigload_de_.skp time=46
93 100 http___www_home_forum_com_.skp time=48
94 97 http___www_hotamateurchat_com_.skp time=48
95 97 http___www_myrsky_com_cn_.skp time=48
96 98 http___www_techiegeex_com_.skp time=49
97 82 http___www_fashionoutletsofchicago_com_.skp time=50
98 77 http___www_dynamischbureau_nl_.skp time=50
99 82 http___www_mayihelpu_co_in_.skp time=50
100 84 http___www_vbox7_com_user_history_viewers_.skp time=50
101 85 http___www_ktokogda_com_.skp time=50
102 85 http___www_propertyturkeysale_com_.skp time=50
103 85 http___www_51play_com_.skp time=50
104 86 http___www_bayalarm_com_.skp time=50
105 87 http___www_eaglepictures_com_.skp time=50
106 88 http___www_atlasakvaryum_com_.skp time=50
107 91 http___www_pioneerchryslerjeep_com_.skp time=50
108 94 http___www_thepulsemag_com_.skp time=50
109 95 http___www_dcshoes_com_ph_.skp time=50
110 96 http___www_montrealmassage_ca_.skp time=50
111 96 http___www_jkshahclasses_com_.skp time=50
112 96 http___www_webcamconsult_com_.skp time=51
113 100 http___www_bsoscblog_com_.skp time=52
114 95 http___www_flaktwoods_com_.skp time=53
115 91 http___www_qivivo_com_.skp time=54
116 90 http___www_unitender_com_.skp time=56
117 97 http___www_casinogaming_com_.skp time=56
118 97 http___www_rootdownload_com_.skp time=56
119 94 http___www_aspa_ev_de_.skp time=57
120 98 http___www_tenpieknyswiat_pl_.skp time=57
121 93 http___www_transocean_de_.skp time=58
122 94 http___www_vdo2_blogspot_com_.skp time=58
123 94 http___www_asmaissexy_com_br_.skp time=58
124 100 http___www_prefeiturasjm_com_br_.skp time=60
125 100 http___www_eduinsuranceclick_blogspot_com_.skp time=60
126 96 http___www_bobdunsire_com_.skp time=61
127 96 http___www_omgkettlecorn_com_.skp time=61
128 85 http___www_fbbsessions_com_.skp time=62
129 86 http___www_hector_ru_.skp time=62
130 87 http___www_wereldsupporter_nl_.skp time=62
131 90 http___www_arello_com_.skp time=62
132 93 http___www_bayerplastics_com_.skp time=62
133 93 http___www_superandolamovida_com_ar_.skp time=62
134 96 http___www_med_rbf_ru_.skp time=62
135 81 http___www_carnegiescience_edu_.skp time=65
136 87 http___www_asanewengland_com_.skp time=65
137 92 http___www_turkce_karakter_appspot_com_.skp time=65
138 94 http___www_k3a_org_.skp time=65
139 96 http___www_powermaccenter_com_.skp time=65
140 98 http___www_avto49_ru_.skp time=67
141 100 http___www_hetoldeambaecht_nl_.skp time=68
142 95 http___www_marine_ie_.skp time=69
143 96 http___www_quebecvapeboutique_com_.skp time=69
144 95 http___www_brays_ingles_com_.skp time=70
145 100 http___www_lacondesa_com_.skp time=72
146 95 http___www_timbarrathai_com_au_.skp time=76
147 95 http___www_cuissedegrenouille_com_.skp time=76
148 95 http___www_iwama51_ru_.skp time=76
149 99 http___www_fotoantologia_it_.skp time=76
150 92 http___www_indian_architects_com_.skp time=78
151 92 http___www_totalwomanspa_com_.skp time=78
152 100 http___www_fachverband_spielhallen_de_.skp time=83
153 93 http___www_golshanemehr_ir_.skp time=84
154 95 http___www_maryesses_com_.skp time=84
155 99 http___www_ddcorp_ca_.skp time=89
156 90 http___www_brontops_com_.skp time=89
157 94 http___www_robgolding_com_.skp time=89
158 91 http___www_tecban_com_br_.skp time=91
159 98 http___www_costamesakarate_com_.skp time=100
160 95 http___www_monsexyblog_com_.skp time=103
161 97 http___www_stornowaygazette_co_uk_.skp time=103
162 93 http___www_fitforaframe_com_.skp time=104
163 98 http___www_intentionoftheday_com_.skp time=113
164 100 http___www_tailgateclothing_com_.skp time=117
165 95 http___www_senbros_com_.skp time=118
166 93 http___www_lettoblog_com_.skp time=121
167 94 http___www_maxineschallenge_com_au_.skp time=125
168 95 http___www_savvycard_net_.skp time=127
169 95 http___www_open_ac_mu_.skp time=129
170 96 http___www_avgindia_in_.skp time=135
171 97 http___www_stocktonseaview_com_.skp time=135
172 96 http___www_distroller_com_.skp time=142
173 94 http___www_travoggalop_dk_.skp time=144
174 100 http___www_history_im_.skp time=144
175 94 http___www_playradio_sk_.skp time=145
176 92 http___www_linglongglass_com_.skp time=151
177 97 http___www_bizzna_com_.skp time=151
178 96 http___www_spiros_ws_.skp time=154
179 91 http___www_rosen_meents_co_il_.skp time=156
180 81 http___www_hoteldeluxeportland_com_.skp time=158
181 92 http___www_freetennis_org_.skp time=161
182 93 http___www_aircharternetwork_com_au_.skp time=161
183 94 http___www_austinparks_org_.skp time=165
184 89 http___www_bevvy_co_.skp time=168
185 91 http___www_sosyalhile_net_.skp time=168
186 98 http___www_minvih_gob_ve_.skp time=171
187 89 http___www_streetfoodmtl_com_.skp time=172
188 92 http___www_loveslatinas_tumblr_com_.skp time=178
189 93 http___www_madbites_co_in_.skp time=180
190 94 http___www_rocktarah_ir_.skp time=185
191 97 http___www_penthouselife_com_.skp time=185
192 96 http___www_appymonkey_com_.skp time=196
193 92 http___www_pasargadhotels_com_.skp time=203
194 99 http___www_marina_mil_pe_.skp time=203
195 89 http___www_kays_co_uk_.skp time=205
196 77 http___www_334588_com_.skp time=211
197 83 http___www_trendbad24_de_.skp time=211
198 81 http___www_cdnetworks_co_kr_.skp time=216
199 94 http___www_schellgames_com_.skp time=223
200 95 http___www_juliaweddingnews_cn_.skp time=230
201 92 http___www_xcrafters_pl_.skp time=253
202 93 http___www_pondoo_com_.skp time=253
203 96 http___www_helsinkicapitalpartners_fi_.skp time=255
204 88 http___www_nadtexican_com_.skp time=259
205 85 http___www_canstockphoto_hu_.skp time=266
206 78 http___www_ecovacs_com_cn_.skp time=271
207 93 http___www_brookfieldplaceny_com_.skp time=334
208 93 http___www_fmastrengthtraining_com_.skp time=337
209 94 http___www_turtleonthebeach_com_.skp time=394
210 90 http___www_temptationthemovie_com_.skp time=413
211 95 http___www_patongsawaddi_com_.skp time=491
212 91 http___www_online_radio_appspot_com_.skp time=511
213 68 http___www_richardmiller_co_uk_.skp time=528
214 63 http___www_eschrade_com_.skp time=543
215 55 http___www_interaction_inf_br_.skp time=625
216 38 http___www_huskyliners_com_.skp time=632
217 86 http___granda_net_.skp time=1067
218 24 http___www_cocacolafm_com_br_.skp time=1081
219 */
220 82
221 size_t skipOverSeptCount = sizeof(skipOverSept) / sizeof(skipOverSept[0]); 83 static SkString get_in_path(int dirNo, const char* filename) {
84 SkString path;
85 SkASSERT(dirNo);
86 path.appendf("%s%d%s", IN_DIR_PRE, dirNo, DIR_POST);
87 if (!sk_exists(path.c_str())) {
88 SkDebugf("could not read %s\n", path.c_str());
89 return SkString();
90 }
91 if (filename) {
92 path.appendf("%s%s", PATH_SLASH, filename);
93 if (!sk_exists(path.c_str())) {
94 SkDebugf("could not read %s\n", path.c_str());
95 return SkString();
96 }
97 }
98 return path;
99 }
100
101 static void make_recursive_dir(const SkString& path) {
102 if (sk_exists(path.c_str())) {
103 return;
104 }
105 const char* pathStr = path.c_str();
106 int last = (int) path.size();
107 do {
108 while (last > 0 && pathStr[--last] != PATH_SLASH[0])
109 ;
110 SkASSERT(last > 0);
111 SkString shorter(pathStr, last);
112 if (sk_mkdir(shorter.c_str())) {
113 break;
114 }
115 } while (true);
116 do {
117 while (last < (int) path.size() && pathStr[++last] != PATH_SLASH[0])
118 ;
119 SkString shorter(pathStr, last);
120 SkAssertResult(sk_mkdir(shorter.c_str()));
121 } while (last < (int) path.size());
122 }
123
124 static SkString get_out_path(int dirNo, const char* dirName) {
125 SkString path;
126 SkASSERT(dirNo);
127 SkASSERT(dirName);
128 path.appendf("%s%d%s%s%s", OUT_DIR_PRE, dirNo, DIR_POST, PATH_SLASH, dirName );
129 make_recursive_dir(path);
130 return path;
131 }
132
133 static SkString get_sum_path(const char* dirName) {
134 SkString path;
135 SkASSERT(dirName);
136 path.appendf("%s%d%s%s", OUT_DIR_SUM, SUMMARY_RUN, PATH_SLASH, dirName);
137 SkDebugf("%s\n", path.c_str());
138 make_recursive_dir(path);
139 return path;
140 }
141
142 static SkString make_png_name(const char* filename) {
143 SkString pngName = SkString(filename);
144 pngName.remove(pngName.size() - 3, 3);
145 pngName.append("png");
146 return pngName;
147 }
148
149 ////////////////////////////////////////////////////////
222 150
223 enum TestStep { 151 enum TestStep {
224 kCompareBits, 152 kCompareBits,
225 kEncodeFiles, 153 kEncodeFiles,
226 }; 154 };
227 155
228 enum { 156 enum {
229 kMaxLength = 256, 157 kMaxLength = 256,
230 kMaxFiles = 128, 158 kMaxFiles = 128,
231 kSmallLimit = 1000, 159 kSmallLimit = 1000,
232 }; 160 };
233 161
234 struct TestResult { 162 struct TestResult {
235 void init(int dirNo) { 163 void init(int dirNo) {
236 fDirNo = dirNo; 164 fDirNo = dirNo;
237 sk_bzero(fFilename, sizeof(fFilename)); 165 sk_bzero(fFilename, sizeof(fFilename));
238 fTestStep = kCompareBits; 166 fTestStep = kCompareBits;
239 fScale = 1; 167 fScale = 1;
240 } 168 }
169
170 void init(int dirNo, const SkString& filename) {
171 fDirNo = dirNo;
172 strcpy(fFilename, filename.c_str());
173 fTestStep = kCompareBits;
174 fScale = 1;
175 }
241 176
242 SkString status() { 177 SkString status() {
243 SkString outStr; 178 SkString outStr;
244 outStr.printf("%s %d %d\n", fFilename, fPixelError, fTime); 179 outStr.printf("%s %d %d\n", fFilename, fPixelError, fTime);
245 return outStr; 180 return outStr;
246 } 181 }
247 182
248 SkString progress() { 183 SkString progress() {
249 SkString outStr; 184 SkString outStr;
250 outStr.printf("dir=%d %s ", fDirNo, fFilename); 185 outStr.printf("dir=%d %s ", fDirNo, fFilename);
251 if (fPixelError) { 186 if (fPixelError) {
252 outStr.appendf(" err=%d", fPixelError); 187 outStr.appendf(" err=%d", fPixelError);
253 } 188 }
254 if (fTime) { 189 if (fTime) {
255 outStr.appendf(" time=%d", fTime); 190 outStr.appendf(" time=%d", fTime);
256 } 191 }
257 if (fScale != 1) { 192 if (fScale != 1) {
258 outStr.appendf(" scale=%d", fScale); 193 outStr.appendf(" scale=%d", fScale);
259 } 194 }
260 outStr.appendf("\n"); 195 outStr.appendf("\n");
261 return outStr; 196 return outStr;
262 197
263 } 198 }
264 199
265 static void Test(int dirNo, const char* filename, TestStep testStep) {
266 TestResult test;
267 test.init(dirNo);
268 test.fTestStep = testStep;
269 strcpy(test.fFilename, filename);
270 test.testOne();
271 }
272
273 void test(int dirNo, const SkString& filename) { 200 void test(int dirNo, const SkString& filename) {
274 init(dirNo); 201 init(dirNo);
275 strcpy(fFilename, filename.c_str()); 202 strcpy(fFilename, filename.c_str());
276 testOne(); 203 testOne();
277 } 204 }
278 205
279 void testOne(); 206 void testOne();
280 207
281 char fFilename[kMaxLength]; 208 char fFilename[kMaxLength];
282 TestStep fTestStep; 209 TestStep fTestStep;
283 int fDirNo; 210 int fDirNo;
284 int fPixelError; 211 int fPixelError;
285 int fTime; 212 int fTime;
286 int fScale; 213 int fScale;
287 }; 214 };
288 215
289 class SortByPixel : public TestResult { 216 class SortByPixel : public TestResult {
290 public: 217 public:
(...skipping 10 matching lines...) Expand all
301 }; 228 };
302 229
303 class SortByName : public TestResult { 230 class SortByName : public TestResult {
304 public: 231 public:
305 bool operator<(const SortByName& rh) const { 232 bool operator<(const SortByName& rh) const {
306 return strcmp(fFilename, rh.fFilename) < 0; 233 return strcmp(fFilename, rh.fFilename) < 0;
307 } 234 }
308 }; 235 };
309 236
310 struct TestState { 237 struct TestState {
311 void init(int dirNo, skiatest::Reporter* reporter) { 238 void init(int dirNo) {
312 fReporter = reporter;
313 fResult.init(dirNo); 239 fResult.init(dirNo);
314 } 240 }
315 241
316 SkTDArray<SortByPixel> fPixelWorst; 242 SkTDArray<SortByPixel> fPixelWorst;
317 SkTDArray<SortByTime> fSlowest; 243 SkTDArray<SortByTime> fSlowest;
318 skiatest::Reporter* fReporter;
319 TestResult fResult; 244 TestResult fResult;
320 }; 245 };
321 246
322 struct TestRunner { 247 struct TestRunner {
323 TestRunner(skiatest::Reporter* reporter, int threadCount) 248 TestRunner(int threadCount)
324 : fNumThreads(threadCount) 249 : fNumThreads(threadCount) {
325 , fReporter(reporter) {
326 } 250 }
327 251
328 ~TestRunner(); 252 ~TestRunner();
329 void render(); 253 void render();
330 int fNumThreads; 254 int fNumThreads;
331 SkTDArray<class TestRunnable*> fRunnables; 255 SkTDArray<class TestRunnable*> fRunnables;
332 skiatest::Reporter* fReporter;
333 }; 256 };
334 257
335 class TestRunnable : public SkRunnable { 258 class TestRunnable : public SkRunnable {
336 public: 259 public:
337 virtual void run() SK_OVERRIDE { 260 virtual void run() SK_OVERRIDE {
338 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); 261 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024);
339 (*fTestFun)(&fState); 262 (*fTestFun)(&fState);
340 } 263 }
341 264
342 TestState fState; 265 TestState fState;
343 void (*fTestFun)(TestState*); 266 void (*fTestFun)(TestState*);
344 }; 267 };
345 268
346 269
347 class TestRunnableDir : public TestRunnable { 270 class TestRunnableDir : public TestRunnable {
348 public: 271 public:
349 TestRunnableDir(void (*testFun)(TestState*), int dirNo, TestRunner* runner) { 272 TestRunnableDir(void (*testFun)(TestState*), int dirNo, TestRunner* runner) {
350 fState.init(dirNo, runner->fReporter); 273 fState.init(dirNo);
351 fTestFun = testFun; 274 fTestFun = testFun;
352 } 275 }
353 276
354 }; 277 };
355 278
356 class TestRunnableFile : public TestRunnable { 279 class TestRunnableFile : public TestRunnable {
357 public: 280 public:
358 TestRunnableFile(void (*testFun)(TestState*), int dirNo, const char* name, T estRunner* runner) { 281 TestRunnableFile(void (*testFun)(TestState*), int dirNo, const char* name, T estRunner* runner) {
359 fState.init(dirNo, runner->fReporter); 282 fState.init(dirNo);
360 strcpy(fState.fResult.fFilename, name); 283 strcpy(fState.fResult.fFilename, name);
361 fTestFun = testFun; 284 fTestFun = testFun;
362 } 285 }
363 }; 286 };
364 287
365 class TestRunnableEncode : public TestRunnableFile { 288 class TestRunnableEncode : public TestRunnableFile {
366 public: 289 public:
367 TestRunnableEncode(void (*testFun)(TestState*), int dirNo, const char* name, TestRunner* runner) 290 TestRunnableEncode(void (*testFun)(TestState*), int dirNo, const char* name, TestRunner* runner)
368 : TestRunnableFile(testFun, dirNo, name, runner) { 291 : TestRunnableFile(testFun, dirNo, name, runner) {
369 fState.fResult.fTestStep = kEncodeFiles; 292 fState.fResult.fTestStep = kEncodeFiles;
370 } 293 }
371 }; 294 };
372 295
373 TestRunner::~TestRunner() { 296 TestRunner::~TestRunner() {
374 for (int index = 0; index < fRunnables.count(); index++) { 297 for (int index = 0; index < fRunnables.count(); index++) {
375 SkDELETE(fRunnables[index]); 298 SkDELETE(fRunnables[index]);
376 } 299 }
377 } 300 }
378 301
379 void TestRunner::render() { 302 void TestRunner::render() {
380 SkThreadPool pool(fNumThreads); 303 SkThreadPool pool(fNumThreads);
381 for (int index = 0; index < fRunnables.count(); ++ index) { 304 for (int index = 0; index < fRunnables.count(); ++ index) {
382 pool.add(fRunnables[index]); 305 pool.add(fRunnables[index]);
383 } 306 }
384 } 307 }
385 308
386 //////////////////////////////////////////////// 309 ////////////////////////////////////////////////
387 310
388 static const char outOpDir[] = OUT_DIR "opClip";
389 static const char outOldDir[] = OUT_DIR "oldClip";
390 static const char outSkpDir[] = OUT_DIR "skpTest";
391 static const char outDiffDir[] = OUT_DIR "outTest";
392 static const char outStatusDir[] = OUT_DIR "statusTest";
393
394 static SkString make_filepath(int dirNo, const char* dir, const char* name) {
395 SkString path(dir);
396 if (dirNo) {
397 path.appendf("%d", dirNo);
398 }
399 path.append(PATH_SLASH);
400 path.append(name);
401 return path;
402 }
403
404 static SkString make_in_dir_name(int dirNo) {
405 SkString dirName(IN_DIR);
406 dirName.appendf("%d", dirNo);
407 if (!sk_exists(dirName.c_str())) {
408 SkDebugf("could not read dir %s\n", dirName.c_str());
409 return SkString();
410 }
411 return dirName;
412 }
413
414 static SkString make_stat_dir_name(int dirNo) {
415 SkString dirName(outStatusDir);
416 dirName.appendf("%d", dirNo);
417 if (!sk_exists(dirName.c_str())) {
418 SkDebugf("could not read dir %s\n", dirName.c_str());
419 return SkString();
420 }
421 return dirName;
422 }
423
424 static bool make_one_out_dir(const char* outDirStr) {
425 SkString outDir = make_filepath(0, outDirStr, "");
426 if (!sk_exists(outDir.c_str())) {
427 if (!sk_mkdir(outDir.c_str())) {
428 SkDebugf("could not create dir %s\n", outDir.c_str());
429 return false;
430 }
431 }
432 return true;
433 }
434
435 static bool make_out_dirs() {
436 SkString outDir = make_filepath(0, OUT_DIR, "");
437 if (!sk_exists(outDir.c_str())) {
438 if (!sk_mkdir(outDir.c_str())) {
439 SkDebugf("could not create dir %s\n", outDir.c_str());
440 return false;
441 }
442 }
443 return make_one_out_dir(outOldDir)
444 && make_one_out_dir(outOpDir)
445 && make_one_out_dir(outSkpDir)
446 && make_one_out_dir(outDiffDir)
447 && make_one_out_dir(outStatusDir);
448 }
449
450 static SkString make_png_name(const char* filename) {
451 SkString pngName = SkString(filename);
452 pngName.remove(pngName.size() - 3, 3);
453 pngName.append("png");
454 return pngName;
455 }
456 311
457 static int similarBits(const SkBitmap& gr, const SkBitmap& sk) { 312 static int similarBits(const SkBitmap& gr, const SkBitmap& sk) {
458 const int kRowCount = 3; 313 const int kRowCount = 3;
459 const int kThreshold = 3; 314 const int kThreshold = 3;
460 int width = SkTMin(gr.width(), sk.width()); 315 int width = SkTMin(gr.width(), sk.width());
461 if (width < kRowCount) { 316 if (width < kRowCount) {
462 return true; 317 return true;
463 } 318 }
464 int height = SkTMin(gr.height(), sk.height()); 319 int height = SkTMin(gr.height(), sk.height());
465 if (height < kRowCount) { 320 if (height < kRowCount) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 canvas->save(); 422 canvas->save();
568 canvas->scale(1.0f / scale, 1.0f / scale); 423 canvas->scale(1.0f / scale, 1.0f / scale);
569 } 424 }
570 pic->draw(canvas); 425 pic->draw(canvas);
571 if (scale != 1) { 426 if (scale != 1) {
572 canvas->restore(); 427 canvas->restore();
573 } 428 }
574 } 429 }
575 430
576 static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn gName) { 431 static void writePict(const SkBitmap& bitmap, const char* outDir, const char* pn gName) {
577 SkString outFile = make_filepath(0, outDir, pngName); 432 SkString outFile = get_sum_path(outDir);
578 if (!SkImageEncoder::EncodeFile(outFile.c_str(), bitmap, 433 outFile.appendf("%s%s", PATH_SLASH, pngName);
579 SkImageEncoder::kPNG_Type, 100)) { 434 if (!SkImageEncoder::EncodeFile(outFile.c_str(), bitmap, SkImageEncoder::kPN G_Type, 100)) {
580 SkDebugf("unable to encode gr %s (width=%d height=%d)\n", pngName, 435 SkDebugf("unable to encode gr %s (width=%d height=%d)\n", pngName,
581 bitmap.width(), bitmap.height()); 436 bitmap.width(), bitmap.height());
582 } 437 }
583 } 438 }
584 439
585 void TestResult::testOne() { 440 void TestResult::testOne() {
586 SkPicture* pic = NULL; 441 SkPicture* pic = NULL;
587 { 442 {
588 #if DEBUG_SHOW_TEST_NAME 443 #if DEBUG_SHOW_TEST_NAME
589 if (fTestStep == kCompareBits) { 444 if (fTestStep == kCompareBits) {
(...skipping 10 matching lines...) Expand all
600 size_t len = testName.size(); 455 size_t len = testName.size();
601 testName.remove(len - (sizeof(dotSkp) - 1), sizeof(dotSkp) - 1); 456 testName.remove(len - (sizeof(dotSkp) - 1), sizeof(dotSkp) - 1);
602 } 457 }
603 testName.prepend("skp"); 458 testName.prepend("skp");
604 testName.append("1"); 459 testName.append("1");
605 strncpy(DEBUG_FILENAME_STRING, testName.c_str(), DEBUG_FILENAME_STRI NG_LENGTH); 460 strncpy(DEBUG_FILENAME_STRING, testName.c_str(), DEBUG_FILENAME_STRI NG_LENGTH);
606 } else if (fTestStep == kEncodeFiles) { 461 } else if (fTestStep == kEncodeFiles) {
607 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 462 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
608 } 463 }
609 #endif 464 #endif
610 SkString path = make_filepath(fDirNo, IN_DIR, fFilename); 465 SkString path = get_in_path(fDirNo, fFilename);
611 SkFILEStream stream(path.c_str()); 466 SkFILEStream stream(path.c_str());
612 if (!stream.isValid()) { 467 if (!stream.isValid()) {
613 SkDebugf("invalid stream %s\n", path.c_str()); 468 SkDebugf("invalid stream %s\n", path.c_str());
614 goto finish; 469 goto finish;
615 } 470 }
616 pic = SkPicture::CreateFromStream(&stream, &SkImageDecoder::DecodeMemory ); 471 pic = SkPicture::CreateFromStream(&stream, &SkImageDecoder::DecodeMemory );
617 if (!pic) { 472 if (!pic) {
618 SkDebugf("unable to decode %s\n", fFilename); 473 SkDebugf("unable to decode %s\n", fFilename);
619 goto finish; 474 goto finish;
620 } 475 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 writePict(oldBitmap, outOldDir, pngName); 513 writePict(oldBitmap, outOldDir, pngName);
659 writePict(opBitmap, outOpDir, pngName); 514 writePict(opBitmap, outOpDir, pngName);
660 } 515 }
661 } 516 }
662 finish: 517 finish:
663 if (pic) { 518 if (pic) {
664 pic->unref(); 519 pic->unref();
665 } 520 }
666 } 521 }
667 522
668 static SkString makeStatusString(int dirNo) { 523 DEFINE_string2(match, m, "PathOpsSkpClipThreaded",
669 SkString statName; 524 "[~][^]substring[$] [...] of test name to run.\n"
670 statName.printf("stats%d.txt", dirNo); 525 "Multiple matches may be separated by spaces.\n"
671 SkString statusFile = make_filepath(0, outStatusDir, statName.c_str()); 526 "~ causes a matching test to always be skipped\n"
672 return statusFile; 527 "^ requires the start of the test to match\n"
673 } 528 "$ requires the end of the test to match\n"
674 529 "^ and $ requires an exact match\n"
675 class PreParser { 530 "If a test does not match any list entry,\n"
531 "it is skipped unless some list entry starts with ~");
532 DEFINE_string2(dir, d, NULL, "range of directories (e.g., 1-100)");
533 DEFINE_string2(skp, s, NULL, "skp to test");
534 DEFINE_bool2(single, z, false, "run tests on a single thread internally.");
535 DEFINE_int32(testIndex, 0, "override local test index (PathOpsSkpClipOneOff only ).");
536 DEFINE_int32(threads, SkThreadPool::kThreadPerCore,
537 "Run threadsafe tests on a threadpool with this many threads.");
538 DEFINE_bool2(verbose, v, false, "enable verbose output.");
539
540 static bool verbose() {
541 return FLAGS_verbose;
542 }
543
544 static int getThreadCount() {
545 return FLAGS_single ? 1 : FLAGS_threads;
546 }
547
548 class Dirs {
676 public: 549 public:
677 PreParser(int dirNo, bool threaded) 550 Dirs() {
678 : fDirNo(dirNo) 551 reset();
679 , fIndex(0) 552 sk_bzero(fRun, sizeof(fRun));
680 , fThreaded(threaded) { 553 fSet = false;
681 SkString statusPath = makeStatusString(dirNo); 554 }
682 if (!sk_exists(statusPath.c_str())) { 555
556 int first() const {
557 int index = 0;
558 while (++index < kMaxDir) {
559 if (fRun[index]) {
560 return index;
561 }
562 }
563 SkASSERT(0);
564 return -1;
565 }
566
567 int last() const {
568 int index = kMaxDir;
569 while (--index > 0 && !fRun[index])
570 ;
571 return index;
572 }
573
574 int next() {
575 while (++fIndex < kMaxDir) {
576 if (fRun[fIndex]) {
577 return fIndex;
578 }
579 }
580 return -1;
581 }
582
583 void reset() {
584 fIndex = -1;
585 }
586
587 void set(int start, int end) {
588 while (start < end) {
589 fRun[start++] = 1;
590 }
591 fSet = true;
592 }
593
594 void setDefault() {
595 if (!fSet) {
596 set(1, 100);
597 }
598 }
599
600 private:
601 enum {
602 kMaxDir = 101
603 };
604 char fRun[kMaxDir];
605 int fIndex;
606 bool fSet;
607 } gDirs;
608
609 class Filenames {
610 public:
611 Filenames()
612 : fIndex(-1) {
613 }
614
615 const char* next() {
616 while (fNames && ++fIndex < fNames->count()) {
617 return (*fNames)[fIndex];
618 }
619 return NULL;
620 }
621
622 void set(const SkCommandLineFlags::StringArray& names) {
623 fNames = &names;
624 }
625
626 private:
627 int fIndex;
628 const SkCommandLineFlags::StringArray* fNames;
629 } gNames;
630
631 static bool buildTestDir(int dirNo, int firstDirNo,
632 SkTDArray<TestResult>* tests, SkTDArray<SortByName*>* sorted) {
633 SkString dirName = get_out_path(dirNo, outStatusDir);
634 if (!dirName.size()) {
635 return false;
636 }
637 SkOSFile::Iter iter(dirName.c_str(), "skp");
638 SkString filename;
639 while (iter.next(&filename)) {
640 TestResult test;
641 test.init(dirNo);
642 SkString spaceFile(filename);
643 char* spaces = spaceFile.writable_str();
644 int spaceSize = (int) spaceFile.size();
645 for (int index = 0; index < spaceSize; ++index) {
646 if (spaces[index] == '.') {
647 spaces[index] = ' ';
648 }
649 }
650 int success = sscanf(spaces, "%s %d %d skp", test.fFilename,
651 &test.fPixelError, &test.fTime);
652 if (success < 3) {
653 SkDebugf("failed to scan %s matched=%d\n", filename.c_str(), success );
654 return false;
655 }
656 *tests[dirNo - firstDirNo].append() = test;
657 }
658 if (!sorted) {
659 return true;
660 }
661 SkTDArray<TestResult>& testSet = tests[dirNo - firstDirNo];
662 int count = testSet.count();
663 for (int index = 0; index < count; ++index) {
664 *sorted[dirNo - firstDirNo].append() = (SortByName*) &testSet[index];
665 }
666 if (sorted[dirNo - firstDirNo].count()) {
667 SkTQSort<SortByName>(sorted[dirNo - firstDirNo].begin(),
668 sorted[dirNo - firstDirNo].end() - 1);
669 if (verbose()) {
670 SkDebugf("+");
671 }
672 }
673 return true;
674 }
675
676 static void testSkpClip(TestState* data) {
677 data->fResult.testOne();
678 SkString statName(data->fResult.fFilename);
679 SkASSERT(statName.endsWith(".skp"));
680 statName.remove(statName.size() - 4, 4);
681 statName.appendf(".%d.%d.skp", data->fResult.fPixelError, data->fResult.fTim e);
682 SkString statusFile = get_out_path(data->fResult.fDirNo, outStatusDir);
683 if (!statusFile.size()) {
684 SkDebugf("failed to create %s", statusFile.c_str());
685 return;
686 }
687 statusFile.appendf("%s%s", PATH_SLASH, statName.c_str());
688 SkFILE* file = sk_fopen(statusFile.c_str(), kWrite_SkFILE_Flag);
689 if (!file) {
690 SkDebugf("failed to create %s", statusFile.c_str());
683 return; 691 return;
684 } 692 }
685 SkFILEStream reader; 693 sk_fclose(file);
686 reader.setPath(statusPath.c_str()); 694 if (verbose()) {
687 while (fetch(reader, &fResults.push_back())) 695 if (data->fResult.fPixelError || data->fResult.fTime) {
688 ; 696 SkDebugf("%s", data->fResult.progress().c_str());
689 fResults.pop_back(); 697 } else {
690 } 698 SkDebugf(".");
691 699 }
692 bool fetch(SkFILEStream& reader, TestResult* result) { 700 }
693 char c; 701 }
694 int i = 0; 702
695 result->init(fDirNo); 703 bool Less(const SortByName& a, const SortByName& b);
696 result->fPixelError = 0; 704 bool Less(const SortByName& a, const SortByName& b) {
697 result->fTime = 0; 705 return a < b;
698 do { 706 }
699 bool readOne = reader.read(&c, 1) != 0;
700 if (!readOne) {
701 // SkASSERT(i == 0); // the current text may be incomplete -- i f so, ignore it
702 return false;
703 }
704 if (c == ' ') {
705 result->fFilename[i++] = '\0';
706 break;
707 }
708 result->fFilename[i++] = c;
709 SkASSERT(i < kMaxLength);
710 } while (true);
711 do {
712 if (!reader.read(&c, 1)) {
713 return false;
714 }
715 if (c == ' ') {
716 break;
717 }
718 SkASSERT(c >= '0' && c <= '9');
719 result->fPixelError = result->fPixelError * 10 + (c - '0');
720 } while (true);
721 bool minus = false;
722 do {
723 if (!reader.read(&c, 1)) {
724 return false;
725 }
726 if (c == '\n') {
727 break;
728 }
729 if (c == '-') {
730 minus = true;
731 continue;
732 }
733 SkASSERT(c >= '0' && c <= '9');
734 result->fTime = result->fTime * 10 + (c - '0');
735 } while (true);
736 if (minus) {
737 result->fTime = -result->fTime;
738 }
739 return true;
740 }
741
742 bool match(const SkString& filename, SkFILEWStream* stream, TestResult* resu lt) {
743 if (fThreaded) {
744 for (int index = 0; index < fResults.count(); ++index) {
745 const TestResult& test = fResults[index];
746 if (filename.equals(test.fFilename)) {
747 *result = test;
748 SkString outStr(result->status());
749 stream->write(outStr.c_str(), outStr.size());
750 return true;
751 }
752 }
753 } else if (fIndex < fResults.count()) {
754 *result = fResults[fIndex++];
755 SkASSERT(filename.equals(result->fFilename));
756 SkString outStr(result->status());
757 stream->write(outStr.c_str(), outStr.size());
758 return true;
759 }
760 return false;
761 }
762
763 private:
764 int fDirNo;
765 int fIndex;
766 SkTArray<TestResult, true> fResults;
767 bool fThreaded;
768 };
769 707
770 static bool doOneDir(TestState* state, bool threaded) { 708 static bool doOneDir(TestState* state, bool threaded) {
771 int dirNo = state->fResult.fDirNo; 709 int dirNo = state->fResult.fDirNo;
772 skiatest::Reporter* reporter = state->fReporter; 710 SkString dirName = get_in_path(dirNo, NULL);
773 SkString dirName = make_in_dir_name(dirNo);
774 if (!dirName.size()) { 711 if (!dirName.size()) {
775 return false; 712 return false;
776 } 713 }
714 SkTDArray<TestResult> tests[1];
715 SkTDArray<SortByName*> sorted[1];
716 if (!buildTestDir(dirNo, dirNo, tests, sorted)) {
717 return false;
718 }
777 SkOSFile::Iter iter(dirName.c_str(), "skp"); 719 SkOSFile::Iter iter(dirName.c_str(), "skp");
778 SkString filename; 720 SkString filename;
779 int testCount = 0;
780 PreParser preParser(dirNo, threaded);
781 SkFILEWStream statusStream(makeStatusString(dirNo).c_str());
782 while (iter.next(&filename)) { 721 while (iter.next(&filename)) {
783 for (size_t index = 0; index < skipOverSeptCount; ++index) { 722 for (size_t index = 0; index < skipOverCount; ++index) {
784 if (skipOverSept[index].directory == dirNo 723 if (skipOver[index].directory == dirNo
785 && strcmp(filename.c_str(), skipOverSept[index].filename) == 0) { 724 && strcmp(filename.c_str(), skipOver[index].filename) == 0) {
786 goto checkEarlyExit; 725 goto checkEarlyExit;
787 } 726 }
788 } 727 }
789 if (preParser.match(filename, &statusStream, &state->fResult)) {
790 (void) addError(state, state->fResult);
791 ++testCount;
792 goto checkEarlyExit;
793 }
794 { 728 {
795 TestResult& result = state->fResult; 729 SortByName name;
796 result.test(dirNo, filename); 730 name.init(dirNo);
797 SkString outStr(result.status()); 731 strncpy(name.fFilename, filename.c_str(), filename.size() - 4); // drop .skp
798 statusStream.write(outStr.c_str(), outStr.size()); 732 int count = sorted[0].count();
799 statusStream.flush(); 733 int idx = SkTSearch<SortByName, Less>(sorted[0].begin(), count, &nam e, sizeof(&name));
800 if (addError(state, result)) { 734 if (idx >= 0) {
801 SkDebugf("%s", result.progress().c_str()); 735 SortByName* found = sorted[0][idx];
802 } 736 (void) addError(state, *found);
803 } 737 continue;
804 ++testCount; 738 }
805 if (reporter->verbose()) { 739 TestResult test;
806 SkDebugf("."); 740 test.init(dirNo, filename);
807 if (++testCount % 100 == 0) { 741 state->fResult = test;
808 SkDebugf("%d\n", testCount); 742 testSkpClip(state);
809 } 743 #if 0 // artificially limit to a few while debugging code
744 static int debugLimit = 0;
745 if (++debugLimit == 5) {
746 return true;
747 }
748 #endif
810 } 749 }
811 checkEarlyExit: 750 checkEarlyExit:
812 if (0 && testCount >= 1) { 751 ;
813 return true;
814 }
815 } 752 }
816 return true; 753 return true;
817 } 754 }
818 755
819 static bool initTest() { 756 static void initTest() {
820 #if !defined SK_BUILD_FOR_WIN && !defined SK_BUILD_FOR_MAC 757 #if !defined SK_BUILD_FOR_WIN && !defined SK_BUILD_FOR_MAC
821 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); 758 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true);
822 SK_CONF_SET("images.png.suppressDecoderWarnings", true); 759 SK_CONF_SET("images.png.suppressDecoderWarnings", true);
823 #endif 760 #endif
824 return make_out_dirs(); 761 }
825 }
826
827 static bool initUberTest(int firstDirNo, int lastDirNo) {
828 if (!initTest()) {
829 return false;
830 }
831 for (int index = firstDirNo; index <= lastDirNo; ++index) {
832 SkString statusDir(outStatusDir);
833 statusDir.appendf("%d", index);
834 if (!make_one_out_dir(statusDir.c_str())) {
835 return false;
836 }
837 }
838 return true;
839 }
840
841 762
842 static void testSkpClipEncode(TestState* data) { 763 static void testSkpClipEncode(TestState* data) {
843 data->fResult.testOne(); 764 data->fResult.testOne();
844 if (data->fReporter->verbose()) { 765 if (verbose()) {
845 SkDebugf("+"); 766 SkDebugf("+");
846 } 767 }
847 } 768 }
848 769
849 static void encodeFound(skiatest::Reporter* reporter, TestState& state) { 770 static void encodeFound(TestState& state) {
850 if (reporter->verbose()) { 771 if (verbose()) {
851 if (state.fPixelWorst.count()) { 772 if (state.fPixelWorst.count()) {
852 SkTDArray<SortByPixel*> worst; 773 SkTDArray<SortByPixel*> worst;
853 for (int index = 0; index < state.fPixelWorst.count(); ++index) { 774 for (int index = 0; index < state.fPixelWorst.count(); ++index) {
854 *worst.append() = &state.fPixelWorst[index]; 775 *worst.append() = &state.fPixelWorst[index];
855 } 776 }
856 SkTQSort<SortByPixel>(worst.begin(), worst.end() - 1); 777 SkTQSort<SortByPixel>(worst.begin(), worst.end() - 1);
857 for (int index = 0; index < state.fPixelWorst.count(); ++index) { 778 for (int index = 0; index < state.fPixelWorst.count(); ++index) {
858 const TestResult& result = *worst[index]; 779 const TestResult& result = *worst[index];
859 SkDebugf("%d %s pixelError=%d\n", result.fDirNo, result.fFilenam e, result.fPixelError); 780 SkDebugf("%d %s pixelError=%d\n", result.fDirNo, result.fFilenam e, result.fPixelError);
860 } 781 }
861 } 782 }
862 if (state.fSlowest.count()) { 783 if (state.fSlowest.count()) {
863 SkTDArray<SortByTime*> slowest; 784 SkTDArray<SortByTime*> slowest;
864 for (int index = 0; index < state.fSlowest.count(); ++index) { 785 for (int index = 0; index < state.fSlowest.count(); ++index) {
865 *slowest.append() = &state.fSlowest[index]; 786 *slowest.append() = &state.fSlowest[index];
866 } 787 }
867 if (slowest.count() > 0) { 788 if (slowest.count() > 0) {
868 SkTQSort<SortByTime>(slowest.begin(), slowest.end() - 1); 789 SkTQSort<SortByTime>(slowest.begin(), slowest.end() - 1);
869 for (int index = 0; index < slowest.count(); ++index) { 790 for (int index = 0; index < slowest.count(); ++index) {
870 const TestResult& result = *slowest[index]; 791 const TestResult& result = *slowest[index];
871 SkDebugf("%d %s time=%d\n", result.fDirNo, result.fFilename, result.fTime); 792 SkDebugf("%d %s time=%d\n", result.fDirNo, result.fFilename, result.fTime);
872 } 793 }
873 } 794 }
874 } 795 }
875 } 796 }
876 797 int threadCount = getThreadCount();
877 int threadCount = reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; 798 TestRunner testRunner(threadCount);
878 TestRunner testRunner(reporter, threadCount);
879 for (int index = 0; index < state.fPixelWorst.count(); ++index) { 799 for (int index = 0; index < state.fPixelWorst.count(); ++index) {
880 const TestResult& result = state.fPixelWorst[index]; 800 const TestResult& result = state.fPixelWorst[index];
881 SkString filename(result.fFilename); 801 SkString filename(result.fFilename);
882 if (!filename.endsWith(".skp")) { 802 if (!filename.endsWith(".skp")) {
883 filename.append(".skp"); 803 filename.append(".skp");
884 } 804 }
885 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableEncode, 805 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableEncode,
886 (&testSkpClipEncode, result.fDirNo, filename.c_str(), &testRunne r)); 806 (&testSkpClipEncode, result.fDirNo, filename.c_str(), &testRunne r));
887 } 807 }
888 testRunner.render(); 808 testRunner.render();
889 #if 0
890 for (int index = 0; index < state.fPixelWorst.count(); ++index) {
891 const TestResult& result = state.fPixelWorst[index];
892 SkString filename(result.fFilename);
893 if (!filename.endsWith(".skp")) {
894 filename.append(".skp");
895 }
896 TestResult::Test(result.fDirNo, filename.c_str(), kEncodeFiles);
897 if (reporter->verbose()) SkDebugf("+");
898 }
899 #endif
900 } 809 }
901 810
902 DEF_TEST(PathOpsSkpClip, reporter) { 811 class Test {
903 if (!initTest()) { 812 public:
904 return; 813 Test() {}
905 } 814 virtual ~Test() {}
815
816 const char* getName() { onGetName(&fName); return fName.c_str(); }
817 void run() { onRun(); }
818
819 protected:
820 virtual void onGetName(SkString*) = 0;
821 virtual void onRun() = 0;
822
823 private:
824 SkString fName;
825 };
826
827 typedef SkTRegistry<Test*(*)(void*)> TestRegistry;
828
829 #define DEF_TEST(name) \
830 static void test_##name(); \
831 class name##Class : public Test { \
832 public: \
833 static Test* Factory(void*) { return SkNEW(name##Class); } \
834 protected: \
835 virtual void onGetName(SkString* name) SK_OVERRIDE { \
836 name->set(#name); \
837 } \
838 virtual void onRun() SK_OVERRIDE { test_##name(); } \
839 }; \
840 static TestRegistry gReg_##name##Class(name##Class::Factory); \
841 static void test_##name()
842
843 DEF_TEST(PathOpsSkpClip) {
844 gDirs.setDefault();
845 initTest();
906 SkTArray<TestResult, true> errors; 846 SkTArray<TestResult, true> errors;
907 TestState state; 847 TestState state;
908 state.init(0, reporter); 848 state.init(0);
909 for (int dirNo = 1; dirNo <= 100; ++dirNo) { 849 int dirNo;
910 if (reporter->verbose()) { 850 gDirs.reset();
851 while ((dirNo = gDirs.next()) > 0) {
852 if (verbose()) {
911 SkDebugf("dirNo=%d\n", dirNo); 853 SkDebugf("dirNo=%d\n", dirNo);
912 } 854 }
913 state.fResult.fDirNo = dirNo; 855 state.fResult.fDirNo = dirNo;
914 if (!doOneDir(&state, false)) { 856 if (!doOneDir(&state, false)) {
915 break; 857 break;
916 } 858 }
917 } 859 }
918 encodeFound(reporter, state); 860 encodeFound(state);
919 } 861 }
920 862
921 static void testSkpClipMain(TestState* data) { 863 static void testSkpClipMain(TestState* data) {
922 (void) doOneDir(data, true); 864 (void) doOneDir(data, true);
923 } 865 }
924 866
925 DEF_TEST(PathOpsSkpClipThreaded, reporter) { 867 DEF_TEST(PathOpsSkpClipThreaded) {
926 if (!initTest()) { 868 gDirs.setDefault();
927 return; 869 initTest();
928 } 870 int threadCount = getThreadCount();
929 int threadCount = reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; 871 TestRunner testRunner(threadCount);
930 TestRunner testRunner(reporter, threadCount); 872 int dirNo;
931 const int firstDirNo = 1; 873 gDirs.reset();
932 for (int dirNo = firstDirNo; dirNo <= 100; ++dirNo) { 874 while ((dirNo = gDirs.next()) > 0) {
933 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableDir, 875 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableDir,
934 (&testSkpClipMain, dirNo, &testRunner)); 876 (&testSkpClipMain, dirNo, &testRunner));
935 } 877 }
936 testRunner.render(); 878 testRunner.render();
937 TestState state; 879 TestState state;
938 state.init(0, reporter); 880 state.init(0);
939 for (int dirNo = firstDirNo; dirNo <= 100; ++dirNo) { 881 gDirs.reset();
882 while ((dirNo = gDirs.next()) > 0) {
940 TestState& testState = testRunner.fRunnables[dirNo - 1]->fState; 883 TestState& testState = testRunner.fRunnables[dirNo - 1]->fState;
941 SkASSERT(testState.fResult.fDirNo == dirNo); 884 SkASSERT(testState.fResult.fDirNo == dirNo);
942 for (int inner = 0; inner < testState.fPixelWorst.count(); ++inner) { 885 for (int inner = 0; inner < testState.fPixelWorst.count(); ++inner) {
943 addError(&state, testState.fPixelWorst[inner]); 886 addError(&state, testState.fPixelWorst[inner]);
944 } 887 }
945 for (int inner = 0; inner < testState.fSlowest.count(); ++inner) { 888 for (int inner = 0; inner < testState.fSlowest.count(); ++inner) {
946 addError(&state, testState.fSlowest[inner]); 889 addError(&state, testState.fSlowest[inner]);
947 } 890 }
948 } 891 }
949 encodeFound(reporter, state); 892 encodeFound(state);
950 } 893 }
951 894
952 static void testSkpClipUber(TestState* data) { 895 static bool buildTests(SkTDArray<TestResult>* tests, SkTDArray<SortByName*>* sor ted) {
953 data->fResult.testOne(); 896 int firstDirNo = gDirs.first();
954 SkString dirName = make_stat_dir_name(data->fResult.fDirNo); 897 int dirNo;
955 if (!dirName.size()) { 898 while ((dirNo = gDirs.next()) > 0) {
956 return; 899 if (!buildTestDir(dirNo, firstDirNo, tests, sorted)) {
957 }
958 SkString statName(data->fResult.fFilename);
959 SkASSERT(statName.endsWith(".skp"));
960 statName.remove(statName.size() - 4, 4);
961 statName.appendf(".%d.%d.skp", data->fResult.fPixelError, data->fResult.fTim e);
962 SkString statusFile = make_filepath(data->fResult.fDirNo, outStatusDir, stat Name.c_str());
963 SkFILE* file = sk_fopen(statusFile.c_str(), kWrite_SkFILE_Flag);
964 if (!file) {
965 SkDebugf("failed to create %s", statusFile.c_str());
966 return;
967 }
968 sk_fclose(file);
969 if (data->fReporter->verbose()) {
970 if (data->fResult.fPixelError || data->fResult.fTime) {
971 SkDebugf("%s", data->fResult.progress().c_str());
972 } else {
973 SkDebugf(".");
974 }
975 }
976 }
977
978 static bool buildTests(skiatest::Reporter* reporter, int firstDirNo, int lastDir No, SkTDArray<TestResult>* tests,
979 SkTDArray<SortByName*>* sorted) {
980 for (int dirNo = firstDirNo; dirNo <= lastDirNo; ++dirNo) {
981 SkString dirName = make_stat_dir_name(dirNo);
982 if (!dirName.size()) {
983 return false; 900 return false;
984 } 901 }
985 SkOSFile::Iter iter(dirName.c_str(), "skp");
986 SkString filename;
987 while (iter.next(&filename)) {
988 TestResult test;
989 test.init(dirNo);
990 SkString spaceFile(filename);
991 char* spaces = spaceFile.writable_str();
992 int spaceSize = (int) spaceFile.size();
993 for (int index = 0; index < spaceSize; ++index) {
994 if (spaces[index] == '.') {
995 spaces[index] = ' ';
996 }
997 }
998 int success = sscanf(spaces, "%s %d %d skp", test.fFilename,
999 &test.fPixelError, &test.fTime);
1000 if (success < 3) {
1001 SkDebugf("failed to scan %s matched=%d\n", filename.c_str(), suc cess);
1002 return false;
1003 }
1004 *tests[dirNo - firstDirNo].append() = test;
1005 }
1006 if (!sorted) {
1007 continue;
1008 }
1009 SkTDArray<TestResult>& testSet = tests[dirNo - firstDirNo];
1010 int count = testSet.count();
1011 for (int index = 0; index < count; ++index) {
1012 *sorted[dirNo - firstDirNo].append() = (SortByName*) &testSet[index] ;
1013 }
1014 if (sorted[dirNo - firstDirNo].count()) {
1015 SkTQSort<SortByName>(sorted[dirNo - firstDirNo].begin(),
1016 sorted[dirNo - firstDirNo].end() - 1);
1017 if (reporter->verbose()) {
1018 SkDebugf("+");
1019 }
1020 }
1021 } 902 }
1022 return true; 903 return true;
1023 } 904 }
1024 905
1025 bool Less(const SortByName& a, const SortByName& b); 906 DEF_TEST(PathOpsSkpClipUberThreaded) {
1026 bool Less(const SortByName& a, const SortByName& b) { 907 gDirs.setDefault();
1027 return a < b; 908 const int firstDirNo = gDirs.next();
1028 } 909 const int lastDirNo = gDirs.last();
1029 910 initTest();
1030 DEF_TEST(PathOpsSkpClipUberThreaded, reporter) { 911 int dirCount = lastDirNo - firstDirNo + 1;
1031 const int firstDirNo = 1; 912 SkAutoTDeleteArray<SkTDArray<TestResult> > tests(new SkTDArray<TestResult>[d irCount]);
1032 const int lastDirNo = 100; 913 SkAutoTDeleteArray<SkTDArray<SortByName*> > sorted(new SkTDArray<SortByName* >[dirCount]);
1033 if (!initUberTest(firstDirNo, lastDirNo)) { 914 if (!buildTests(tests.get(), sorted.get())) {
1034 return; 915 return;
1035 } 916 }
1036 const int dirCount = lastDirNo - firstDirNo + 1; 917 int threadCount = getThreadCount();
1037 SkTDArray<TestResult> tests[dirCount]; 918 TestRunner testRunner(threadCount);
1038 SkTDArray<SortByName*> sorted[dirCount]; 919 int dirNo;
1039 if (!buildTests(reporter, firstDirNo, lastDirNo, tests, sorted)) { 920 gDirs.reset();
1040 return; 921 while ((dirNo = gDirs.next()) > 0) {
1041 } 922 SkString dirName = get_in_path(dirNo, NULL);
1042 int threadCount = reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1;
1043 TestRunner testRunner(reporter, threadCount);
1044 for (int dirNo = firstDirNo; dirNo <= lastDirNo; ++dirNo) {
1045 SkString dirName = make_in_dir_name(dirNo);
1046 if (!dirName.size()) { 923 if (!dirName.size()) {
1047 continue; 924 continue;
1048 } 925 }
1049 SkOSFile::Iter iter(dirName.c_str(), "skp"); 926 SkOSFile::Iter iter(dirName.c_str(), "skp");
1050 SkString filename; 927 SkString filename;
1051 while (iter.next(&filename)) { 928 while (iter.next(&filename)) {
1052 int count; 929 for (size_t index = 0; index < skipOverCount; ++index) {
1053 SortByName name; 930 if (skipOver[index].directory == dirNo
1054 for (size_t index = 0; index < skipOverSeptCount; ++index) { 931 && strcmp(filename.c_str(), skipOver[index].filename) == 0) {
1055 if (skipOverSept[index].directory == dirNo
1056 && strcmp(filename.c_str(), skipOverSept[index].filename ) == 0) {
1057 goto checkEarlyExit; 932 goto checkEarlyExit;
1058 } 933 }
1059 } 934 }
1060 name.init(dirNo); 935 {
1061 strncpy(name.fFilename, filename.c_str(), filename.size() - 4); // drop .skp 936 SortByName name;
1062 count = sorted[dirNo - firstDirNo].count(); 937 name.init(dirNo);
1063 if (SkTSearch<SortByName, Less>(sorted[dirNo - firstDirNo].begin(), 938 strncpy(name.fFilename, filename.c_str(), filename.size() - 4); // drop .skp
1064 count, &name, sizeof(&name)) < 0) { 939 int count = sorted.get()[dirNo - firstDirNo].count();
1065 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableFile, 940 if (SkTSearch<SortByName, Less>(sorted.get()[dirNo - firstDirNo] .begin(),
1066 (&testSkpClipUber, dirNo, filename.c_str(), &testRunner) ); 941 count, &name, sizeof(&name)) < 0) {
942 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnableFil e,
943 (&testSkpClip, dirNo, filename.c_str(), &testRunner) );
944 }
1067 } 945 }
1068 checkEarlyExit: 946 checkEarlyExit:
1069 ; 947 ;
1070 } 948 }
1071 949
1072 } 950 }
1073 testRunner.render(); 951 testRunner.render();
1074 SkTDArray<TestResult> results[dirCount]; 952 SkAutoTDeleteArray<SkTDArray<TestResult> > results(new SkTDArray<TestResult> [dirCount]);
1075 if (!buildTests(reporter, firstDirNo, lastDirNo, results, NULL)) { 953 if (!buildTests(results.get(), NULL)) {
1076 return; 954 return;
1077 } 955 }
1078 SkTDArray<TestResult> allResults; 956 SkTDArray<TestResult> allResults;
1079 for (int dirNo = firstDirNo; dirNo <= lastDirNo; ++dirNo) { 957 for (int dirNo = firstDirNo; dirNo <= lastDirNo; ++dirNo) {
1080 SkTDArray<TestResult>& array = results[dirNo - firstDirNo]; 958 SkTDArray<TestResult>& array = results.get()[dirNo - firstDirNo];
1081 allResults.append(array.count(), array.begin()); 959 allResults.append(array.count(), array.begin());
1082 } 960 }
1083 int allCount = allResults.count(); 961 int allCount = allResults.count();
1084 SkTDArray<SortByPixel*> pixels; 962 SkTDArray<SortByPixel*> pixels;
1085 SkTDArray<SortByTime*> times; 963 SkTDArray<SortByTime*> times;
1086 for (int index = 0; index < allCount; ++index) { 964 for (int index = 0; index < allCount; ++index) {
1087 *pixels.append() = (SortByPixel*) &allResults[index]; 965 *pixels.append() = (SortByPixel*) &allResults[index];
1088 *times.append() = (SortByTime*) &allResults[index]; 966 *times.append() = (SortByTime*) &allResults[index];
1089 } 967 }
1090 TestState state; 968 TestState state;
1091 if (pixels.count()) { 969 if (pixels.count()) {
1092 SkTQSort<SortByPixel>(pixels.begin(), pixels.end() - 1); 970 SkTQSort<SortByPixel>(pixels.begin(), pixels.end() - 1);
1093 for (int inner = 0; inner < kMaxFiles; ++inner) { 971 for (int inner = 0; inner < kMaxFiles; ++inner) {
1094 *state.fPixelWorst.append() = *pixels[allCount - inner - 1]; 972 *state.fPixelWorst.append() = *pixels[allCount - inner - 1];
1095 } 973 }
1096 } 974 }
1097 if (times.count()) { 975 if (times.count()) {
1098 SkTQSort<SortByTime>(times.begin(), times.end() - 1); 976 SkTQSort<SortByTime>(times.begin(), times.end() - 1);
1099 for (int inner = 0; inner < kMaxFiles; ++inner) { 977 for (int inner = 0; inner < kMaxFiles; ++inner) {
1100 *state.fSlowest.append() = *times[allCount - inner - 1]; 978 *state.fSlowest.append() = *times[allCount - inner - 1];
1101 } 979 }
1102 } 980 }
1103 encodeFound(reporter, state); 981 encodeFound(state);
1104 } 982 }
1105 983
1106 DEF_TEST(PathOpsSkpClipOneOff, reporter) { 984 DEF_TEST(PathOpsSkpClipOneOff) {
1107 if (!initTest()) { 985 const int testIndex = FLAGS_testIndex;
1108 return; 986 int dirNo = gDirs.next();
987 if (dirNo < 0) {
988 dirNo = skipOver[testIndex].directory;
1109 } 989 }
1110 const int testIndex = 43 - 37; 990 const char* skp = gNames.next();
1111 int dirNo = skipOverSept[testIndex].directory; 991 if (!skp) {
1112 SkAssertResult(make_in_dir_name(dirNo).size()); 992 skp = skipOver[testIndex].filename;
1113 SkString filename(skipOverSept[testIndex].filename); 993 }
994 initTest();
995 SkAssertResult(get_in_path(dirNo, skp).size());
996 SkString filename(skp);
1114 TestResult state; 997 TestResult state;
1115 state.test(dirNo, filename); 998 state.test(dirNo, filename);
1116 if (reporter->verbose()) { 999 if (verbose()) {
1117 SkDebugf("%s", state.status().c_str()); 1000 SkDebugf("%s", state.status().c_str());
1118 } 1001 }
1119 state.fTestStep = kEncodeFiles; 1002 state.fTestStep = kEncodeFiles;
1120 state.testOne(); 1003 state.testOne();
1121 } 1004 }
1005
1006 DEF_TEST(PathOpsTestSkipped) {
1007 for (size_t index = 0; index < skipOverCount; ++index) {
1008 const SkipOverTest& skip = skipOver[index];
1009 if (!skip.blamePathOps) {
1010 continue;
1011 }
1012 int dirNo = skip.directory;
1013 const char* skp = skip.filename;
1014 initTest();
1015 SkAssertResult(get_in_path(dirNo, skp).size());
1016 SkString filename(skp);
1017 TestResult state;
1018 state.test(dirNo, filename);
1019 if (verbose()) {
1020 SkDebugf("%s", state.status().c_str());
1021 }
1022 state.fTestStep = kEncodeFiles;
1023 state.testOne();
1024 }
1025 }
1026
1027 DEF_TEST(PathOpsCopyFails) {
1028 FLAGS_verbose = true;
1029 for (size_t index = 0; index < skipOverCount; ++index) {
1030 int dirNo = skipOver[index].directory;
1031 SkDebugf("mkdir -p " IN_DIR_PRE "%d" DIR_POST "\n", dirNo);
1032 }
1033 for (size_t index = 0; index < skipOverCount; ++index) {
1034 int dirNo = skipOver[index].directory;
1035 const char* filename = skipOver[index].filename;
1036 SkDebugf("rsync -av cary-linux.cnc:/tera" PATH_SLASH "skps" PATH_SLASH " slave"
1037 "%d" DIR_POST "/%s " IN_DIR_PRE "%d" DIR_POST "\n", dirNo, filename, dirNo);
1038 }
1039 }
1040
1041 template TestRegistry* TestRegistry::gHead;
1042
1043 class Iter {
1044 public:
1045 Iter() { this->reset(); }
1046 void reset() { fReg = TestRegistry::Head(); }
1047
1048 Test* next() {
1049 if (fReg) {
1050 TestRegistry::Factory fact = fReg->factory();
1051 fReg = fReg->next();
1052 Test* test = fact(NULL);
1053 return test;
1054 }
1055 return NULL;
1056 }
1057
1058 private:
1059 const TestRegistry* fReg;
1060 };
1061
1062 int tool_main(int argc, char** argv);
1063 int tool_main(int argc, char** argv) {
1064 SetupCrashHandler();
1065 SkCommandLineFlags::SetUsage("");
1066 SkCommandLineFlags::Parse(argc, argv);
1067 SkGraphics::Init();
1068 SkString header("PathOps SkpClip:");
1069 if (!FLAGS_match.isEmpty()) {
1070 header.appendf(" --match");
1071 for (int index = 0; index < FLAGS_match.count(); ++index) {
1072 header.appendf(" %s", FLAGS_match[index]);
1073 }
1074 }
1075 if (!FLAGS_dir.isEmpty()) {
1076 int count = FLAGS_dir.count();
1077 for (int i = 0; i < count; ++i) {
1078 const char* range = FLAGS_dir[i];
1079 const char* dash = strchr(range, '-');
1080 if (!dash) {
1081 dash = strchr(range, ',');
1082 }
1083 int first = atoi(range);
1084 int last = dash ? atoi(dash + 1) : first;
1085 if (!first || !last) {
1086 SkDebugf("couldn't parse --dir %s\n", range);
1087 return 1;
1088 }
1089 gDirs.set(first, last);
1090 }
1091 }
1092 if (!FLAGS_skp.isEmpty()) {
1093 gNames.set(FLAGS_skp);
1094 }
1095 #ifdef SK_DEBUG
1096 header.append(" SK_DEBUG");
1097 #else
1098 header.append(" SK_RELEASE");
1099 #endif
1100 header.appendf(" skia_arch_width=%d", (int)sizeof(void*) * 8);
1101 if (FLAGS_verbose) {
1102 header.appendf("\n");
1103 }
1104 SkDebugf(header.c_str());
1105 Iter iter;
1106 Test* test;
1107 while ((test = iter.next()) != NULL) {
1108 SkAutoTDelete<Test> owned(test);
1109 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) {
1110 test->run();
1111 }
1112 }
1113 SkGraphics::Term();
1114 return 0;
1115 }
1116
1117 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
1118 int main(int argc, char * const argv[]) {
1119 return tool_main(argc, (char**) argv);
1120 }
1121 #endif
OLDNEW
« no previous file with comments | « tests/PathOpsSimplifyTest.cpp ('k') | tests/PathOpsSkpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698