gyptest-cxxflags.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python
  2. # Copyright (c) 2012 Google Inc. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """
  6. Verifies the use of the environment during regeneration when the gyp file
  7. changes, specifically via build of an executable with C++ flags specified by
  8. CXXFLAGS.
  9. In this test, gyp happens within a local environment, but build outside of it.
  10. """
  11. import TestGyp
  12. FORMATS = ('ninja',)
  13. test = TestGyp.TestGyp(formats=FORMATS)
  14. # We reset the environ after calling gyp. When the auto-regeneration happens,
  15. # the same define should be reused anyway.
  16. with TestGyp.LocalEnv({'CXXFLAGS': ''}):
  17. test.run_gyp('cxxflags.gyp')
  18. test.build('cxxflags.gyp')
  19. expect = """\
  20. No define
  21. """
  22. test.run_built_executable('cxxflags', stdout=expect)
  23. test.sleep()
  24. with TestGyp.LocalEnv({'CXXFLAGS': '-DABC'}):
  25. test.run_gyp('cxxflags.gyp')
  26. test.build('cxxflags.gyp')
  27. expect = """\
  28. With define
  29. """
  30. test.run_built_executable('cxxflags', stdout=expect)
  31. test.pass_test()