Home | History | Annotate | Download | only in home_dot_gyp
      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 inclusion of $HOME/.gyp/include.gypi works properly with relocation
      9 and with regeneration.
     10 """
     11 
     12 import os
     13 import TestGyp
     14 
     15 # Regenerating build files when a gyp file changes is currently only supported
     16 # by the make generator.
     17 test = TestGyp.TestGyp(formats=['make'])
     18 
     19 os.environ['HOME'] = os.path.abspath('home')
     20 
     21 test.run_gyp('all.gyp', chdir='src')
     22 
     23 # After relocating, we should still be able to build (build file shouldn't
     24 # contain relative reference to ~/.gyp/include.gypi)
     25 test.relocate('src', 'relocate/src')
     26 
     27 test.build('all.gyp', test.ALL, chdir='relocate/src')
     28 
     29 test.run_built_executable('printfoo',
     30                           chdir='relocate/src',
     31                           stdout='FOO is fromhome\n')
     32 
     33 # Building should notice any changes to ~/.gyp/include.gypi and regyp.
     34 test.sleep()
     35 
     36 test.write('home/.gyp/include.gypi', test.read('home2/.gyp/include.gypi'))
     37 
     38 test.build('all.gyp', test.ALL, chdir='relocate/src')
     39 
     40 test.run_built_executable('printfoo',
     41                           chdir='relocate/src',
     42                           stdout='FOO is fromhome2\n')
     43 
     44 test.pass_test()
     45