Skip to content

Commit

Permalink
fix: Fix utils for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldsr99 committed Mar 12, 2022
1 parent 9e372b7 commit 02fcda7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_file_name(path: str):

def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str, cmp=first_error, timeout=100):
try:
sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout)
sp = subprocess.run(['bash', compiler_path, cool_file_path], stdout=subprocess.PIPE, timeout=timeout)
return_code, output = sp.returncode, sp.stdout.decode()
except subprocess.TimeoutExpired:
assert False, COMPILER_TIMEOUT
Expand All @@ -67,7 +67,7 @@ def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str
(?:Loaded: .+\n)*'''
def compare_outputs(compiler_path: str, cool_file_path: str, input_file_path: str, output_file_path: str, timeout=100):
try:
sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout)
sp = subprocess.run(['bash', compiler_path, cool_file_path], timeout=timeout)
assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path)
except subprocess.TimeoutExpired:
assert False, COMPILER_TIMEOUT
Expand All @@ -76,7 +76,7 @@ def compare_outputs(compiler_path: str, cool_file_path: str, input_file_path: st

try:
fd = open(input_file_path, 'rb')
sp = subprocess.run(['spim', '-file', spim_file], input=fd.read(), capture_output=True, timeout=timeout)
sp = subprocess.run(['spim', '-file', spim_file], input=fd.read(), timeout=timeout, capture_output=True)
fd.close()
mo = re.match(SPIM_HEADER, sp.stdout.decode())
if mo:
Expand Down

0 comments on commit 02fcda7

Please sign in to comment.