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

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

Issue 330053003: First crack at adding a GYP_GENERATOR for determining various things (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: sim 90 Created 6 years, 6 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/subdir/subdir.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/analyzer/gyptest-analyzer.py
diff --git a/test/analyzer/gyptest-analyzer.py b/test/analyzer/gyptest-analyzer.py
new file mode 100644
index 0000000000000000000000000000000000000000..a42748f0a2cf67b71d5cf9b84ba31f97bfc148f3
--- /dev/null
+++ b/test/analyzer/gyptest-analyzer.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for analyzer
+"""
+
+import TestGyp
+
+found = 'Found dependency\n'
+not_found = 'No dependencies\n'
+
+def __CreateTestFile(files):
+ f = open('test_file', 'w')
+ for file in files:
+ f.write(file + '\n')
+ f.close()
+
+test = TestGyp.TestGypCustom(format='analyzer')
+
+# Verifies file_path must be specified.
+test.run_gyp('test.gyp',
+ stdout='Must specify files to analyze via file_path generator '
+ 'flag\n')
+
+# Trivial test of a source.
+__CreateTestFile(['foo.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=found)
+
+# Conditional source that is excluded.
+__CreateTestFile(['conditional_source.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=not_found)
+
+# Conditional source that is included by way of argument.
+__CreateTestFile(['conditional_source.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', '-Dtest_variable=1',
+ stdout=found)
+
+# Two unknown files.
+__CreateTestFile(['unknown1.c', 'unoknow2.cc'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=not_found)
+
+# Two unknown files.
+__CreateTestFile(['unknown1.c', 'subdir/subdir_sourcex.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=not_found)
+
+# Included dependency
+__CreateTestFile(['unknown1.c', 'subdir/subdir_source.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=found)
+
+# Included inputs to actions.
+__CreateTestFile(['action_input.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=found)
+
+# Don't consider outputs.
+__CreateTestFile(['action_output.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=not_found)
+
+# Rule inputs.
+__CreateTestFile(['rule_input.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=found)
+
+# Ignore patch specified with PRODUCT_DIR.
+__CreateTestFile(['product_dir_input.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=not_found)
+
+# Path specified via a variable.
+__CreateTestFile(['subdir/subdir_source2.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=found)
+
+# Verifies paths with // are fixed up correctly.
+__CreateTestFile(['parent_source.c'])
+test.run_gyp('test.gyp', '-Gfile_path=test_file', stdout=found)
+
+test.pass_test()
« no previous file with comments | « pylib/gyp/generator/analyzer.py ('k') | test/analyzer/subdir/subdir.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698