Skip to content

Commit

Permalink
Add comment explaining check in libregrtest
Browse files Browse the repository at this point in the history
  • Loading branch information
ammaraskar committed Feb 10, 2019
1 parent 5c0e275 commit a8df864
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,19 +586,6 @@ def main(self, tests=None, **kwargs):
self._main(tests, kwargs)

def _main(self, tests, kwargs):
self.ns = self.parse_args(kwargs)

self.getloadavg = None
if hasattr(os, 'getloadavg'):
def getloadavg_1m():
return os.getloadavg()[0]
self.getloadavg = getloadavg_1m
elif sys.platform == 'win32' and (self.ns.slaveargs is None):
from test.libregrtest.win_utils import WindowsLoadTracker

load_tracker = WindowsLoadTracker()
self.getloadavg = load_tracker.getloadavg

if self.ns.huntrleaks:
warmup, repetitions, _ = self.ns.huntrleaks
if warmup < 1 or repetitions < 1:
Expand Down Expand Up @@ -629,6 +616,19 @@ def getloadavg_1m():
self.list_cases()
sys.exit(0)

self.getloadavg = None
# If we're on windows and this is the parent runner (not a worker),
# report the load average.
if hasattr(os, 'getloadavg'):
def getloadavg_1m():
return os.getloadavg()[0]
self.getloadavg = getloadavg_1m
elif sys.platform == 'win32' and (self.ns.worker_args is None):
from test.libregrtest.win_utils import WindowsLoadTracker

load_tracker = WindowsLoadTracker()
self.getloadavg = load_tracker.getloadavg

self.run_tests()
self.display_result()

Expand Down

0 comments on commit a8df864

Please sign in to comment.