]> git.ipfire.org Git - u-boot.git/commitdiff
buildman: Allow skipping of tests which use the network
authorSimon Glass <sjg@chromium.org>
Mon, 13 Nov 2017 04:52:14 +0000 (21:52 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 23 Nov 2017 01:05:38 +0000 (18:05 -0700)
Accessing the network slows down the test and limits the environment in
which it can be run. Add an option to disable network tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/buildman.py
tools/buildman/cmdline.py
tools/buildman/test.py

index 607429df7bcd9fb045e30ce1fa81a6cba318110d..11a4f162c5f13026d3a85f28be6d940cb42319a9 100755 (executable)
@@ -30,7 +30,7 @@ import patchstream
 import terminal
 import toolchain
 
-def RunTests():
+def RunTests(skip_net_tests):
     import func_test
     import test
     import doctest
@@ -41,6 +41,8 @@ def RunTests():
         suite.run(result)
 
     sys.argv = [sys.argv[0]]
+    if skip_net_tests:
+        test.use_network = False
     for module in (test.TestBuild, func_test.TestFunctional):
         suite = unittest.TestLoader().loadTestsFromTestCase(module)
         suite.run(result)
@@ -56,7 +58,7 @@ options, args = cmdline.ParseArgs()
 
 # Run our meagre tests
 if options.test:
-    RunTests()
+    RunTests(options.skip_net_tests)
 
 # Build selected commits for selected boards
 else:
index 0060e0317c754aa6c8ae5665c8382e59490af15c..74247f0aff128320f0de30a3f3a4f30dcf2da18c 100644 (file)
@@ -82,6 +82,8 @@ def ParseArgs():
           default=False, help='Show a build summary')
     parser.add_option('-S', '--show-sizes', action='store_true',
           default=False, help='Show image size variation in summary')
+    parser.add_option('--skip-net-tests', action='store_true', default=False,
+                      help='Skip tests which need the network')
     parser.add_option('--step', type='int',
           default=1, help='Only build every n commits (0=just first and last)')
     parser.add_option('-t', '--test', action='store_true', dest='test',
index 53ebc3756c9147fe50ea630db555f33f7fe1eced..e81400f37259aa26c90556cc84e24bb5af26b888 100644 (file)
@@ -24,6 +24,8 @@ import commit
 import terminal
 import toolchain
 
+use_network = True
+
 settings_data = '''
 # Buildman settings file
 
@@ -410,8 +412,9 @@ class TestBuild(unittest.TestCase):
 
     def testToolchainDownload(self):
         """Test that we can download toolchains"""
-        self.assertEqual('https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_arm-unknown-linux-gnueabi.tar.xz',
-            self.toolchains.LocateArchUrl('arm'))
+        if use_network:
+            self.assertEqual('https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_arm-unknown-linux-gnueabi.tar.xz',
+                self.toolchains.LocateArchUrl('arm'))
 
 
 if __name__ == "__main__":