Esempio n. 1
0
    def test_search_dirs_fail(self):
        def mock_bad_execute(*args, **kwargs):
            raise OSError()

        with mock.patch('bfg9000.shell.execute', mock_bad_execute):
            ld = LdLinker(None, self.env, ['ld'], 'version')
            self.assertEqual(ld.search_dirs(), [])
            self.assertRaises(OSError, lambda: ld.search_dirs(strict=True))
Esempio n. 2
0
 def test_search_dirs_sysroot(self):
     with mock.patch('bfg9000.shell.execute', mock_execute):
         ld = LdLinker(None, self.env, ['ld'], 'version')
         self.assertEqual(ld.search_dirs(sysroot='/sysroot'),
                          [abspath('/dir1'), abspath('/sysroot/dir2')])
Esempio n. 3
0
    def test_gnu_gold(self):
        version = 'GNU gold (GNU Binutils for Ubuntu 2.26.1) 1.11'
        ld = LdLinker(None, self.env, ['ld'], version)

        self.assertEqual(ld.brand, 'gold')
        self.assertEqual(ld.version, Version('1.11'))
Esempio n. 4
0
    def test_unknown_brand(self):
        version = 'unknown'
        ld = LdLinker(None, self.env, ['ld'], version)

        self.assertEqual(ld.brand, 'unknown')
        self.assertEqual(ld.version, None)
Esempio n. 5
0
    def test_gnu_ld(self):
        version = 'GNU ld (GNU Binutils for Ubuntu) 2.26.1'
        ld = LdLinker(None, self.env, ['ld'], version)

        self.assertEqual(ld.brand, 'bfd')
        self.assertEqual(ld.version, Version('2.26.1'))
Esempio n. 6
0
    def test_family(self):
        class MockBuilder:
            family = 'native'

        ld = LdLinker(MockBuilder(), self.env, ['ld'], 'version')
        self.assertEqual(ld.family, 'native')
Esempio n. 7
0
    def test_lang(self):
        class MockBuilder:
            lang = 'c++'

        ld = LdLinker(MockBuilder(), self.env, ['ld'], 'version')
        self.assertEqual(ld.lang, 'c++')
Esempio n. 8
0
 def test_flavor(self):
     ld = LdLinker(None, self.env, ['ld'], 'version')
     self.assertEqual(ld.flavor, 'ld')
Esempio n. 9
0
 def test_search_dirs(self):
     with mock.patch('bfg9000.shell.execute', mock_execute):
         ld = LdLinker(None, self.env, ['ld'], 'version')
         self.assertEqual(ld.search_dirs(), ['/dir1', '/dir2'])