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 7import TestGyp 8 9test = TestGyp.TestGyp() 10 11# The xcode-ninja generator handles gypfiles which are not at the 12# project root incorrectly. 13# cf. https://code.google.com/p/gyp/issues/detail?id=460 14if test.format == 'xcode-ninja': 15 test.skip_test() 16 17test.run_gyp('build/all.gyp', chdir='src') 18 19test.relocate('src', 'relocate/src') 20 21test.build('build/all.gyp', test.ALL, chdir='relocate/src') 22 23chdir = 'relocate/src/build' 24 25# The top-level Makefile is in the directory where gyp was run. 26# TODO(mmoss) Should the Makefile go in the directory of the passed in .gyp 27# file? What about when passing in multiple .gyp files? Would sub-project 28# Makefiles (see http://codereview.chromium.org/340008 comments) solve this? 29if test.format in ('make', 'ninja', 'cmake'): 30 chdir = 'relocate/src' 31 32if test.format == 'xcode': 33 chdir = 'relocate/src/prog1' 34test.run_built_executable('program1', 35 chdir=chdir, 36 stdout="Hello from prog1.c\n") 37 38if test.format == 'xcode': 39 chdir = 'relocate/src/prog2' 40test.run_built_executable('program2', 41 chdir=chdir, 42 stdout="Hello from prog2.c\n") 43 44test.pass_test() 45