Home | History | Annotate | Download | only in full-toolchain
      1 #!/usr/bin/env python
      2 
      3 # Copyright (c) 2014 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 make_global_settings works with the full toolchain.
      9 """
     10 
     11 import os
     12 import sys
     13 import TestGyp
     14 
     15 if sys.platform == 'win32':
     16   # cross compiling not supported by ninja on windows
     17   # and make not supported on windows at all.
     18   sys.exit(0)
     19 
     20 test = TestGyp.TestGyp(formats=['ninja'])
     21 # Must set the test format to something with a flavor (the part after the '-')
     22 # in order to test the desired behavior. Since we want to run a non-host
     23 # toolchain, we have to set the flavor to something that the ninja generator
     24 # doesn't know about, so it doesn't default to the host-specific tools (e.g.,
     25 # 'otool' on mac to generate the .TOC).
     26 #
     27 # Note that we can't just pass format=['ninja-some_toolchain'] to the
     28 # constructor above, because then this test wouldn't be recognized as a ninja
     29 # format test.
     30 test.formats = ['ninja-some_flavor']
     31 
     32 gyp_file = 'make_global_settings.gyp'
     33 
     34 test.run_gyp(gyp_file,
     35              # Teach the .gyp file about the location of my_nm.py and
     36              # my_readelf.py, and the python executable.
     37              '-Dworkdir=%s' % test.workdir,
     38              '-Dpython=%s' % sys.executable)
     39 test.build(gyp_file, arguments=['-v'])
     40 
     41 expected = ['MY_CC', 'MY_CXX']
     42 test.must_contain_all_lines(test.stdout(), expected)
     43 
     44 test.must_contain(test.built_file_path('RAN_MY_NM'), 'RAN_MY_NM')
     45 test.must_contain(test.built_file_path('RAN_MY_READELF'), 'RAN_MY_READELF')
     46 
     47 test.pass_test()
     48