""" TestGyp.py: a testing framework for GYP integration tests. """ import os import re import shutil import stat import sys import tempfile import TestCommon from TestCommon import __all__ __all__.extend([ 'TestGyp', ]) class TestGypBase(TestCommon.TestCommon): """ Class for controlling end-to-end tests of gyp generators. Instantiating this class will create a temporary directory and arrange for its destruction (via the TestCmd superclass) and copy all of the non-gyptest files in the directory hierarchy of the executing script. The default behavior is to test the 'gyp' or 'gyp.bat' file in the current directory. An alternative may be specified explicitly on instantiation, or by setting the TESTGYP_GYP environment variable.
from TestCommon import * from TestCommon import __all__ # Some tests which verify that SCons has been packaged properly need to # look for specific version file names. Replicating the version number # here provides independent verification that what we packaged conforms # to what we expect. (If we derived the version number from the same # data driving the build we might miss errors if the logic breaks.) SConsVersion = '0.97p6' __all__.extend([ 'TestSCons', 'python', '_exe', '_obj', '_shobj', 'lib_', '_lib', 'dll_', '_dll' ]) python = python_executable _python_ = '"' + python_executable + '"' _exe = exe_suffix _obj = obj_suffix _shobj = shobj_suffix _lib = lib_suffix lib_ = lib_prefix _dll = dll_suffix dll_ = dll_prefix
copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011' python_version_unsupported = (2, 3, 0) python_version_deprecated = (2, 4, 0) # In the checked-in source, the value of SConsVersion in the following # line must remain "__ VERSION __" (without the spaces) so the built # version in build/QMTest/TestSCons.py contains the actual version # string of the packages that have been built. SConsVersion = '__VERSION__' if SConsVersion == '__' + 'VERSION' + '__': SConsVersion = default_version __all__.extend([ 'TestSCons', 'machine', 'python', '_exe', '_obj', '_shobj', 'shobj_', 'lib_', '_lib', 'dll_', '_dll' ]) machine_map = { 'i686': 'i386', 'i586': 'i386', 'i486': 'i386', } try: uname = os.uname except AttributeError: # Windows doesn't have a uname() function. We could use something like # sys.platform as a fallback, but that's not really a "machine," so # just leave it as None. machine = None
# __COPYRIGHT__ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import re import shutil import sys from TestCommon import * from TestCommon import __all__ __all__.extend([ 'TestRuntest', 'pythonstring', 'pythonflags', ]) if re.search('\s', python): pythonstring = _python_ else: pythonstring = python pythonstring = pythonstring.replace('\\', '\\\\') pythonflags = '' if sys.version_info[0] < 3: pythonflags = ' -tt' failing_test_template = """\ import sys sys.stdout.write('FAILING TEST STDOUT\\n')
TestGyp.py: a testing framework for GYP integration tests. """ import os import re import shutil import stat import subprocess import sys import tempfile import TestCommon from TestCommon import __all__ __all__.extend([ 'TestGyp', ]) class TestGypBase(TestCommon.TestCommon): """ Class for controlling end-to-end tests of gyp generators. Instantiating this class will create a temporary directory and arrange for its destruction (via the TestCmd superclass) and copy all of the non-gyptest files in the directory hierarchy of the executing script. The default behavior is to test the 'gyp' or 'gyp.bat' file in the current directory. An alternative may be specified explicitly on instantiation, or by setting the TESTGYP_GYP environment variable.
# __COPYRIGHT__ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import re import shutil import sys from TestCommon import * from TestCommon import __all__ __all__.extend([ 'TestRuntest', 'pythonstring', ]) if re.search('\s', python): pythonstring = _python_ else: pythonstring = python pythonstring = pythonstring.replace('\\', '\\\\') failing_test_template = """\ import sys sys.stdout.write('FAILING TEST STDOUT\\n') sys.stderr.write('FAILING TEST STDERR\\n') sys.exit(1) """
attributes defined in this subclass. """ # __COPYRIGHT__ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import sys from TestCommon import * from TestCommon import __all__ __all__.extend([ 'TestSCons_time', ]) SConstruct = """\ import os print "SConstruct file directory:", os.getcwd() """ scons_py = """\ #!/usr/bin/env python import os import sys def write_args(fp, args): fp.write(args[0] + '\\n') for arg in args[1:]: fp.write(' ' + arg + '\\n')
default_version = "2.1.0.alpha.yyyymmdd" copyright_years = "2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011" python_version_unsupported = (2, 3, 0) python_version_deprecated = (2, 4, 0) # In the checked-in source, the value of SConsVersion in the following # line must remain "__ VERSION __" (without the spaces) so the built # version in build/QMTest/TestSCons.py contains the actual version # string of the packages that have been built. SConsVersion = "__VERSION__" if SConsVersion == "__" + "VERSION" + "__": SConsVersion = default_version __all__.extend(["TestSCons", "machine", "python", "_exe", "_obj", "_shobj", "shobj_", "lib_", "_lib", "dll_", "_dll"]) machine_map = {"i686": "i386", "i586": "i386", "i486": "i386"} try: uname = os.uname except AttributeError: # Windows doesn't have a uname() function. We could use something like # sys.platform as a fallback, but that's not really a "machine," so # just leave it as None. machine = None else: machine = uname()[4] machine = machine_map.get(machine, machine) _exe = exe_suffix
# found in the LICENSE file. """ TestGyp.py: a testing framework for GYP integration tests. """ import os import re import shutil import stat import sys import TestCommon from TestCommon import __all__ __all__.extend(["TestGyp"]) class TestGypBase(TestCommon.TestCommon): """ Class for controlling end-to-end tests of gyp generators. Instantiating this class will create a temporary directory and arrange for its destruction (via the TestCmd superclass) and copy all of the non-gyptest files in the directory hierarchy of the executing script. The default behavior is to test the 'gyp' or 'gyp.bat' file in the current directory. An alternative may be specified explicitly on instantiation, or by setting the TESTGYP_GYP environment variable.
""" # __COPYRIGHT__ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import sys from TestCommon import * from TestCommon import __all__ # some of the scons_time tests may need regex-based matching: from TestSCons import search_re, search_re_in_list __all__.extend([ 'TestSCons_time', ]) SConstruct = """\ import os print "SConstruct file directory:", os.getcwd() """ scons_py = """\ #!/usr/bin/env python import os import sys def write_args(fp, args): fp.write(args[0] + '\\n') for arg in args[1:]: fp.write(' ' + arg + '\\n') write_args(sys.stdout, sys.argv)
# __COPYRIGHT__ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import string import shutil import sys from TestCommon import * from TestCommon import __all__ __all__.extend([ 'TestRuntest', 'python', '_python_', ]) python = python_executable _python_ = '"' + python_executable + '"' failing_test_template = """\ import sys sys.stdout.write('FAILING TEST STDOUT\\n') sys.stderr.write('FAILING TEST STDERR\\n') sys.exit(1) """ no_result_test_template = """\ import sys