gyptest-identical-name.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python
  2. # Copyright (c) 2014 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 libraries (in identical-names) are properly handeled by xcode.
  7. The names for all libraries participating in this build are:
  8. libtestlib.a - identical-name/testlib
  9. libtestlib.a - identical-name/proxy/testlib
  10. libproxy.a - identical-name/proxy
  11. The first two libs produce a hash collision in Xcode when Gyp is executed,
  12. because they have the same name and would be copied to the same directory with
  13. Xcode default settings.
  14. For this scenario to work one needs to change the Xcode variables SYMROOT and
  15. CONFIGURATION_BUILD_DIR. Setting these to per-lib-unique directories, avoids
  16. copying the libs into the same directory.
  17. The test consists of two steps. The first one verifies that by setting both
  18. vars, there is no hash collision anymore during Gyp execution and that the libs
  19. can actually be be built. The second one verifies that there is still a hash
  20. collision if the vars are not set and thus the current behavior is preserved.
  21. """
  22. import TestGyp
  23. import sys
  24. def IgnoreOutput(string, expected_string):
  25. return True
  26. if sys.platform == 'darwin':
  27. test = TestGyp.TestGyp(formats=['xcode'])
  28. test.run_gyp('test.gyp', chdir='identical-name')
  29. test.build('test.gyp', test.ALL, chdir='identical-name')
  30. test.run_gyp('test-should-fail.gyp', chdir='identical-name')
  31. test.built_file_must_not_exist('test-should-fail.xcodeproj')
  32. test.pass_test()