Example #1
0
 def test_get_cxxflags_unsupported_version(self, compiler_name):
     with patch("platform.system") as sys_mock:
         sys_mock.return_value = options.LINUX_KEY
         with patch("distutils.ccompiler.new_compiler") as new_cc_mock:
             with patch("subprocess.check_output") as command_mock:
                 command_mock.return_value = "1.0.0".encode('utf-8')
                 cc_mock = MagicMock()
                 cc_mock.compiler = [compiler_name]
                 new_cc_mock.return_value = cc_mock
                 
                 try:
                     get_cxxflags()
                     pytest.fail("Version should not be supported")
                 except UnsupportedCompilerException:
                     assert True
Example #2
0
    def test_get_cxxflags_unsupported_version(self, compiler_name):
        with patch("platform.system") as sys_mock:
            sys_mock.return_value = options.LINUX_KEY
            with patch("distutils.ccompiler.new_compiler") as new_cc_mock:
                with patch("subprocess.check_output") as command_mock:
                    command_mock.return_value = "1.0.0".encode('utf-8')
                    cc_mock = MagicMock()
                    cc_mock.compiler = [compiler_name]
                    new_cc_mock.return_value = cc_mock

                    try:
                        get_cxxflags()
                        pytest.fail("Version should not be supported")
                    except UnsupportedCompilerException:
                        assert True
Example #3
0
 def test_get_cxxflags_invalid_os(self):
     with patch("platform.system") as sys_mock:
         sys_mock.return_value = "Win32"
         
         try:
             flags = get_cxxflags()
             pytest.fail("OS is not supported")
         except UnsupportedCompilerException:
             assert True
Example #4
0
    def test_get_cxxflags_invalid_os(self):
        with patch("platform.system") as sys_mock:
            sys_mock.return_value = "Win32"

            try:
                flags = get_cxxflags()
                pytest.fail("OS is not supported")
            except UnsupportedCompilerException:
                assert True
Example #5
0
 def test_get_cxxflags_invalid_compiler(self):
     with patch("platform.system") as sys_mock:
         sys_mock.return_value = options.LINUX_KEY
         with patch("distutils.ccompiler.new_compiler") as new_cc_mock:
             cc_mock = MagicMock()
             cc_mock.compiler = ["invalid_cc"]
             new_cc_mock.return_value = cc_mock
             try:
                 flags = get_cxxflags()
                 pytest.fail("Compiler is not supported")
             except UnsupportedCompilerException:
                 assert True
Example #6
0
 def test_get_cxxflags_invalid_compiler(self):
     with patch("platform.system") as sys_mock:
         sys_mock.return_value = options.LINUX_KEY
         with patch("distutils.ccompiler.new_compiler") as new_cc_mock:
             cc_mock = MagicMock()
             cc_mock.compiler = ["invalid_cc"]
             new_cc_mock.return_value = cc_mock
             try:
                 flags = get_cxxflags()
                 pytest.fail("Compiler is not supported")
             except UnsupportedCompilerException:
                 assert True
Example #7
0
 def test_get_cxxflags_Linux(self, compiler_name):
     with patch("platform.system") as sys_mock:
         sys_mock.return_value = options.LINUX_KEY
         with patch("distutils.ccompiler.new_compiler") as new_cc_mock:
             with patch("subprocess.check_output") as command_mock:
                 command_mock.return_value = options.MIN_GCC_VERSION.encode('utf-8')
                 cc_mock = MagicMock()
                 cc_mock.compiler = [compiler_name]
                 new_cc_mock.return_value = cc_mock
                 flags = get_cxxflags()
                 assert flags is not None
                 
                 try:
                     compiler = LINUX_MAPPING[compiler_name]
                 except KeyError:
                     compiler = compiler_name
                 
                 assert map(eq, flags, options.CXX_FLAGS[compiler])
Example #8
0
    def test_get_cxxflags_Linux(self, compiler_name):
        with patch("platform.system") as sys_mock:
            sys_mock.return_value = options.LINUX_KEY
            with patch("distutils.ccompiler.new_compiler") as new_cc_mock:
                with patch("subprocess.check_output") as command_mock:
                    command_mock.return_value = options.MIN_GCC_VERSION.encode(
                        'utf-8')
                    cc_mock = MagicMock()
                    cc_mock.compiler = [compiler_name]
                    new_cc_mock.return_value = cc_mock
                    flags = get_cxxflags()
                    assert flags is not None

                    try:
                        compiler = LINUX_MAPPING[compiler_name]
                    except KeyError:
                        compiler = compiler_name

                    assert map(eq, flags, options.CXX_FLAGS[compiler])
Example #9
0
# Copyright (c) 2013 ETH Zurich, Institute of Astronomy, Lukas Gamper <*****@*****.**>

from __future__ import print_function, division, absolute_import, unicode_literals


from hope.options import get_cxxflags

# Additional compiler flags, formated as array of strings
cxxflags = get_cxxflags()
""" 
List of c++ compiler flags. Normally hope does determing the right flags itself.
"""

#TODO implement
prefix = ".hope"
""" 
Prefix of the folder hope saves all data in.
"""

verbose = False
""" 
Print a intermediate representation of each function during compilation.
"""

optimize = False
"""
Use '''sympy''' to simplify expression and exptract common subexpression detection
"""

keeptemp = False
""" 
Example #10
0
# Copyright (c) 2013 ETH Zurich, Institute of Astronomy, Lukas Gamper <*****@*****.**>

from __future__ import print_function, division, absolute_import, unicode_literals

from hope.options import get_cxxflags

# Additional compiler flags, formated as array of strings
cxxflags = get_cxxflags()
""" 
List of c++ compiler flags. Normally hope does determing the right flags itself.
"""

#TODO implement
prefix = ".hope"
""" 
Prefix of the folder hope saves all data in.
"""

verbose = False
""" 
Print a intermediate representation of each function during compilation.
"""

optimize = False
"""
Use '''sympy''' to simplify expression and exptract common subexpression detection
"""

keeptemp = False
""" 
Keep the intermediate c++ source and compiler output generated during compilation.