Bug 781445 - Remove a python 2.7 only function from tasks_unix.py; r=benjamin

This commit is contained in:
Terrence Cole 2012-08-09 10:52:40 -07:00
Родитель d196d45b91
Коммит 36e2eb3dae
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -42,6 +42,9 @@ def spawn_test(test):
cmd = test.get_command(test.js_cmd_prefix) cmd = test.get_command(test.js_cmd_prefix)
os.execvp(cmd[0], cmd) os.execvp(cmd[0], cmd)
def total_seconds(td):
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
def get_max_wait(tasks, results, timeout): def get_max_wait(tasks, results, timeout):
""" """
Return the maximum time we can wait before any task should time out. Return the maximum time we can wait before any task should time out.
@ -52,7 +55,7 @@ def get_max_wait(tasks, results, timeout):
remaining = timedelta(seconds=timeout) - (now - task.start) remaining = timedelta(seconds=timeout) - (now - task.start)
if remaining > wait: if remaining > wait:
wait = remaining wait = remaining
wait = wait.total_seconds() wait = total_seconds(wait)
# The test harness uses a timeout of 0 to indicate we should wait forever, # The test harness uses a timeout of 0 to indicate we should wait forever,
# but for select(), a timeout of 0 indicates a zero-length wait. Instead, # but for select(), a timeout of 0 indicates a zero-length wait. Instead,
@ -163,7 +166,7 @@ def reap_zombies(tasks, results, timeout):
''.join(ended.out), ''.join(ended.out),
''.join(ended.err), ''.join(ended.err),
returncode, returncode,
(datetime.now() - ended.start).total_seconds(), total_seconds(datetime.now() - ended.start),
timed_out(ended, timeout)) timed_out(ended, timeout))
results.push(out) results.push(out)
return tasks return tasks