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_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'])