[rocprofiler-compute] Enable running tests from installation only for TheRock setup (#2067)
* Enable running tests from installation only
* Use cmake option -DTEST_FROM_INSTALL=ON to enable running tests from installation folder only
* It is not possible to run tests from build folder in this case
* This option prevents changing working directory to source folder
* Fix SourceFileLoader to import rocprof-compute main module correctly
* Install sample executables in the test folder
* fix num_xcds_cli_output test
* Fix tests
* Skip autogen. config. test and add a TODO task for re-design of this
test
* Add flexible import of source code in test_gpu_specs.py
* Update cmake to install tests/workloads folder when INSTALL_TESTS=ON
* Fix sys.argv[0] for tests
* fix live attach detach test
This commit is contained in:
@@ -37,9 +37,14 @@ SRC = os.path.join(ROOT, "src")
|
||||
if SRC not in sys.path:
|
||||
sys.path.insert(0, SRC)
|
||||
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
try:
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
except Exception:
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "rocprof-compute"
|
||||
).load_module()
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
@@ -116,7 +121,7 @@ def binary_handler_profile_rocprof_compute(request):
|
||||
return process.returncode
|
||||
else:
|
||||
baseline_opts = [
|
||||
"install/bin/rocprof-compute",
|
||||
"rocprof-compute",
|
||||
"profile",
|
||||
"-n",
|
||||
app_name,
|
||||
|
||||
@@ -26,16 +26,11 @@
|
||||
import csv
|
||||
import re
|
||||
import subprocess
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import test_utils
|
||||
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
|
||||
config = {}
|
||||
config["vseq"] = ["./tests/vsequential_access"]
|
||||
config["vrand"] = ["./tests/vrandom_access"]
|
||||
|
||||
@@ -26,9 +26,16 @@
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
reason=(
|
||||
"TODO: Skip this test until we use "
|
||||
"tools/config_management/.config.hashes.json for testing"
|
||||
)
|
||||
)
|
||||
def test_modification_time():
|
||||
# Ensure hash map consistency
|
||||
hash_path = Path("tools/autogen_hash.yaml")
|
||||
|
||||
@@ -26,16 +26,14 @@
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
from importlib.machinery import SourceFileLoader
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from src.utils.specs import generate_machine_specs
|
||||
|
||||
rocprof_compute = SourceFileLoader(
|
||||
"rocprof-compute", "src/rocprof-compute"
|
||||
).load_module()
|
||||
try:
|
||||
from src.utils.specs import generate_machine_specs
|
||||
except Exception:
|
||||
from utils.specs import generate_machine_specs
|
||||
|
||||
# NOTE: Only testing gfx942 for now.
|
||||
GFX942_CHIP_IDS_TO_NUM_XCDS = {
|
||||
@@ -162,12 +160,20 @@ def test_num_xcds_cli_output():
|
||||
num_xcds = get_num_xcds()
|
||||
|
||||
# 2. Run rocprof-compute -s and grab rocprof-compute num_xcd
|
||||
proc = subprocess.run(
|
||||
["src/rocprof-compute", "-s"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
["src/rocprof-compute", "-s"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
except Exception:
|
||||
proc = subprocess.run(
|
||||
["rocprof-compute", "-s"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
assert proc.returncode == 0, (
|
||||
f"Non-zero exit ({proc.returncode}), stderr:\n{proc.stderr}"
|
||||
)
|
||||
|
||||
@@ -72,7 +72,7 @@ config["METRIC_LOGGING"] = False
|
||||
num_kernels = 3
|
||||
num_devices = 1
|
||||
|
||||
attach_detach_interval_msec_no_delay = 10000
|
||||
attach_detach_interval_msec_no_delay = 1000
|
||||
attach_detach_interval_msec_with_delay = 60000
|
||||
DEFAULT_ABS_DIFF = 15
|
||||
DEFAULT_REL_DIFF = 50
|
||||
|
||||
Reference in New Issue
Block a user