Initial commit for pytest
Signed-off-by: JoseSantosAMD <Jose.Santos@amd.com>
This commit is contained in:
committed by
Karl W. Schulz
szülő
6fd2e44e5f
commit
edaa6ad818
@@ -0,0 +1,70 @@
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
from importlib.machinery import SourceFileLoader
|
||||
|
||||
omniperf = SourceFileLoader("omniperf", "src/omniperf").load_module()
|
||||
workload_1 = os.path.realpath("workload")
|
||||
app = ["./sample/vcopy", "1048576", "256"]
|
||||
|
||||
|
||||
def test_path():
|
||||
with pytest.raises(SystemExit) as e:
|
||||
with patch(
|
||||
"sys.argv",
|
||||
[
|
||||
"omniperf",
|
||||
"profile",
|
||||
"-n",
|
||||
"app",
|
||||
"--path",
|
||||
workload_1,
|
||||
"--",
|
||||
] + app
|
||||
):
|
||||
omniperf.main()
|
||||
|
||||
#assert successful run
|
||||
assert e.value.code == 0
|
||||
|
||||
def test_kernel():
|
||||
with pytest.raises(SystemExit) as e:
|
||||
with patch(
|
||||
"sys.argv",
|
||||
[
|
||||
"omniperf",
|
||||
"profile",
|
||||
"-n",
|
||||
"app",
|
||||
"--path",
|
||||
workload_1,
|
||||
"--kernel",
|
||||
"kernel_name"
|
||||
"--",
|
||||
] + app
|
||||
):
|
||||
omniperf.main()
|
||||
|
||||
#assert successful run
|
||||
assert e.value.code == 0
|
||||
|
||||
def test_kernel_summaries():
|
||||
with pytest.raises(SystemExit) as e:
|
||||
with patch(
|
||||
"sys.argv",
|
||||
[
|
||||
"omniperf",
|
||||
"profile",
|
||||
"-n",
|
||||
"app",
|
||||
"--path",
|
||||
workload_1,
|
||||
"--kernel-summaries",
|
||||
"--",
|
||||
] + app
|
||||
):
|
||||
omniperf.main()
|
||||
|
||||
#assert successful run
|
||||
assert e.value.code == 0
|
||||
Reference in New Issue
Block a user