gyptest-multiple-values.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 that when multiple values are supplied for a gyp define, the last one
  7. is used.
  8. """
  9. import os
  10. import TestGyp
  11. test = TestGyp.TestGyp()
  12. os.environ['GYP_DEFINES'] = 'key=value1 key=value2 key=value3'
  13. test.run_gyp('defines.gyp')
  14. test.build('defines.gyp')
  15. test.must_contain('action.txt', 'value3')
  16. # The last occurrence of a repeated set should take precedence over other
  17. # values.
  18. os.environ['GYP_DEFINES'] = 'key=repeated_value key=value1 key=repeated_value'
  19. test.run_gyp('defines.gyp')
  20. if test.format == 'msvs' and not test.uses_msbuild:
  21. # msvs versions before 2010 don't detect build rule changes not reflected
  22. # in file system timestamps. Rebuild to see differences.
  23. test.build('defines.gyp', rebuild=True)
  24. elif test.format == 'android':
  25. # The Android build system doesn't currently have a way to get files whose
  26. # build rules have changed (but whose timestamps haven't) to be rebuilt.
  27. # See bug http://code.google.com/p/gyp/issues/detail?id=308
  28. test.unlink('action.txt')
  29. test.build('defines.gyp')
  30. else:
  31. test.build('defines.gyp')
  32. test.must_contain('action.txt', 'repeated_value')
  33. test.pass_test()