Skip to content

Commit

Permalink
more debug on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3Rabbit committed Oct 3, 2024
1 parent 0acf1a5 commit 5f48b4a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/sitespeed_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from datetime import timedelta
from datetime import datetime, timedelta
import subprocess
import time
import json
Expand Down Expand Up @@ -217,7 +217,7 @@ def get_result_using_no_cache(sitespeed_use_docker, arg, timeout):
output, error = process.communicate(timeout=process_failsafe_timeout_in_seconds)

if error is not None:
print('DEBUG get_result_using_no_cache(error)', error)
print('\tDEBUG get_result_using_no_cache(error)', error)

result = str(output)

Expand All @@ -232,19 +232,23 @@ def get_result_using_no_cache(sitespeed_use_docker, arg, timeout):
output, error = process.communicate(timeout=process_failsafe_timeout_in_seconds)

if error is not None:
print('DEBUG get_result_using_no_cache(error)', error)
print('\tDEBUG get_result_using_no_cache(error)', error)

result = str(output)

if 'Could not locate Firefox on the current system' in result:
print('ERROR! Could not locate Firefox on the current system.')
except subprocess.TimeoutExpired:
if process is not None:
print(f'\tTimeout! Exceeded {timeout} seconds at', datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
process.kill()
output, error = process.communicate()
result = str(output)
print(f'\tSubprocess killed! Exceeded {timeout} seconds at', datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
# output, error = process.communicate(timeout=process_failsafe_timeout_in_seconds)
# result = str(output)
process.terminate()
print('TIMEOUT!')
print(f'\tSubprocess terminated! Exceeded {timeout} seconds at', datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
else:
print(f'\tTimeout! Exceeded {timeout} seconds at', datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
return result
return result

Expand Down

0 comments on commit 5f48b4a

Please sign in to comment.