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 that a project hierarchy created with the --generator-output= 9option can be built even when it's relocated to a different path. 10""" 11 12import TestGyp 13 14test = TestGyp.TestGyp() 15 16test.writable(test.workpath('src'), False) 17 18test.run_gyp('prog1.gyp', 19 '-Dset_symroot=1', 20 '--generator-output=' + test.workpath('gypfiles'), 21 chdir='src') 22 23test.writable(test.workpath('src'), True) 24 25test.relocate('src', 'relocate/src') 26test.relocate('gypfiles', 'relocate/gypfiles') 27 28test.writable(test.workpath('relocate/src'), False) 29 30test.writable(test.workpath('relocate/src/build'), True) 31test.writable(test.workpath('relocate/src/subdir2/build'), True) 32test.writable(test.workpath('relocate/src/subdir3/build'), True) 33 34test.build('prog1.gyp', test.ALL, chdir='relocate/gypfiles') 35 36chdir = 'relocate/gypfiles' 37 38expect = """\ 39Hello from %s 40Hello from inc.h 41Hello from inc1/include1.h 42Hello from inc2/include2.h 43Hello from inc3/include3.h 44Hello from subdir2/deeper/deeper.h 45""" 46 47if test.format == 'xcode': 48 chdir = 'relocate/src' 49test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') 50 51if test.format == 'xcode': 52 chdir = 'relocate/src/subdir2' 53test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') 54 55if test.format == 'xcode': 56 chdir = 'relocate/src/subdir3' 57test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') 58 59test.pass_test() 60