Skip to content

Commit 5e6ae8f

Browse files
[Bench] Add verbose option to bench's integration tests
1 parent 66a92e6 commit 5e6ae8f

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

devops/scripts/benchmarks/tests/test_integration.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6+
import argparse
67
import json
78
import os
89
import shutil
@@ -15,6 +16,7 @@
1516
sys.path.append(f"{os.path.dirname(__file__)}/../")
1617
from utils.workdir_version import INTERNAL_WORKDIR_VERSION
1718

19+
VERBOSE_LOGS = False
1820

1921
DataJson = namedtuple("DataJson", ["runs", "metadata", "tags", "names"])
2022
DataJsonRun = namedtuple("DataJsonRun", ["name", "results"])
@@ -65,7 +67,7 @@ def run_main(self, *args):
6567

6668
# TODO: not yet tested: "--detect-version", "sycl,compute_runtime"
6769

68-
procesResult = subprocess.run(
70+
proc = subprocess.run(
6971
[
7072
"./devops/scripts/benchmarks/main.py",
7173
self.WORKDIR_DIR,
@@ -86,13 +88,14 @@ def run_main(self, *args):
8688
"--stddev-threshold",
8789
"999999999.9",
8890
"--exit-on-failure",
91+
"--verbose" if VERBOSE_LOGS else "--log-level=info",
8992
*args,
9093
],
9194
capture_output=True,
9295
)
93-
print("MAIN_PY_STDOUT:\n" + procesResult.stdout.decode())
94-
print("MAIN_PY_STDERR:\n" + procesResult.stderr.decode())
95-
return procesResult.returncode
96+
print("MAIN_PY_STDOUT:\n" + proc.stdout.decode() if proc.stdout else "<empty>")
97+
print("MAIN_PY_STDERR:\n" + proc.stderr.decode() if proc.stderr else "<empty>")
98+
return proc.returncode
9699

97100
def get_output(self):
98101
with open(os.path.join(self.OUTPUT_DIR, "data.json")) as f:
@@ -136,9 +139,6 @@ def get_output(self):
136139
)
137140

138141

139-
# add "--verbose" for debug logs
140-
141-
142142
class TestE2E(unittest.TestCase):
143143
def setUp(self):
144144
# Load test data
@@ -226,4 +226,14 @@ def test_torch_syclpreview(self):
226226

227227

228228
if __name__ == "__main__":
229+
parser = argparse.ArgumentParser(description="SYCL's benchmark test framework")
230+
parser.add_argument(
231+
"--verbose",
232+
help="Set benchmark framework's logging level to DEBUG.",
233+
action="store_true",
234+
)
235+
236+
args = parser.parse_args()
237+
VERBOSE_LOGS = args.verbose
238+
229239
unittest.main()

0 commit comments

Comments
 (0)