michael@0: #!/usr/bin/env python michael@0: michael@0: # Copyright (c) 2012 Google Inc. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: """ michael@0: Verifies --generator-output= behavior when using rules. michael@0: """ michael@0: michael@0: import TestGyp michael@0: michael@0: # Ninja and Android don't support --generator-output. michael@0: test = TestGyp.TestGyp(formats=['!ninja', '!android']) michael@0: michael@0: test.writable(test.workpath('rules'), False) michael@0: michael@0: test.run_gyp('rules.gyp', michael@0: '--generator-output=' + test.workpath('gypfiles'), michael@0: chdir='rules') michael@0: michael@0: test.writable(test.workpath('rules'), True) michael@0: michael@0: test.relocate('rules', 'relocate/rules') michael@0: test.relocate('gypfiles', 'relocate/gypfiles') michael@0: michael@0: test.writable(test.workpath('relocate/rules'), False) michael@0: michael@0: test.writable(test.workpath('relocate/rules/build'), True) michael@0: test.writable(test.workpath('relocate/rules/subdir1/build'), True) michael@0: test.writable(test.workpath('relocate/rules/subdir2/build'), True) michael@0: test.writable(test.workpath('relocate/rules/subdir2/rules-out'), True) michael@0: michael@0: test.build('rules.gyp', test.ALL, chdir='relocate/gypfiles') michael@0: michael@0: expect = """\ michael@0: Hello from program.c michael@0: Hello from function1.in1 michael@0: Hello from function2.in1 michael@0: Hello from define3.in0 michael@0: Hello from define4.in0 michael@0: """ michael@0: michael@0: if test.format == 'xcode': michael@0: chdir = 'relocate/rules/subdir1' michael@0: else: michael@0: chdir = 'relocate/gypfiles' michael@0: test.run_built_executable('program', chdir=chdir, stdout=expect) michael@0: michael@0: test.must_match('relocate/rules/subdir2/rules-out/file1.out', michael@0: "Hello from file1.in0\n") michael@0: test.must_match('relocate/rules/subdir2/rules-out/file2.out', michael@0: "Hello from file2.in0\n") michael@0: test.must_match('relocate/rules/subdir2/rules-out/file3.out', michael@0: "Hello from file3.in1\n") michael@0: test.must_match('relocate/rules/subdir2/rules-out/file4.out', michael@0: "Hello from file4.in1\n") michael@0: michael@0: test.pass_test()