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

Unified Diff: test/analyzer/gyptest-analyzer.py

Issue 473483002: Removes old way to specify files to look for (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pylib/gyp/generator/analyzer.py ('k') | test/analyzer/gyptest-analyzer.new.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/analyzer/gyptest-analyzer.py
===================================================================
--- test/analyzer/gyptest-analyzer.py (revision 1964)
+++ test/analyzer/gyptest-analyzer.py (working copy)
@@ -9,45 +9,49 @@
import json
import TestGyp
-# TODO(sky): when done migrating recipes rename to gyptest-analyzer and nuke
-# existing gyptest-analyzer.
-
found = 'Found dependency'
not_found = 'No dependencies'
+
def _CreateTestFile(files, targets):
f = open('test_file', 'w')
to_write = {'files': files, 'targets': targets }
json.dump(to_write, f)
f.close()
+
def _CreateBogusTestFile():
f = open('test_file','w')
f.write('bogus')
f.close()
+
def _ReadOutputFileContents():
f = open('analyzer_output', 'r')
result = json.load(f)
f.close()
return result
+
# NOTE: this would be clearer if it subclassed TestGypCustom, but that trips
# over a bug in pylint (E1002).
test = TestGyp.TestGypCustom(format='analyzer')
+
def run_analyzer(*args, **kw):
"""Runs the test specifying a particular config and output path."""
args += ('-Gconfig_path=test_file',
'-Ganalyzer_output_path=analyzer_output')
test.run_gyp('test.gyp', *args, **kw)
+
def run_analyzer2(*args, **kw):
"""Runs the test specifying a particular config and output path."""
args += ('-Gconfig_path=test_file',
'-Ganalyzer_output_path=analyzer_output')
test.run_gyp('test2.gyp', *args, **kw)
+
def EnsureContains(targets=set(), matched=False):
"""Verifies output contains |targets|."""
result = _ReadOutputFileContents()
@@ -71,6 +75,7 @@
print 'expected', not_found, 'got', result['status']
test.fail_test()
+
def EnsureError(expected_error_string):
"""Verifies output contains the error string."""
result = _ReadOutputFileContents()
@@ -79,6 +84,14 @@
expected_error_string
test.fail_test()
+
+def EnsureStdoutContains(expected_error_string):
+ if test.stdout().find(expected_error_string) == -1:
+ print 'actual stdout:', test.stdout(), '\nexpected stdout:', \
+ expected_error_string
+ test.fail_test()
+
+
def EnsureWarning(expected_warning_string):
"""Verifies output contains the warning string."""
result = _ReadOutputFileContents()
@@ -87,11 +100,11 @@
'\nexpected warning:', expected_warning_string
test.fail_test()
-# Verifies file_path must be specified.
-test.run_gyp('test.gyp',
- stdout='Must specify files to analyze via file_path generator '
- 'flag\n')
+# Verifies config_path must be specified.
+test.run_gyp('test.gyp')
+EnsureStdoutContains('Must specify files to analyze via config_path')
+
# Verifies config_path must point to a valid file.
test.run_gyp('test.gyp', '-Gconfig_path=bogus_file',
'-Ganalyzer_output_path=analyzer_output')
« no previous file with comments | « pylib/gyp/generator/analyzer.py ('k') | test/analyzer/gyptest-analyzer.new.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698