Skip to content

Commit

Permalink
remove extra saved_dfs test
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Santos <josantos@amd.com>
  • Loading branch information
JoseSantosAMD authored and koomie committed Feb 28, 2024
1 parent 7c6b965 commit 597acee
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions tests/test_analyze_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from unittest.mock import patch
import pytest
from importlib.machinery import SourceFileLoader
import shutil
import pandas as pd

omniperf = SourceFileLoader("omniperf", "src/omniperf").load_module()

Expand Down Expand Up @@ -1171,6 +1173,8 @@ def test_decimal_3():

@pytest.mark.misc
def test_save_dfs():
output_path = "tests/workloads/vcopy/saved_analysis"

with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
Expand All @@ -1180,7 +1184,7 @@ def test_save_dfs():
"--path",
"tests/workloads/vcopy/MI100",
"--save-dfs",
"saved_dfs",
output_path,
],
):
omniperf.main()
Expand All @@ -1195,12 +1199,50 @@ def test_save_dfs():
"--path",
"tests/workloads/vcopy/MI200",
"--save-dfs",
"saved_dfs",
output_path,
],
):
omniperf.main()
assert e.value.code == 0

files_in_workload = os.listdir(output_path)
single_row_tables = [
"0.1_Top_Kernels.csv",
"13.3_Instruction_Cache_-_L2_Interface.csv",
"18.1_Aggregate_Stats_(All_32_channels).csv",
]
for file_name in files_in_workload:
df = pd.read_csv(output_path + "/" + file_name)
if file_name in single_row_tables:
assert len(df.index) == 1
else:
assert len(df.index) >= 3

shutil.rmtree(output_path)

with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/vcopy/MI100",
"--save-dfs",
output_path,
],
):
omniperf.main()
assert e.value.code == 0

files_in_workload = os.listdir(output_path)
for file_name in files_in_workload:
df = pd.read_csv(output_path + "/" + file_name)
if file_name in single_row_tables:
assert len(df.index) == 1
else:
assert len(df.index) >= 3


@pytest.mark.col
def test_col_1():
Expand Down Expand Up @@ -1628,37 +1670,3 @@ def test_dependency_MI100():
):
omniperf.main()
assert e.value.code == 0


@pytest.mark.misc
def test_save_dfs():
output_path = "tests/workloads/vcopy/saved_analysis"
with pytest.raises(SystemExit) as e:
with patch(
"sys.argv",
[
"omniperf",
"analyze",
"--path",
"tests/workloads/vcopy/MI100",
"--save-dfs",
output_path,
],
):
omniperf.main()
assert e.value.code == 0
files_in_workload = os.listdir(output_path)
for file_name in files_in_workload:
import pandas as pd

df = pd.read_csv(output_path + "/" + file_name)
print(file_name)
single_row_tables = [
"0.1_Top_Kernels.csv",
"13.3_Instruction_Cache_-_L2_Interface.csv",
"18.1_Aggregate_Stats_(All_32_channels).csv",
]
if file_name in single_row_tables:
assert len(df.index) == 1
else:
assert len(df.index) >= 3

0 comments on commit 597acee

Please sign in to comment.