[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:
@@ -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}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user