X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ftools%2Fswarming_client%2Ftests%2Fisolate_format_test.py;h=a053a3edd3cbf2ee4f925474883a09a243e7b56b;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=31d8d4056a5b4e35389bdde5d9c8e50cf8be9723;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/tools/swarming_client/tests/isolate_format_test.py b/src/tools/swarming_client/tests/isolate_format_test.py index 31d8d40..a053a3e 100755 --- a/src/tools/swarming_client/tests/isolate_format_test.py +++ b/src/tools/swarming_client/tests/isolate_format_test.py @@ -14,9 +14,7 @@ ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, ROOT_DIR) import isolate_format -import run_isolated -# Create shortcuts. -from isolate_format import KEY_TOUCHED, KEY_TRACKED, KEY_UNTRACKED +from utils import file_path # Access to a protected member XXX of a client class @@ -66,37 +64,31 @@ class IsolateFormatTest(unittest.TestCase): 'conditions': [ ['OS=="amiga" or OS=="atari" or OS=="coleco" or OS=="dendy"', { 'variables': { - KEY_TRACKED: ['a'], - KEY_UNTRACKED: ['b'], - KEY_TOUCHED: ['touched'], + 'files': ['a', 'b', 'touched'], }, }], ['OS=="atari"', { 'variables': { - KEY_TRACKED: ['c', 'x'], - KEY_UNTRACKED: ['d'], - KEY_TOUCHED: ['touched_a'], + 'files': ['c', 'd', 'touched_a', 'x'], 'command': ['echo', 'Hello World'], 'read_only': 2, }, }], ['OS=="amiga" or OS=="coleco" or OS=="dendy"', { 'variables': { - KEY_TRACKED: ['e', 'x'], - KEY_UNTRACKED: ['f'], - KEY_TOUCHED: ['touched_e'], + 'files': ['e', 'f', 'touched_e', 'x'], 'command': ['echo', 'You should get an Atari'], }, }], ['OS=="amiga"', { 'variables': { - KEY_TRACKED: ['g'], + 'files': ['g'], 'read_only': 1, }, }], ['OS=="amiga" or OS=="atari" or OS=="dendy"', { 'variables': { - KEY_UNTRACKED: ['h'], + 'files': ['h'], }, }], ], @@ -106,32 +98,24 @@ class IsolateFormatTest(unittest.TestCase): 'isolate_dir': FAKE_DIR, }, ('amiga',): { - KEY_TOUCHED: ['touched', 'touched_e'], - KEY_TRACKED: ['a', 'e', 'g', 'x'], - KEY_UNTRACKED: ['b', 'f', 'h'], + 'files': ['a', 'b', 'e', 'f', 'g', 'h', 'touched', 'touched_e', 'x'], 'command': ['echo', 'You should get an Atari'], 'isolate_dir': FAKE_DIR, 'read_only': 1, }, ('atari',): { - KEY_TOUCHED: ['touched', 'touched_a'], - KEY_TRACKED: ['a', 'c', 'x'], - KEY_UNTRACKED: ['b', 'd', 'h'], + 'files': ['a', 'b', 'c', 'd', 'h', 'touched', 'touched_a', 'x'], 'command': ['echo', 'Hello World'], 'isolate_dir': FAKE_DIR, 'read_only': 2, }, ('coleco',): { - KEY_TOUCHED: ['touched', 'touched_e'], - KEY_TRACKED: ['a', 'e', 'x'], - KEY_UNTRACKED: ['b', 'f'], + 'files': ['a', 'b', 'e', 'f', 'touched', 'touched_e', 'x'], 'command': ['echo', 'You should get an Atari'], 'isolate_dir': FAKE_DIR, }, ('dendy',): { - KEY_TOUCHED: ['touched', 'touched_e'], - KEY_TRACKED: ['a', 'e', 'x'], - KEY_UNTRACKED: ['b', 'f', 'h'], + 'files': ['a', 'b', 'e', 'f', 'h', 'touched', 'touched_e', 'x'], 'command': ['echo', 'You should get an Atari'], 'isolate_dir': FAKE_DIR, }, @@ -163,19 +147,15 @@ class IsolateFormatTest(unittest.TestCase): value = { 'variables': { 'command': ['echo', 'You should get an Atari'], - KEY_TRACKED: ['a'], - KEY_UNTRACKED: ['b'], - KEY_TOUCHED: ['touched'], + 'files': ['a', 'b', 'touched'], 'read_only': 1, }, } # The key is the empty tuple, since there is no variable to bind to. expected = { (): { - KEY_TRACKED: ['a'], - KEY_UNTRACKED: ['b'], - KEY_TOUCHED: ['touched'], 'command': ['echo', 'You should get an Atari'], + 'files': ['a', 'b', 'touched'], 'isolate_dir': FAKE_DIR, 'read_only': 1, }, @@ -184,286 +164,6 @@ class IsolateFormatTest(unittest.TestCase): expected, isolate_format.load_isolate_as_config( FAKE_DIR, value, None).flatten()) - def test_invert_map(self): - value = { - ('amiga',): { - 'command': ['echo', 'You should get an Atari'], - KEY_TOUCHED: ['touched', 'touched_e'], - KEY_TRACKED: ['a', 'e', 'g', 'x'], - KEY_UNTRACKED: ['b', 'f', 'h'], - 'read_only': 0, - }, - ('atari',): { - 'command': ['echo', 'Hello World'], - KEY_TOUCHED: ['touched', 'touched_a'], - KEY_TRACKED: ['a', 'c', 'x'], - KEY_UNTRACKED: ['b', 'd', 'h'], - 'read_only': 1, - }, - ('coleco',): { - 'command': ['echo', 'You should get an Atari'], - KEY_TOUCHED: ['touched', 'touched_e'], - KEY_TRACKED: ['a', 'e', 'x'], - KEY_UNTRACKED: ['b', 'f'], - }, - ('dendy',): { - 'command': ['echo', 'You should get an Atari'], - KEY_TOUCHED: ['touched', 'touched_e'], - KEY_TRACKED: ['a', 'e', 'x'], - KEY_UNTRACKED: ['b', 'f', 'h'], - }, - } - amiga, atari, coleco, dendy = ( - set([(os,)]) for os in ('amiga', 'atari', 'coleco', 'dendy')) - expected_values = { - 'command': { - ('echo', 'Hello World'): atari, - ('echo', 'You should get an Atari'): amiga | coleco | dendy, - }, - KEY_TRACKED: { - 'a': amiga | atari | coleco | dendy, - 'c': atari, - 'e': amiga | coleco | dendy, - 'g': amiga, - 'x': amiga | atari | coleco | dendy, - }, - KEY_UNTRACKED: { - 'b': amiga | atari | coleco | dendy, - 'd': atari, - 'f': amiga | coleco | dendy, - 'h': amiga | atari | dendy, - }, - KEY_TOUCHED: { - 'touched': amiga | atari | coleco | dendy, - 'touched_a': atari, - 'touched_e': amiga | coleco | dendy, - }, - 'read_only': { - 0: amiga, - 1: atari, - }, - } - actual_values = isolate_format.invert_map(value) - self.assertEqual(expected_values, actual_values) - - def test_reduce_inputs(self): - amiga, atari, coleco, dendy = ( - set([(os,)]) for os in ('amiga', 'atari', 'coleco', 'dendy')) - values = { - 'command': { - ('echo', 'Hello World'): atari, - ('echo', 'You should get an Atari'): amiga | coleco | dendy, - }, - KEY_TRACKED: { - 'a': amiga | atari | coleco | dendy, - 'c': atari, - 'e': amiga | coleco | dendy, - 'g': amiga, - 'x': amiga | atari | coleco | dendy, - }, - KEY_UNTRACKED: { - 'b': amiga | atari | coleco | dendy, - 'd': atari, - 'f': amiga | coleco | dendy, - 'h': amiga | atari | dendy, - }, - KEY_TOUCHED: { - 'touched': amiga | atari | coleco | dendy, - 'touched_a': atari, - 'touched_e': amiga | coleco | dendy, - }, - 'read_only': { - 0: amiga, - 1: atari, - }, - } - expected_values = { - 'command': { - ('echo', 'Hello World'): atari, - ('echo', 'You should get an Atari'): amiga | coleco | dendy, - }, - KEY_TRACKED: { - 'a': amiga | atari | coleco | dendy, - 'c': atari, - 'e': amiga | coleco | dendy, - 'g': amiga, - 'x': amiga | atari | coleco | dendy, - }, - KEY_UNTRACKED: { - 'b': amiga | atari | coleco | dendy, - 'd': atari, - 'f': amiga | coleco | dendy, - 'h': amiga | atari | dendy, - }, - KEY_TOUCHED: { - 'touched': amiga | atari | coleco | dendy, - 'touched_a': atari, - 'touched_e': amiga | coleco | dendy, - }, - 'read_only': { - 0: amiga, - 1: atari, - }, - } - actual_values = isolate_format.reduce_inputs(values) - self.assertEqual(expected_values, actual_values) - - def test_reduce_inputs_merge_subfolders_and_files(self): - linux, mac, win = (set([(os,)]) for os in ('linux', 'mac', 'win')) - values = { - KEY_TRACKED: { - 'folder/tracked_file': win, - 'folder_helper/tracked_file': win, - }, - KEY_UNTRACKED: { - 'folder/': linux | mac | win, - 'folder/subfolder/': win, - 'folder/untracked_file': linux | mac | win, - 'folder_helper/': linux, - }, - KEY_TOUCHED: { - 'folder/touched_file': win, - 'folder/helper_folder/deep_file': win, - 'folder_helper/touched_file1': mac | win, - 'folder_helper/touched_file2': linux, - }, - } - expected_values = { - 'command': {}, - KEY_TRACKED: { - 'folder_helper/tracked_file': win, - }, - KEY_UNTRACKED: { - 'folder/': linux | mac | win, - 'folder_helper/': linux, - }, - KEY_TOUCHED: { - 'folder_helper/touched_file1': mac | win, - }, - 'read_only': {}, - } - actual_values = isolate_format.reduce_inputs(values) - self.assertEqual(expected_values, actual_values) - - def test_reduce_inputs_take_strongest_dependency(self): - amiga, atari, coleco, dendy = ( - set([(os,)]) for os in ('amiga', 'atari', 'coleco', 'dendy')) - values = { - 'command': { - ('echo', 'Hello World'): atari, - ('echo', 'You should get an Atari'): amiga | coleco | dendy, - }, - KEY_TRACKED: { - 'a': amiga | atari | coleco | dendy, - 'b': amiga | atari | coleco, - }, - KEY_UNTRACKED: { - 'c': amiga | atari | coleco | dendy, - 'd': amiga | coleco | dendy, - }, - KEY_TOUCHED: { - 'a': amiga | atari | coleco | dendy, - 'b': atari | coleco | dendy, - 'c': amiga | atari | coleco | dendy, - 'd': atari | coleco | dendy, - }, - } - expected_values = { - 'command': { - ('echo', 'Hello World'): atari, - ('echo', 'You should get an Atari'): amiga | coleco | dendy, - }, - KEY_TRACKED: { - 'a': amiga | atari | coleco | dendy, - 'b': amiga | atari | coleco, - }, - KEY_UNTRACKED: { - 'c': amiga | atari | coleco | dendy, - 'd': amiga | coleco | dendy, - }, - KEY_TOUCHED: { - 'b': dendy, - 'd': atari, - }, - 'read_only': {}, - } - actual_values = isolate_format.reduce_inputs(values) - self.assertEqual(expected_values, actual_values) - - def test_convert_map_to_isolate_dict(self): - amiga = ('amiga',) - atari = ('atari',) - coleco = ('coleco',) - dendy = ('dendy',) - values = { - 'command': { - ('echo', 'Hello World'): (atari,), - ('echo', 'You should get an Atari'): (amiga, coleco, dendy), - }, - KEY_TRACKED: { - 'a': (amiga, atari, coleco, dendy), - 'c': (atari,), - 'e': (amiga, coleco, dendy), - 'g': (amiga,), - 'x': (amiga, atari, coleco, dendy), - }, - KEY_UNTRACKED: { - 'b': (amiga, atari, coleco, dendy), - 'd': (atari,), - 'f': (amiga, coleco, dendy), - 'h': (amiga, atari, dendy), - }, - KEY_TOUCHED: { - 'touched': (amiga, atari, coleco, dendy), - 'touched_a': (atari,), - 'touched_e': (amiga, coleco, dendy), - }, - 'read_only': { - 0: (amiga,), - 1: (atari,), - }, - } - expected_conditions = [ - ['OS=="amiga"', { - 'variables': { - KEY_TRACKED: ['g'], - 'read_only': 0, - }, - }], - ['OS=="amiga" or OS=="atari" or OS=="coleco" or OS=="dendy"', { - 'variables': { - KEY_TRACKED: ['a', 'x'], - KEY_UNTRACKED: ['b'], - KEY_TOUCHED: ['touched'], - }, - }], - ['OS=="amiga" or OS=="atari" or OS=="dendy"', { - 'variables': { - KEY_UNTRACKED: ['h'], - }, - }], - ['OS=="amiga" or OS=="coleco" or OS=="dendy"', { - 'variables': { - 'command': ['echo', 'You should get an Atari'], - KEY_TRACKED: ['e'], - KEY_UNTRACKED: ['f'], - KEY_TOUCHED: ['touched_e'], - }, - }], - ['OS=="atari"', { - 'variables': { - 'command': ['echo', 'Hello World'], - KEY_TRACKED: ['c'], - KEY_UNTRACKED: ['d'], - KEY_TOUCHED: ['touched_a'], - 'read_only': 1, - }, - }], - ] - actual = isolate_format.convert_map_to_isolate_dict(values, ('OS',)) - self.assertEqual(expected_conditions, sorted(actual.pop('conditions'))) - self.assertFalse(actual) - def test_merge_two_empty(self): # Flat stay flat. Pylint is confused about union() return type. # pylint: disable=E1103 @@ -477,18 +177,12 @@ class IsolateFormatTest(unittest.TestCase): } self.assertEqual(expected, actual.flatten()) - def test_merge_empty(self): - actual = isolate_format.convert_map_to_isolate_dict( - isolate_format.reduce_inputs(isolate_format.invert_map({})), - ('dummy1', 'dummy2')) - self.assertEqual({'conditions': []}, actual) - def test_load_two_conditions(self): linux = { 'conditions': [ ['OS=="linux"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', 'file_common', ], @@ -500,7 +194,7 @@ class IsolateFormatTest(unittest.TestCase): 'conditions': [ ['OS=="mac"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_mac', 'file_common', ], @@ -513,11 +207,11 @@ class IsolateFormatTest(unittest.TestCase): 'isolate_dir': FAKE_DIR, }, ('linux',): { - 'isolate_dependency_tracked': ['file_common', 'file_linux'], + 'files': ['file_common', 'file_linux'], 'isolate_dir': FAKE_DIR, }, ('mac',): { - 'isolate_dependency_tracked': ['file_common', 'file_mac'], + 'files': ['file_common', 'file_mac'], 'isolate_dir': FAKE_DIR, }, } @@ -534,7 +228,7 @@ class IsolateFormatTest(unittest.TestCase): 'conditions': [ ['OS=="linux" and chromeos==1', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', 'file_common', ], @@ -546,7 +240,7 @@ class IsolateFormatTest(unittest.TestCase): 'conditions': [ ['OS=="mac" and chromeos==0', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_mac', 'file_common', ], @@ -558,7 +252,7 @@ class IsolateFormatTest(unittest.TestCase): 'conditions': [ ['OS=="win" and chromeos==0', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_win', 'file_common', ], @@ -571,15 +265,15 @@ class IsolateFormatTest(unittest.TestCase): 'isolate_dir': FAKE_DIR, }, ('linux', 1): { - 'isolate_dependency_tracked': ['file_common', 'file_linux'], + 'files': ['file_common', 'file_linux'], 'isolate_dir': FAKE_DIR, }, ('mac', 0): { - 'isolate_dependency_tracked': ['file_common', 'file_mac'], + 'files': ['file_common', 'file_mac'], 'isolate_dir': FAKE_DIR, }, ('win', 0): { - 'isolate_dependency_tracked': ['file_common', 'file_win'], + 'files': ['file_common', 'file_win'], 'isolate_dir': FAKE_DIR, }, } @@ -682,212 +376,18 @@ class IsolateFormatTest(unittest.TestCase): } self.assertEqual(expected, flatten) - def test_make_isolate_multi_variables(self): - config = isolate_format.Configs(None, ('CHROMEOS', 'OS')) - config._by_config[(('0', 'linux'))] = isolate_format.ConfigSettings( - {'command': ['bar']}, FAKE_DIR) - config._by_config[(('1', 'linux'))] = isolate_format.ConfigSettings( - {'command': ['foo']}, FAKE_DIR) - expected = { - 'conditions': [ - ['CHROMEOS=="0" and OS=="linux"', { - 'variables': { - 'command': ['bar'], - }, - }], - ['CHROMEOS=="1" and OS=="linux"', { - 'variables': { - 'command': ['foo'], - }, - }], - ], - } - self.assertEqual(expected, config.make_isolate_file()) - - def test_make_isolate_multi_variables_missing(self): - config = isolate_format.Configs(None, ('CHROMEOS', 'OS')) - config._by_config[((None, 'abc'))] = isolate_format.ConfigSettings( - {'command': ['bar']}, FAKE_DIR) - config._by_config[(('1', None))] = isolate_format.ConfigSettings( - {'command': ['foo']}, FAKE_DIR) - expected = { - 'conditions': [ - ['CHROMEOS=="1"', { - 'variables': { - 'command': ['foo'], - }, - }], - ['OS=="abc"', { - 'variables': { - 'command': ['bar'], - }, - }], - ], - } - self.assertEqual(expected, config.make_isolate_file()) - - def test_make_isolate_4_variables(self): - # Test multiple combinations of bound and free variables. - config = isolate_format.Configs(None, ('BRAND', 'CHROMEOS', 'LIB', 'OS')) - config._by_config = { - (None, 0, 's', 'linux'): isolate_format.ConfigSettings( - {'command': ['bar']}, FAKE_DIR), - (None, None, 's', 'mac'): isolate_format.ConfigSettings( - {'command': ['foo']}, FAKE_DIR), - (None, None, 's', 'win'): isolate_format.ConfigSettings( - {'command': ['ziz']}, FAKE_DIR), - ('Chrome', 0, 's', 'win'): isolate_format.ConfigSettings( - {'command': ['baz']}, FAKE_DIR), - } - expected = { - 'conditions': [ - ['BRAND=="Chrome" and CHROMEOS==0 and LIB=="s" and OS=="win"', { - 'variables': { - 'command': ['baz'], - }, - }], - ['CHROMEOS==0 and LIB=="s" and OS=="linux"', { - 'variables': { - 'command': ['bar'], - }, - }], - ['LIB=="s" and OS=="mac"', { - 'variables': { - 'command': ['foo'], - }, - }], - ['LIB=="s" and OS=="win"', { - 'variables': { - 'command': ['ziz'], - }, - }], - ], - } - self.assertEqual(expected, config.make_isolate_file()) - def test_ConfigSettings_union(self): lhs_values = {} - rhs_values = {KEY_UNTRACKED: ['data/', 'test/data/']} + rhs_values = {'files': ['data/', 'test/data/']} lhs = isolate_format.ConfigSettings(lhs_values, '/src/net/third_party/nss') rhs = isolate_format.ConfigSettings(rhs_values, '/src/base') out = lhs.union(rhs) expected = { - KEY_UNTRACKED: ['data/', 'test/data/'], + 'files': ['data/', 'test/data/'], 'isolate_dir': '/src/base', } self.assertEqual(expected, out.flatten()) - def test_merge_three_conditions(self): - values = { - ('linux',): { - 'isolate_dependency_tracked': ['file_common', 'file_linux'], - }, - ('mac',): { - 'isolate_dependency_tracked': ['file_common', 'file_mac'], - }, - ('win',): { - 'isolate_dependency_tracked': ['file_common', 'file_win'], - }, - } - expected = { - 'conditions': [ - ['OS=="linux"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_linux', - ], - }, - }], - ['OS=="linux" or OS=="mac" or OS=="win"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_common', - ], - }, - }], - ['OS=="mac"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_mac', - ], - }, - }], - ['OS=="win"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_win', - ], - }, - }], - ], - } - actual = isolate_format.convert_map_to_isolate_dict( - isolate_format.reduce_inputs(isolate_format.invert_map(values)), - ('OS',)) - self.assertEqual(expected, actual) - - def test_merge_three_conditions_read_only(self): - values = { - ('linux',): { - 'isolate_dependency_tracked': ['file_common', 'file_linux'], - 'read_only': 1, - }, - ('mac',): { - 'isolate_dependency_tracked': ['file_common', 'file_mac'], - 'read_only': 0, - }, - ('win',): { - 'isolate_dependency_tracked': ['file_common', 'file_win'], - 'read_only': 2, - }, - ('amiga',): { - 'read_only': 1, - } - } - expected = { - 'conditions': [ - ['OS=="amiga" or OS=="linux"', { - 'variables': { - 'read_only': 1, - }, - }], - ['OS=="linux"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_linux', - ], - }, - }], - ['OS=="linux" or OS=="mac" or OS=="win"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_common', - ], - }, - }], - ['OS=="mac"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_mac', - ], - 'read_only': 0, - }, - }], - ['OS=="win"', { - 'variables': { - 'isolate_dependency_tracked': [ - 'file_win', - ], - 'read_only': 2, - }, - }], - ], - } - actual = isolate_format.convert_map_to_isolate_dict( - isolate_format.reduce_inputs(isolate_format.invert_map(values)), - ('OS',)) - self.assertEqual(expected, actual) - def test_configs_comment(self): # Pylint is confused with isolate_format.union() return type. # pylint: disable=E1103 @@ -924,7 +424,7 @@ class IsolateFormatTest(unittest.TestCase): def test_pretty_print_mid_size(self): value = { 'variables': { - KEY_TOUCHED: [ + 'files': [ 'file1', 'file2', ], @@ -932,13 +432,11 @@ class IsolateFormatTest(unittest.TestCase): 'conditions': [ ['OS==\"foo\"', { 'variables': { - KEY_UNTRACKED: [ - 'dir1', - 'dir2', - ], - KEY_TRACKED: [ - 'file4', + 'files': [ + 'dir1/', + 'dir2/', 'file3', + 'file4', ], 'command': ['python', '-c', 'print "H\\i\'"'], 'read_only': 2, @@ -954,7 +452,7 @@ class IsolateFormatTest(unittest.TestCase): expected = ( "{\n" " 'variables': {\n" - " 'isolate_dependency_touched': [\n" + " 'files': [\n" " 'file1',\n" " 'file2',\n" " ],\n" @@ -967,15 +465,13 @@ class IsolateFormatTest(unittest.TestCase): " '-c',\n" " 'print \"H\\i\'\"',\n" " ],\n" - " 'read_only': 2,\n" - " 'isolate_dependency_tracked': [\n" - " 'file4',\n" + " 'files': [\n" + " 'dir1/',\n" + " 'dir2/',\n" " 'file3',\n" + " 'file4',\n" " ],\n" - " 'isolate_dependency_untracked': [\n" - " 'dir1',\n" - " 'dir2',\n" - " ],\n" + " 'read_only': 2,\n" " },\n" " }],\n" " ['OS==\"bar\"', {\n" @@ -1044,14 +540,14 @@ class IsolateFormatTest(unittest.TestCase): def test_load_with_globals(self): values = { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_common', ], }, 'conditions': [ ['OS=="linux"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', ], 'read_only': 1, @@ -1059,7 +555,7 @@ class IsolateFormatTest(unittest.TestCase): }], ['OS=="mac" or OS=="win"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_non_linux', ], 'read_only': 0, @@ -1069,27 +565,27 @@ class IsolateFormatTest(unittest.TestCase): } expected = { (None,): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_common', ], 'isolate_dir': FAKE_DIR, }, ('linux',): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', ], 'isolate_dir': FAKE_DIR, 'read_only': 1, }, ('mac',): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_non_linux', ], 'isolate_dir': FAKE_DIR, 'read_only': 0, }, ('win',): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_non_linux', ], 'isolate_dir': FAKE_DIR, @@ -1099,77 +595,6 @@ class IsolateFormatTest(unittest.TestCase): actual = isolate_format.load_isolate_as_config(FAKE_DIR, values, None) self.assertEqual(expected, actual.flatten()) - def test_configs_with_globals(self): - c = isolate_format.Configs(None, ('x', 'y')) - c.set_config( - (1, 1), isolate_format.ConfigSettings({KEY_TRACKED: ['1,1']}, FAKE_DIR)) - c.set_config( - (2, 2), isolate_format.ConfigSettings({KEY_TRACKED: ['2,2']}, FAKE_DIR)) - c.set_config( - (1, None), - isolate_format.ConfigSettings({KEY_TRACKED: ['1,y']}, FAKE_DIR)) - c.set_config( - (None, 2), - isolate_format.ConfigSettings({KEY_TRACKED: ['x,2']}, FAKE_DIR)) - c.set_config( - (None, None), - isolate_format.ConfigSettings({KEY_TRACKED: ['x,y']}, FAKE_DIR)) - expected = { - (None, None): { - KEY_TRACKED: ['x,y'], - 'isolate_dir': FAKE_DIR, - }, - (None, 2): { - KEY_TRACKED: ['x,2'], - 'isolate_dir': FAKE_DIR, - }, - (1, None): { - KEY_TRACKED: ['1,y'], - 'isolate_dir': FAKE_DIR, - }, - (1, 1): { - KEY_TRACKED: ['1,1'], - 'isolate_dir': FAKE_DIR, - }, - (2, 2): { - KEY_TRACKED: ['2,2'], - 'isolate_dir': FAKE_DIR, - }, - } - self.assertEqual(expected, c.flatten()) - - s = c.get_config((1, 1)) - expected = { - KEY_TRACKED: ['1,1', '1,y', 'x,y'], - 'isolate_dir': FAKE_DIR, - } - self.assertEqual(expected, s.flatten()) - - s = c.get_config((1, None)) - expected = { - KEY_TRACKED: ['1,y', 'x,y'], - 'isolate_dir': FAKE_DIR, - } - self.assertEqual(expected, s.flatten()) - - s = c.get_config((None, None)) - expected = { - KEY_TRACKED: ['x,y'], - 'isolate_dir': FAKE_DIR, - } - self.assertEqual(expected, s.flatten()) - - expected = { - 'conditions': [ - ['x==1', {'variables': {KEY_TRACKED: ['1,y']}}], - ['x==1 and y==1', {'variables': {KEY_TRACKED: ['1,1']}}], - ['x==2 and y==2', {'variables': {KEY_TRACKED: ['2,2']}}], - ['y==2', {'variables': {KEY_TRACKED: ['x,2']}}], - ], - 'variables': {KEY_TRACKED: ['x,y']}, - } - self.assertEqual(expected, c.make_isolate_file()) - class IsolateFormatTmpDirTest(unittest.TestCase): def setUp(self): @@ -1178,21 +603,21 @@ class IsolateFormatTmpDirTest(unittest.TestCase): def tearDown(self): try: - run_isolated.rmtree(self.tempdir) + file_path.rmtree(self.tempdir) finally: super(IsolateFormatTmpDirTest, self).tearDown() def test_load_with_includes(self): included_isolate = { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_common', ], }, 'conditions': [ ['OS=="linux"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', ], 'read_only': 1, @@ -1200,7 +625,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): }], ['OS=="mac" or OS=="win"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_non_linux', ], 'read_only': 0, @@ -1213,14 +638,14 @@ class IsolateFormatTmpDirTest(unittest.TestCase): values = { 'includes': ['included.isolate'], 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_less_common', ], }, 'conditions': [ ['OS=="mac"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_mac', ], 'read_only': 2, @@ -1232,21 +657,21 @@ class IsolateFormatTmpDirTest(unittest.TestCase): expected = { (None,): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_common', 'file_less_common', ], 'isolate_dir': self.tempdir, }, ('linux',): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', ], 'isolate_dir': self.tempdir, 'read_only': 1, }, ('mac',): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_mac', 'file_non_linux', ], @@ -1254,7 +679,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'read_only': 2, }, ('win',): { - 'isolate_dependency_tracked': [ + 'files': [ 'file_non_linux', ], 'isolate_dir': self.tempdir, @@ -1287,14 +712,14 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'command': [ 'foo', 'linux', ], - 'isolate_dependency_tracked': [ + 'files': [ 'file_linux', ], }, }], ['OS=="mac" or OS=="win"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_non_linux', ], }, @@ -1308,7 +733,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'command': [ 'foo', 'linux_or_mac', ], - 'isolate_dependency_tracked': [ + 'files': [ 'other/file', ], }, @@ -1323,7 +748,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'conditions': [ ['OS=="amiga"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ 'file_amiga', ], }, @@ -1333,7 +758,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'command': [ 'foo', 'mac', ], - 'isolate_dependency_tracked': [ + 'files': [ 'file_mac', ], }, @@ -1358,7 +783,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): }, ('amiga',): { 'command': ['foo', 'amiga_or_win'], - 'isolate_dependency_tracked': [ + 'files': [ # Note that the file was rebased from isolate1. This is important, # isolate1 represent the canonical root path because it is the one # that defined the command. @@ -1371,7 +796,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): # it becomes the canonical root, so reference to file from isolate1 is # via '../../1'. 'command': ['foo', 'linux_or_mac'], - 'isolate_dependency_tracked': [ + 'files': [ '../../1/file_linux', 'other/file', ], @@ -1380,7 +805,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): ('mac',): { # command in isolate3 takes precedence over the ones included. 'command': ['foo', 'mac'], - 'isolate_dependency_tracked': [ + 'files': [ '../1/file_non_linux', '2/other/file', 'file_mac', @@ -1390,7 +815,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): ('win',): { # command comes from isolate1. 'command': ['foo', 'amiga_or_win'], - 'isolate_dependency_tracked': [ + 'files': [ # While this may be surprising, this is because the command was # defined in isolate1, not isolate3. 'file_non_linux', @@ -1424,14 +849,14 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'command': [ 'foo', 'linux', '<(PATH)', ], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_linux', ], }, }], ['OS=="mac" or OS=="win"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_non_linux', ], }, @@ -1445,7 +870,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'command': [ 'foo', 'linux_or_mac', '<(PATH)', ], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/other/file', ], }, @@ -1460,7 +885,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'conditions': [ ['OS=="amiga"', { 'variables': { - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_amiga', ], }, @@ -1470,7 +895,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): 'command': [ 'foo', 'mac', '<(PATH)', ], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_mac', ], }, @@ -1493,7 +918,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): }, ('amiga',): { 'command': ['foo', 'amiga_or_win', '<(PATH)'], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_amiga', ], 'isolate_dir': dir_1, @@ -1503,7 +928,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): # it becomes the canonical root, so reference to file from isolate1 is # via '../../1'. 'command': ['foo', 'linux_or_mac', '<(PATH)'], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_linux', '<(PATH)/other/file', ], @@ -1511,7 +936,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): }, ('mac',): { 'command': ['foo', 'mac', '<(PATH)'], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_mac', '<(PATH)/file_non_linux', '<(PATH)/other/file', @@ -1521,7 +946,7 @@ class IsolateFormatTmpDirTest(unittest.TestCase): ('win',): { # command comes from isolate1. 'command': ['foo', 'amiga_or_win', '<(PATH)'], - 'isolate_dependency_tracked': [ + 'files': [ '<(PATH)/file_non_linux', ], 'isolate_dir': dir_1,