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

Side by Side Diff: gm/gmmain.cpp

Issue 27752002: GM: add --ignoreFailuresFile as an alternative to --ignoreTests (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 /* 8 /*
9 * Code for the "gm" (Golden Master) rendering comparison tool. 9 * Code for the "gm" (Golden Master) rendering comparison tool.
10 * 10 *
(...skipping 18 matching lines...) Expand all
29 #include "SkGPipe.h" 29 #include "SkGPipe.h"
30 #include "SkGraphics.h" 30 #include "SkGraphics.h"
31 #include "SkImageDecoder.h" 31 #include "SkImageDecoder.h"
32 #include "SkImageEncoder.h" 32 #include "SkImageEncoder.h"
33 #include "SkOSFile.h" 33 #include "SkOSFile.h"
34 #include "SkPDFRasterizer.h" 34 #include "SkPDFRasterizer.h"
35 #include "SkPicture.h" 35 #include "SkPicture.h"
36 #include "SkRefCnt.h" 36 #include "SkRefCnt.h"
37 #include "SkScalar.h" 37 #include "SkScalar.h"
38 #include "SkStream.h" 38 #include "SkStream.h"
39 #include "SkString.h"
39 #include "SkTArray.h" 40 #include "SkTArray.h"
40 #include "SkTDict.h" 41 #include "SkTDict.h"
41 #include "SkTileGridPicture.h" 42 #include "SkTileGridPicture.h"
42 #include "SamplePipeControllers.h" 43 #include "SamplePipeControllers.h"
43 44
44 #ifdef SK_DEBUG 45 #ifdef SK_DEBUG
45 static const bool kDebugOnly = true; 46 static const bool kDebugOnly = true;
46 #else 47 #else
47 static const bool kDebugOnly = false; 48 static const bool kDebugOnly = false;
48 #endif 49 #endif
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 #if SK_SUPPORT_GPU 1415 #if SK_SUPPORT_GPU
1415 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or " 1416 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or "
1416 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means " 1417 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means "
1417 "use the default. 0 for either disables the cache."); 1418 "use the default. 0 for either disables the cache.");
1418 #endif 1419 #endif
1419 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " 1420 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure "
1420 "when reading/writing files."); 1421 "when reading/writing files.");
1421 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str( ), 1422 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str( ),
1422 "Space-separated list of ErrorTypes that should be ignored. If any *other* error " 1423 "Space-separated list of ErrorTypes that should be ignored. If any *other* error "
1423 "types are encountered, the tool will exit with a nonzero return v alue."); 1424 "types are encountered, the tool will exit with a nonzero return v alue.");
1425 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f or which we "
1426 "should ignore failures.\n"
1427 "The file should list one test per line, except for comment lines starting with #");
1424 DEFINE_string(ignoreTests, "", "Space delimited list of tests for which we shoul d ignore " 1428 DEFINE_string(ignoreTests, "", "Space delimited list of tests for which we shoul d ignore "
1425 "failures."); 1429 "failures.\n"
1430 "DEPRECATED in favor of --ignoreFailuresFile; see bug 1730");
1426 DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n" 1431 DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n"
1427 "Multiple matches may be separated by spaces.\n" 1432 "Multiple matches may be separated by spaces.\n"
1428 "~ causes a matching test to always be skipped\n" 1433 "~ causes a matching test to always be skipped\n"
1429 "^ requires the start of the test to match\n" 1434 "^ requires the start of the test to match\n"
1430 "$ requires the end of the test to match\n" 1435 "$ requires the end of the test to match\n"
1431 "^ and $ requires an exact match\n" 1436 "^ and $ requires an exact match\n"
1432 "If a test does not match any list entry,\n" 1437 "If a test does not match any list entry,\n"
1433 "it is skipped unless some list entry starts with ~"); 1438 "it is skipped unless some list entry starts with ~");
1434 DEFINE_string(missingExpectationsPath, "", "Write images for tests without expec tations " 1439 DEFINE_string(missingExpectationsPath, "", "Write images for tests without expec tations "
1435 "into this directory."); 1440 "into this directory.");
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 FLAGS_simulatePipePlayba ckFailure)); 1778 FLAGS_simulatePipePlayba ckFailure));
1774 if (FLAGS_tiledPipe) { 1779 if (FLAGS_tiledPipe) {
1775 errorsForAllModes.add(gmmain.test_tiled_pipe_playback(gm, compareCon fig, 1780 errorsForAllModes.add(gmmain.test_tiled_pipe_playback(gm, compareCon fig,
1776 comparisonBitm ap)); 1781 comparisonBitm ap));
1777 } 1782 }
1778 } 1783 }
1779 return errorsForAllModes; 1784 return errorsForAllModes;
1780 } 1785 }
1781 1786
1782 /** 1787 /**
1788 * Read individual lines from a file, pushing them into the given array.
1789 *
1790 * @param filename path to the file to read
1791 * @param lines array of strings to add the lines to
1792 * @returns true if able to read lines from the file
1793 */
1794 static bool read_lines_from_file(const char* filename, SkTArray<SkString> &lines ) {
1795 SkAutoTUnref<SkStream> streamWrapper(SkStream::NewFromFile(filename));
1796 SkStream *stream = streamWrapper.get();
1797 if (!stream) {
1798 gm_fprintf(stderr, "unable to read file '%s'\n", filename);
1799 return false;
1800 }
1801
1802 char c;
1803 SkString line;
1804 while (1 == stream->read(&c, 1)) {
1805 // If we hit either CR or LF, we've completed a line.
1806 //
1807 // TODO: If the file uses both CR and LF, this will return an extra blan k
1808 // line for each line of the file. Which is OK for current purposes...
1809 //
1810 // TODO: Does this properly handle unicode? It doesn't matter for
1811 // current purposes...
1812 if ((c == 0x0d) || (c == 0x0a)) {
1813 lines.push_back(line);
1814 line.reset();
1815 } else {
1816 line.append(&c, 1);
1817 }
1818 }
1819 lines.push_back(line);
1820 return true;
1821 }
1822
1823 /**
1783 * Return a list of all entries in an array of strings as a single string 1824 * Return a list of all entries in an array of strings as a single string
1784 * of this form: 1825 * of this form:
1785 * "item1", "item2", "item3" 1826 * "item1", "item2", "item3"
1786 */ 1827 */
1787 SkString list_all(const SkTArray<SkString> &stringArray); 1828 SkString list_all(const SkTArray<SkString> &stringArray);
1788 SkString list_all(const SkTArray<SkString> &stringArray) { 1829 SkString list_all(const SkTArray<SkString> &stringArray) {
1789 SkString total; 1830 SkString total;
1790 for (int i = 0; i < stringArray.count(); i++) { 1831 for (int i = 0; i < stringArray.count(); i++) {
1791 if (i > 0) { 1832 if (i > 0) {
1792 total.append(", "); 1833 total.append(", ");
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 } 2054 }
2014 return true; 2055 return true;
2015 } 2056 }
2016 2057
2017 /** 2058 /**
2018 * Replace contents of ignoreTestSubstrings with a list of testname/config subst rings, indicating 2059 * Replace contents of ignoreTestSubstrings with a list of testname/config subst rings, indicating
2019 * which tests' failures should be ignored. 2060 * which tests' failures should be ignored.
2020 */ 2061 */
2021 static bool parse_flags_ignore_tests(SkTArray<SkString> &ignoreTestSubstrings) { 2062 static bool parse_flags_ignore_tests(SkTArray<SkString> &ignoreTestSubstrings) {
2022 ignoreTestSubstrings.reset(); 2063 ignoreTestSubstrings.reset();
2064
2065 // Parse --ignoreTests
2023 for (int i = 0; i < FLAGS_ignoreTests.count(); i++) { 2066 for (int i = 0; i < FLAGS_ignoreTests.count(); i++) {
scroggo 2013/10/18 14:32:49 If this is deprecated, should we add a message whe
epoger 2013/10/18 14:36:13 My intent is to follow up this CL with more CLs th
2024 ignoreTestSubstrings.push_back(SkString(FLAGS_ignoreTests[i])); 2067 ignoreTestSubstrings.push_back(SkString(FLAGS_ignoreTests[i]));
2025 } 2068 }
2069
2070 // Parse --ignoreFailuresFile
2071 for (int i = 0; i < FLAGS_ignoreFailuresFile.count(); i++) {
2072 SkTArray<SkString> linesFromFile;
2073 if (!read_lines_from_file(FLAGS_ignoreFailuresFile[i], linesFromFile)) {
2074 return false;
2075 } else {
2076 for (int j = 0; j < linesFromFile.count(); j++) {
2077 SkString thisLine = linesFromFile[j];
2078 if (thisLine.isEmpty() || thisLine.startsWith('#')) {
2079 // skip this line
2080 } else {
2081 ignoreTestSubstrings.push_back(thisLine);
2082 }
2083 }
2084 }
2085 }
2086
2026 return true; 2087 return true;
2027 } 2088 }
2028 2089
2029 static bool parse_flags_modulo(int* moduloRemainder, int* moduloDivisor) { 2090 static bool parse_flags_modulo(int* moduloRemainder, int* moduloDivisor) {
2030 if (FLAGS_modulo.count() == 2) { 2091 if (FLAGS_modulo.count() == 2) {
2031 *moduloRemainder = atoi(FLAGS_modulo[0]); 2092 *moduloRemainder = atoi(FLAGS_modulo[0]);
2032 *moduloDivisor = atoi(FLAGS_modulo[1]); 2093 *moduloDivisor = atoi(FLAGS_modulo[1]);
2033 if (*moduloRemainder < 0 || *moduloDivisor <= 0 || 2094 if (*moduloRemainder < 0 || *moduloDivisor <= 0 ||
2034 *moduloRemainder >= *moduloDivisor) { 2095 *moduloRemainder >= *moduloDivisor) {
2035 gm_fprintf(stderr, "invalid modulo values."); 2096 gm_fprintf(stderr, "invalid modulo values.");
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 if (FLAGS_forceBWtext) { 2383 if (FLAGS_forceBWtext) {
2323 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2384 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2324 } 2385 }
2325 } 2386 }
2326 2387
2327 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2388 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2328 int main(int argc, char * const argv[]) { 2389 int main(int argc, char * const argv[]) {
2329 return tool_main(argc, (char**) argv); 2390 return tool_main(argc, (char**) argv);
2330 } 2391 }
2331 #endif 2392 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/tests/outputs/ignoring-one-test/output-expected/command_line » ('j') | gm/tests/run.sh » ('J')

Powered by Google App Engine
This is Rietveld 408576698