def testWithoutNaClSDKRoot(self): """GetDefaultLibPath wihtout NACL_SDK_ROOT set In the absence of NACL_SDK_ROOT GetDefaultLibPath should return the empty list.""" with mock.patch.dict('os.environ', clear=True): paths = create_nmf.GetDefaultLibPath('Debug') self.assertEqual(paths, [])
def testFallbackPath(self): paths = create_nmf.GetDefaultLibPath('foo_Debug') if sys.platform == 'win32': paths = [p.replace('\\', '/') for p in paths] path_base = '/dummy/path/lib/glibc_x86_64/foo_Debug' path_fallback = '/dummy/path/lib/glibc_x86_64/Debug' self.assertIn(path_base, paths) self.assertIn(path_fallback, paths) self.assertGreater(paths.index(path_fallback), paths.index(path_base)) paths = create_nmf.GetDefaultLibPath('foo_bar') if sys.platform == 'win32': paths = [p.replace('\\', '/') for p in paths] path_base = '/dummy/path/lib/glibc_x86_64/foo_bar' path_fallback = '/dummy/path/lib/glibc_x86_64/Release' self.assertIn(path_base, paths) self.assertIn(path_fallback, paths) self.assertGreater(paths.index(path_fallback), paths.index(path_base))
def testIncludesNaClPorts(self): with mock.patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}): paths = create_nmf.GetDefaultLibPath('Debug') self.assertTrue(any(os.path.join('ports', 'lib') in p for p in paths), "naclports libpath missing: %s" % str(paths))
def testHonorNaClSDKRoot(self): with mock.patch.dict('os.environ', {'NACL_SDK_ROOT': '/dummy/path'}): paths = create_nmf.GetDefaultLibPath('Debug') for path in paths: self.assertTrue(path.startswith('/dummy/path'))
def testUsesSDKRoot(self): paths = create_nmf.GetDefaultLibPath('Debug') for path in paths: self.assertTrue(path.startswith('/dummy/path'))
def testIncludesNaClPorts(self): paths = create_nmf.GetDefaultLibPath('Debug') self.assertTrue(any(os.path.join('ports', 'lib') in p for p in paths), "naclports libpath missing: %s" % str(paths))