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