MCPcopy Create free account
hub / github.com/qilingframework/qiling / test_convert_posix_to_nt

Method test_convert_posix_to_nt

tests/test_pathutils.py:75–95  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

73
74 @unittest.skipUnless(is_nt_host, 'NT host only')
75 def test_convert_posix_to_nt(self):
76 rootfs = PureWindowsPath(r'../examples/rootfs/x86_linux')
77
78 expected = str(realpath(rootfs) / 'test')
79
80 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '/test'))
81 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '/../test'))
82 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '/../../test'))
83 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '/../xxxx/../test'))
84
85 self.assertEqual(expected, posix_to_native(str(rootfs), '/', 'test'))
86 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '../test'))
87 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '../../test'))
88 self.assertEqual(expected, posix_to_native(str(rootfs), '/', '../xxxx/../test'))
89
90 expected = str(realpath(rootfs) / 'proc' / 'test')
91
92 self.assertEqual(expected, posix_to_native(str(rootfs), '/proc', 'test'))
93 self.assertEqual(expected, posix_to_native(str(rootfs), '/proc/sys', '../test'))
94 self.assertEqual(expected, posix_to_native(str(rootfs), '/proc/sys/net', '../../test'))
95 self.assertEqual(expected, posix_to_native(str(rootfs), '/proc/sys', '../xxxx/../test'))
96
97 def test_convert_for_native_os(self):
98

Callers

nothing calls this directly

Calls 2

realpathFunction · 0.85
posix_to_nativeFunction · 0.85

Tested by

no test coverage detected