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 dependent Xcode settings are processed correctly. 9""" 10 11import TestGyp 12import TestMac 13 14import subprocess 15import sys 16 17if sys.platform == 'darwin': 18 print "This test is currently disabled: https://crbug.com/483696." 19 sys.exit(0) 20 21 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) 22 23 CHDIR = 'xcode-env-order' 24 INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' 25 26 test.run_gyp('test.gyp', chdir=CHDIR) 27 test.build('test.gyp', test.ALL, chdir=CHDIR) 28 29 # Env vars in 'copies' filenames. 30 test.built_file_must_exist('Test-copy-brace/main.c', chdir=CHDIR) 31 test.built_file_must_exist('Test-copy-paren/main.c', chdir=CHDIR) 32 test.built_file_must_exist('Test-copy-bare/main.c', chdir=CHDIR) 33 34 # Env vars in 'actions' filenames and inline actions 35 test.built_file_must_exist('action-copy-brace.txt', chdir=CHDIR) 36 test.built_file_must_exist('action-copy-paren.txt', chdir=CHDIR) 37 test.built_file_must_exist('action-copy-bare.txt', chdir=CHDIR) 38 39 # Env vars in 'rules' filenames and inline actions 40 test.built_file_must_exist('rule-copy-brace.txt', chdir=CHDIR) 41 test.built_file_must_exist('rule-copy-paren.txt', chdir=CHDIR) 42 # TODO: see comment in test.gyp for this file. 43 #test.built_file_must_exist('rule-copy-bare.txt', chdir=CHDIR) 44 45 # Env vars in Info.plist. 46 info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) 47 test.must_exist(info_plist) 48 49 test.must_contain(info_plist, '''\ 50\t<key>BraceProcessedKey1</key> 51\t<string>D:/Source/Project/Test</string>''') 52 test.must_contain(info_plist, '''\ 53\t<key>BraceProcessedKey2</key> 54\t<string>/Source/Project/Test</string>''') 55 test.must_contain(info_plist, '''\ 56\t<key>BraceProcessedKey3</key> 57\t<string>com.apple.product-type.application:D:/Source/Project/Test</string>''') 58 59 test.must_contain(info_plist, '''\ 60\t<key>ParenProcessedKey1</key> 61\t<string>D:/Source/Project/Test</string>''') 62 test.must_contain(info_plist, '''\ 63\t<key>ParenProcessedKey2</key> 64\t<string>/Source/Project/Test</string>''') 65 test.must_contain(info_plist, '''\ 66\t<key>ParenProcessedKey3</key> 67\t<string>com.apple.product-type.application:D:/Source/Project/Test</string>''') 68 69 test.must_contain(info_plist, '''\ 70\t<key>BareProcessedKey1</key> 71\t<string>D:/Source/Project/Test</string>''') 72 test.must_contain(info_plist, '''\ 73\t<key>BareProcessedKey2</key> 74\t<string>/Source/Project/Test</string>''') 75 # NOTE: For bare variables, $PRODUCT_TYPE is not replaced! It _is_ replaced 76 # if it's not right at the start of the string (e.g. ':$PRODUCT_TYPE'), so 77 # this looks like an Xcode bug. This bug isn't emulated (yet?), so check this 78 # only for Xcode. 79 if test.format == 'xcode' and TestMac.Xcode.Version() < '0500': 80 test.must_contain(info_plist, '''\ 81\t<key>BareProcessedKey3</key> 82\t<string>$PRODUCT_TYPE:D:/Source/Project/Test</string>''') 83 else: 84 # The bug has been fixed by Xcode version 5.0.0. 85 test.must_contain(info_plist, '''\ 86\t<key>BareProcessedKey3</key> 87\t<string>com.apple.product-type.application:D:/Source/Project/Test</string>''') 88 89 test.must_contain(info_plist, '''\ 90\t<key>MixedProcessedKey</key> 91\t<string>/Source/Project:Test:mh_execute</string>''') 92 93 test.pass_test() 94