/src/3rdparty/webkit/Source/ThirdParty/gyp/test/variables/commands/gyptest-commands.py

https://bitbucket.org/ultra_iter/qt-vtl · Python · 44 lines · 37 code · 2 blank · 5 comment · 0 complexity · af9f912f809795c2657423fa2192f8eb MD5 · raw file

  1. #!/usr/bin/env python
  2. # Copyright (c) 2009 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. Test variable expansion of '<!()' syntax commands.
  7. """
  8. import os
  9. import TestGyp
  10. test = TestGyp.TestGyp(format='gypd')
  11. expect = test.read('commands.gyp.stdout').replace('\r', '')
  12. # Set $HOME so that gyp doesn't read the user's actual
  13. # ~/.gyp/include.gypi file, which may contain variables
  14. # and other settings that would change the output.
  15. os.environ['HOME'] = test.workpath()
  16. test.run_gyp('commands.gyp',
  17. '--debug', 'variables', '--debug', 'general',
  18. stdout=expect)
  19. # Verify the commands.gypd against the checked-in expected contents.
  20. #
  21. # Normally, we should canonicalize line endings in the expected
  22. # contents file setting the Subversion svn:eol-style to native,
  23. # but that would still fail if multiple systems are sharing a single
  24. # workspace on a network-mounted file system. Consequently, we
  25. # massage the Windows line endings ('\r\n') in the output to the
  26. # checked-in UNIX endings ('\n').
  27. contents = test.read('commands.gypd').replace('\r', '')
  28. expect = test.read('commands.gypd.golden').replace('\r', '')
  29. if not test.match(contents, expect):
  30. print "Unexpected contents of `commands.gypd'"
  31. test.diff(expect, contents, 'commands.gypd ')
  32. test.fail_test()
  33. test.pass_test()