Patchwork [079,of,179,tests-refactor] run-tests: move checktools into TestRunner.run()

login
register
mail settings
Submitter Gregory Szorc
Date May 2, 2014, 6:38 p.m.
Message ID <7271d4004ff52e6d6a70.1399055916@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/4573/
State Accepted
Commit 592b3d2616d7ebf7ac8deafb65074d49826aa7a3
Headers show

Comments

Gregory Szorc - May 2, 2014, 6:38 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1398013500 25200
#      Sun Apr 20 10:05:00 2014 -0700
# Branch stable
# Node ID 7271d4004ff52e6d6a70f5839c5af953db0fff8c
# Parent  0d99fc077685f2eeaa8b4f5f78763d581cb2480c
run-tests: move checktools into TestRunner.run()

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1013,16 +1013,17 @@  class TestRunner(object):
         self._createdfiles = []
 
     def run(self, args):
         """Run the test suite."""
 
         # Be kind and try to clean up after ourselves.
         oldenv = dict(os.environ)
         try:
+            self._checktools()
             tests = self.findtests(args)
 
             return self._run(tests)
         finally:
             os.environ.clear()
             os.environ.update(oldenv)
 
     def _run(self, tests):
@@ -1441,17 +1442,17 @@  class TestRunner(object):
     def _findprogram(self, program):
         """Search PATH for a executable program"""
         for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
             name = os.path.join(p, program)
             if os.name == 'nt' or os.access(name, os.X_OK):
                 return name
         return None
 
-    def checktools(self):
+    def _checktools(self):
         # Before we go any further, check for pre-requisite tools
         # stuff from coreutils (cat, rm, etc) are not tested
         for p in self.REQUIREDTOOLS:
             if os.name == 'nt' and not p.endswith('.exe'):
                 p += '.exe'
             found = self._findprogram(p)
             if found:
                 vlog("# Found prerequisite", p, "at", found)
@@ -1461,14 +1462,12 @@  class TestRunner(object):
 def main(args, runner=None, parser=None):
     runner = runner or TestRunner()
 
     parser = parser or getparser()
     (options, args) = parseargs(args, parser)
     runner.options = options
     os.umask(022)
 
-    runner.checktools()
-
     return runner.run(args)
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))