1#!/usr/bin/env python 2 3# Copyright (c) 2011 Google Inc. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7""" 8Verifies simple rules when using an explicit build target of 'all'. 9""" 10 11import TestGyp 12import os 13import sys 14 15test = TestGyp.TestGyp(formats=['make', 'ninja', 'android', 'xcode', 'msvs']) 16 17test.run_gyp('actions.gyp', chdir='src') 18 19test.relocate('src', 'relocate/src') 20 21test.build('actions.gyp', chdir='relocate/src') 22 23expect = """\ 24no dir here 25hi c 26hello baz 27""" 28if test.format == 'xcode': 29 chdir = 'relocate/src/subdir' 30else: 31 chdir = 'relocate/src' 32test.run_built_executable('gencc_int_output', chdir=chdir, stdout=expect) 33if test.format == 'msvs': 34 test.run_built_executable('gencc_int_output_external', chdir=chdir, 35 stdout=expect) 36 37test.must_match('relocate/src/subdir/foo/bar/baz.dirname', 38 os.path.join('foo', 'bar')) 39test.must_match('relocate/src/subdir/a/b/c.dirname', 40 os.path.join('a', 'b')) 41 42# FIXME the xcode and make generators incorrectly convert RULE_INPUT_PATH 43# to an absolute path, making the tests below fail! 44if test.format != 'xcode' and test.format != 'make': 45 test.must_match('relocate/src/subdir/foo/bar/baz.path', 46 os.path.join('foo', 'bar', 'baz.printvars')) 47 test.must_match('relocate/src/subdir/a/b/c.path', 48 os.path.join('a', 'b', 'c.printvars')) 49 50test.pass_test() 51