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 file copies with --generator-output using an explicit build michael@0: target of 'all'. 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('copies'), False) michael@0: michael@0: test.run_gyp('copies.gyp', michael@0: '--generator-output=' + test.workpath('gypfiles'), michael@0: chdir='copies') michael@0: michael@0: test.writable(test.workpath('copies'), True) michael@0: michael@0: test.relocate('copies', 'relocate/copies') michael@0: test.relocate('gypfiles', 'relocate/gypfiles') michael@0: michael@0: test.writable(test.workpath('relocate/copies'), False) michael@0: michael@0: test.writable(test.workpath('relocate/copies/build'), True) michael@0: test.writable(test.workpath('relocate/copies/copies-out'), True) michael@0: test.writable(test.workpath('relocate/copies/subdir/build'), True) michael@0: test.writable(test.workpath('relocate/copies/subdir/copies-out'), True) michael@0: michael@0: test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles') michael@0: michael@0: test.must_match(['relocate', 'copies', 'copies-out', 'file1'], michael@0: "file1 contents\n") michael@0: michael@0: if test.format == 'xcode': michael@0: chdir = 'relocate/copies/build' michael@0: elif test.format == 'make': michael@0: chdir = 'relocate/gypfiles/out' michael@0: else: michael@0: chdir = 'relocate/gypfiles' michael@0: test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n") michael@0: michael@0: test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'], michael@0: "file3 contents\n") michael@0: michael@0: if test.format == 'xcode': michael@0: chdir = 'relocate/copies/subdir/build' michael@0: elif test.format == 'make': michael@0: chdir = 'relocate/gypfiles/out' michael@0: else: michael@0: chdir = 'relocate/gypfiles' michael@0: test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n") michael@0: michael@0: test.pass_test()