9SKY_TOOLS = os.path.dirname(os.path.abspath(__file__))
10gn = imp.load_source(
'gn', os.path.join(SKY_TOOLS,
'gn'))
15 def _expect_build_dir(self, arg_list, expected_build_dir):
17 self.assertEqual(gn.get_out_dir(args), expected_build_dir)
20 self.
_expect_build_dir([
'--runtime-mode',
'debug'], os.path.join(
'out',
'host_debug'))
21 self.
_expect_build_dir([
'--runtime-mode',
'release'], os.path.join(
'out',
'host_release'))
24 os.path.join(
'out',
'ios_debug_extension_safe'))
26 os.path.join(
'out',
'ios_release'))
27 self.
_expect_build_dir([
'--ios',
'--darwin-extension-safe',
'--runtime-mode',
'release'],
28 os.path.join(
'out',
'ios_release_extension_safe'))
31 os.path.join(
'out',
'android_release'))
33 def _gn_args(self, arg_list):
35 return gn.to_gn_args(args)
40 self.
_gn_args([
'--ios',
'--simulator',
'--simulator-cpu',
'x64'])[
'target_cpu'],
'x64'
42 self.assertEqual(self.
_gn_args([
'--ios'])[
'target_cpu'],
'arm64')
45 with self.assertRaises(Exception):
46 self.
_gn_args([
'--android',
'--enable-unittests'])
49 with self.assertRaises(Exception):
50 self.
_gn_args([
'--ios',
'--enable-unittests'])
53 self.assertEqual(gn.parse_size(
'5B'), 5)
54 self.assertEqual(gn.parse_size(
'5KB'), 5 * 2**10)
55 self.assertEqual(gn.parse_size(
'5MB'), 5 * 2**20)
56 self.assertEqual(gn.parse_size(
'5GB'), 5 * 2**30)
59if __name__ ==
'__main__':
def test_cannot_use_android_and_enable_unittests(self)
def test_parse_size(self)
def test_to_gn_args(self)
def _expect_build_dir(self, arg_list, expected_build_dir)
def test_cannot_use_ios_and_enable_unittests(self)
def _gn_args(self, arg_list)
def test_get_out_dir(self)