Skip to content

Commit

Permalink
reproducer tests: grab output/error.
Browse files Browse the repository at this point in the history
Had a minor issue on my system and needed the actual output to
debug what was going wrong.
  • Loading branch information
tfogal committed Dec 14, 2024
1 parent 84ba13c commit 8074484
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions thunder/tests/test_dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import warnings
import itertools
import os
from subprocess import run
import subprocess
import torch
import torch.fx
import torch.nn as nn
Expand Down Expand Up @@ -820,11 +820,11 @@ def func(x):
assert os.path.exists(s1)
assert os.path.exists(s2)
cmd = "pytest" if use_pytest_benchmark else "python"
result1 = run([cmd, s1], capture_output=True, text=True)
result2 = run([cmd, s2], capture_output=True, text=True)
result1 = subprocess.run([cmd, s1], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
result2 = subprocess.run([cmd, s2], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)

assert result1.returncode == 0, f"Reproducer {s1} failed with return code {result1.returncode}"
assert result2.returncode == 0, f"Reproducer {s2} failed with return code {result2.returncode}"
assert result1.returncode == 0, f"Reproducer {s1} failed: {result1}"
assert result2.returncode == 0, f"Reproducer {s2} failed: {result2}"


@requiresCUDA
Expand Down Expand Up @@ -853,8 +853,8 @@ def forward(self, x):
s1 = f"{tmp_path}/graph0_thunder_0.py"
assert os.path.exists(s1)
cmd = "pytest" if use_pytest_benchmark else "python"
result1 = run([cmd, s1], capture_output=True, text=True)
assert result1.returncode == 0, f"Reproducer {s1} failed with return code {result1.returncode}"
result1 = subprocess.run([cmd, s1], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
assert result1.returncode == 0, f"Reproducer {s1} failed: {result1}"


def test_deepcopy_graph_module():
Expand Down Expand Up @@ -909,8 +909,8 @@ def func(x):

def check(file_name, cmd):
assert os.path.exists(file_name)
result = run([cmd, file_name], capture_output=True, text=True)
assert result.returncode == 0, f"Reproducer {file_name} failed with return code {result.returncode}"
result = subprocess.run([cmd, file_name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
assert result.returncode == 0, f"Reproducer {file_name} failed: {result}"

s1 = f"{tmp_path}/graph0_thunder_0.py"
s2 = f"{tmp_path}/graph0_thunder_2.py"
Expand Down

0 comments on commit 8074484

Please sign in to comment.