Oleh Prypin 920b653c31 Add gn check presubmit
This runs `gn gen --check` with default args to detect mismatches between
#includes and dependencies in the BUILD.gn files, as well as general build
errors. Run this before uploading a CL for early detection, otherwise such
errors will cause per-platform try jobs to fail.

Bug: webrtc:8279
Change-Id: Ib87e2e3f40b8d1146ea5c1202fb113508a3f05e3
Reviewed-on: https://webrtc-review.googlesource.com/5482
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Edward Lemur <ehmaldonado@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20208}
2017-10-09 12:38:17 +00:00

31 lines
959 B
Python
Executable File

#!/usr/bin/env python
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import os
import unittest
from gn_check import RunGnCheck
TESTDATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'testdata')
class GnCheckTest(unittest.TestCase):
def testCircularDependencyError(self):
test_dir = os.path.join(TESTDATA_DIR, 'circular_dependency')
expected_errors = ['ERROR Dependency cycle:\n'
' //:bar ->\n //:foo ->\n //:bar']
self.assertListEqual(expected_errors, RunGnCheck(test_dir))
if __name__ == '__main__':
unittest.main()