Bug 1149156 - Add support for long form of try flags r=garndt
authorjlal@mozilla.com
Fri, 24 Apr 2015 14:32:23 -0700
changeset 241111 d2e217ee8f662033023603e0473b3b7ea0a87955
parent 241110 4a5d4a0a7115c49fea032e8626acca75997830fa
child 241112 5bcf1bbf9f616441145a90d925e4b6146e096a5c
push id59036
push usercbook@mozilla.com
push dateMon, 27 Apr 2015 10:37:48 +0000
treeherdermozilla-inbound@ad388474898c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgarndt
bugs1149156
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1149156 - Add support for long form of try flags r=garndt
testing/taskcluster/taskcluster_graph/commit_parser.py
testing/taskcluster/tests/test_commit_parser.py
--- a/testing/taskcluster/taskcluster_graph/commit_parser.py
+++ b/testing/taskcluster/taskcluster_graph/commit_parser.py
@@ -186,19 +186,19 @@ def parse_commit(message, jobs):
             break
 
     if try_idx is None:
         raise InvalidCommitException('Invalid commit format contain ' +
                 TRY_DELIMITER)
 
     # Argument parser based on try flag flags
     parser = argparse.ArgumentParser()
-    parser.add_argument('-b', dest='build_types')
-    parser.add_argument('-p', nargs='?', dest='platforms', const='all', default='all')
-    parser.add_argument('-u', nargs='?', dest='tests', const='all', default='all')
+    parser.add_argument('-b', '--build', dest='build_types')
+    parser.add_argument('-p', '--platform', nargs='?', dest='platforms', const='all', default='all')
+    parser.add_argument('-u', '--unittests', nargs='?', dest='tests', const='all', default='all')
     args, unknown = parser.parse_known_args(parts[try_idx:])
 
     # Then builds...
     if args.build_types is None:
         return []
 
     build_types = [ BUILD_TYPE_ALIASES.get(build_type, build_type) for
             build_type in args.build_types ]
--- a/testing/taskcluster/tests/test_commit_parser.py
+++ b/testing/taskcluster/tests/test_commit_parser.py
@@ -478,18 +478,16 @@ class TestCommitParser(unittest.TestCase
                     }
                 ],
                 'additional-parameters': {}
             }
         ]
         result = parse_commit(commit, jobs)
         self.assertEqual(expected, result)
 
-
-
     def test_commit_with_builds_and_tests(self):
         '''
         This test covers the broad case of a commit which has both builds and
         tests without any exclusions or other fancy logic.
         '''
         commit = 'try: -b od -p linux,linux64 -u web-platform-tests -t none'
         jobs = {
             'flags': {
@@ -627,12 +625,157 @@ class TestCommitParser(unittest.TestCase
                 ],
                 'additional-parameters': {}
             }
         ]
 
         result = parse_commit(commit, jobs)
         self.assertEqual(expected, result)
 
+    def test_commit_with_builds_and_tests(self):
+        '''
+        This tests the long form of the try flags.
+        '''
+        commit = 'try: --build od --platform linux,linux64 --unittests web-platform-tests --talos none'
+        jobs = {
+            'flags': {
+                'builds': ['linux', 'linux64'],
+                'tests': ['web-platform-tests'],
+            },
+            'builds': {
+                'linux': {
+                    'types': {
+                        'opt': {
+                            'task': 'task/linux',
+                         },
+                        'debug': {
+                            'task': 'task/linux-debug'
+                        }
+                    }
+                },
+                'linux64': {
+                    'types': {
+                        'opt': {
+                            'task': 'task/linux64',
+                         },
+                        'debug': {
+                            'task': 'task/linux64-debug'
+                        }
+                    }
+                }
+            },
+            'tests': {
+                'web-platform-tests': {
+                    'allowed_build_tasks': {
+                        'task/linux': {
+                            'task': 'task/web-platform-tests',
+                        },
+                        'task/linux-debug': {
+                            'task': 'task/web-platform-tests',
+                        },
+                        'task/linux64': {
+                            'task': 'task/web-platform-tests',
+                        },
+                        'task/linux64-debug': {
+                            'task': 'task/web-platform-tests',
+                        }
+                    }
+                }
+            }
+        }
+
+        expected = [
+            {
+                'task': 'task/linux',
+                'dependents': [
+                    {
+                        'allowed_build_tasks': {
+                            'task/linux': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux-debug': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64-debug': {
+                                'task': 'task/web-platform-tests',
+                            }
+                        }
+                    }
+                ],
+                'additional-parameters': {}
+            },
+            {
+                'task': 'task/linux-debug',
+                'dependents': [
+                    {
+                        'allowed_build_tasks': {
+                            'task/linux': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux-debug': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64-debug': {
+                                'task': 'task/web-platform-tests',
+                            }
+                        }
+                    }
+                ],
+                'additional-parameters': {}
+            },
+            {
+                'task': 'task/linux64',
+                'dependents': [
+                    {
+                        'allowed_build_tasks': {
+                            'task/linux': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux-debug': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64-debug': {
+                                'task': 'task/web-platform-tests',
+                            }
+                        }
+                    }
+                ],
+                'additional-parameters': {}
+            },
+            {
+                'task': 'task/linux64-debug',
+                'dependents': [
+                    {
+                        'allowed_build_tasks': {
+                            'task/linux': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux-debug': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64': {
+                                'task': 'task/web-platform-tests',
+                            },
+                            'task/linux64-debug': {
+                                'task': 'task/web-platform-tests',
+                            }
+                        }
+                    }
+                ],
+                'additional-parameters': {}
+            }
+        ]
+
+        result = parse_commit(commit, jobs)
+        self.assertEqual(expected, result)
+
 
 if __name__ == '__main__':
     mozunit.main()
-