1#!/usr/bin/env python 2 3# Copyright (c) 2013 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 *_wrapper in environment. 9""" 10 11import os 12import sys 13import TestGyp 14 15test_format = ['ninja'] 16 17os.environ['CC_wrapper'] = 'distcc' 18os.environ['LINK_wrapper'] = 'distlink' 19os.environ['CC.host_wrapper'] = 'ccache' 20 21test = TestGyp.TestGyp(formats=test_format) 22 23old_env = dict(os.environ) 24os.environ['GYP_CROSSCOMPILE'] = '1' 25test.run_gyp('wrapper.gyp') 26os.environ.clear() 27os.environ.update(old_env) 28 29if test.format == 'ninja': 30 cc_expected = ('cc = ' + os.path.join('..', '..', 'distcc') + ' ' + 31 os.path.join('..', '..', 'clang')) 32 cc_host_expected = ('cc_host = ' + os.path.join('..', '..', 'ccache') + ' ' + 33 os.path.join('..', '..', 'clang')) 34 ld_expected = 'ld = ../../distlink $cc' 35 if sys.platform != 'win32': 36 ldxx_expected = 'ldxx = ../../distlink $cxx' 37 38 if sys.platform == 'win32': 39 ld_expected = 'link.exe' 40 test.must_contain('out/Default/build.ninja', cc_expected) 41 test.must_contain('out/Default/build.ninja', cc_host_expected) 42 test.must_contain('out/Default/build.ninja', ld_expected) 43 if sys.platform != 'win32': 44 test.must_contain('out/Default/build.ninja', ldxx_expected) 45 46test.pass_test() 47