1#!/usr/bin/env python 2 3# Copyright (c) 2012 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 actions when using an explicit build target of 'all'. 9""" 10 11import TestGyp 12 13test = TestGyp.TestGyp() 14 15test.run_gyp('all.gyp', 16 '-G', 'xcode_ninja_target_pattern=^all_targets$', 17 chdir='src') 18 19test.relocate('src', 'relocate/src') 20 21# Build all. 22test.build('all.gyp', chdir='relocate/src') 23 24if test.format=='xcode': 25 chdir = 'relocate/src/dir1' 26else: 27 chdir = 'relocate/src' 28 29# Output is as expected. 30file_content = 'Hello from emit.py\n' 31test.built_file_must_match('out2.txt', file_content, chdir=chdir) 32 33test.built_file_must_not_exist('out.txt', chdir='relocate/src') 34test.built_file_must_not_exist('foolib1', 35 type=test.SHARED_LIB, 36 chdir=chdir) 37 38# xcode-ninja doesn't generate separate workspaces for sub-gyps by design 39if test.format == 'xcode-ninja': 40 test.pass_test() 41 42# TODO(mmoss) Make consistent with msvs, with 'dir1' before 'out/Default'? 43if test.format in ('make', 'ninja', 'cmake'): 44 chdir='relocate/src' 45else: 46 chdir='relocate/src/dir1' 47 48# Build the action explicitly. 49test.build('actions.gyp', 'action1_target', chdir=chdir) 50 51# Check that things got run. 52file_content = 'Hello from emit.py\n' 53test.built_file_must_exist('out.txt', chdir=chdir) 54 55# Build the shared library explicitly. 56test.build('actions.gyp', 'foolib1', chdir=chdir) 57 58test.built_file_must_exist('foolib1', 59 type=test.SHARED_LIB, 60 chdir=chdir, 61 subdir='dir1') 62 63test.pass_test() 64