Skip to content

Commit 6146ca2

Browse files
authored
Adds PTI tools tests to workflow, disables workflow externally (#8)
* Adds PTI tools tests to workflow, disables workflow externally * Makes continue on error for pti tools tests * Imporves, handles exceptions in PTI tools test script * Makes tests conitue and prints exception stack * Fixes onetrace test to pass, prints traceback for exceptions in PTI tests * Fixes external repository name * Fixes multiline if following pep-8 recommendations * Changes PTI VERSION patch number to mark fixes in ze_tracer generator and so in trace output
1 parent a5034f4 commit 6146ca2

File tree

4 files changed

+121
-78
lines changed

4 files changed

+121
-78
lines changed

.github/workflows/sdk_build_and_test.yml

Lines changed: 71 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,74 @@ on:
99
jobs:
1010
sdk-build-and-test:
1111

12-
runs-on: self-hosted
13-
14-
steps:
15-
- name: Clean-up
16-
run: rm -rf *
17-
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
21-
- name: Build
22-
run: |
23-
cd sdk
24-
cmake --preset default
25-
cmake --build --preset default -j $(($(nproc)/2))
26-
27-
- name: Test
28-
run: |
29-
cd sdk
30-
ctest --output-on-failure --test-dir build
31-
32-
- name: BuildSanitized
33-
run: |
34-
cd sdk
35-
cmake --preset asan
36-
cmake --build --preset asan --parallel $(($(nproc)/2))
37-
38-
- name: BuildFuzz
39-
run: |
40-
# To ensure it still builds, run build for fuzz targets until we have
41-
# proper fuzz testing infrastructure in place.
42-
cd sdk
43-
cmake --preset fuzz
44-
cmake --build --preset fuzz --parallel $(($(nproc)/2))
45-
46-
- name: TestSanitized
47-
run: |
48-
cd sdk
49-
ctest --preset asan --output-on-failure -L samples
12+
if: github.repository != 'intel/pti-gpu' # no run externally due to no required HW
13+
runs-on: self-hosted
14+
15+
steps:
16+
- name: Clean-up
17+
run: rm -rf *
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Build
23+
run: |
24+
cd sdk
25+
cmake --preset default
26+
cmake --build --preset default -j $(($(nproc)/2))
27+
28+
- name: Test
29+
run: |
30+
cd sdk
31+
ctest --output-on-failure --test-dir build
32+
33+
- name: BuildSanitized
34+
run: |
35+
cd sdk
36+
cmake --preset asan
37+
cmake --build --preset asan --parallel $(($(nproc)/2))
38+
39+
- name: BuildFuzz
40+
run: |
41+
# To ensure it still builds, run build for fuzz targets until we have
42+
# proper fuzz testing infrastructure in place.
43+
cd sdk
44+
cmake --preset fuzz
45+
cmake --build --preset fuzz --parallel $(($(nproc)/2))
46+
47+
- name: TestSanitized
48+
run: |
49+
cd sdk
50+
ctest --preset asan --output-on-failure -L samples
51+
52+
53+
pti-tools-build-and-test:
54+
55+
if: github.repository != 'intel/pti-gpu' # no run externally due to no required HW
56+
runs-on: self-hosted
57+
58+
steps:
59+
- name: Clean-up
60+
run: rm -rf *
61+
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Build-and-test-onetrace
66+
run: |
67+
python ./tests/run.py -s onetrace
68+
69+
- name: Build-and-test-oneprof
70+
if: always()
71+
run: |
72+
python ./tests/run.py -s oneprof
73+
74+
- name: Build-and-test-sysmon
75+
if: always()
76+
run: |
77+
python ./tests/run.py -s sysmon
78+
79+
- name: Build-and-test-cl_gpu_metrics
80+
if: always()
81+
run: |
82+
python ./tests/run.py -s cl_gpu_metrics

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.49.12
1+
0.49.13

tests/run.py

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
import shutil
55
import sys
6+
import traceback
67

78
import utils
89

@@ -129,43 +130,51 @@ def test(f, name, option, istool = False):
129130
return True
130131

131132
def main():
132-
tmpl = ".+"
133-
for i in range(1, len(sys.argv) - 1):
134-
if sys.argv[i] == "-s":
135-
tmpl = sys.argv[i + 1]
136-
137-
for i in range(1, len(sys.argv)):
138-
if sys.argv[i] == "-c":
139-
clean()
140-
return
141-
142-
f = open("stderr.log", "wt")
143-
144-
tests_passed = 0
145-
tests_failed = 0
146-
for sample in samples:
147-
name = sample[0]
148-
if re.search(tmpl, name) == None:
149-
continue
150-
for i in range(1, len(sample)):
151-
if test(f, name, sample[i]):
152-
tests_passed += 1
153-
else:
154-
tests_failed += 1
155-
156-
for tool in tools:
157-
name = tool[0]
158-
if re.search(tmpl, name) == None:
159-
continue
160-
for i in range(1, len(tool)):
161-
if test(f, name, tool[i], True):
162-
tests_passed += 1
163-
else:
164-
tests_failed += 1
165-
166-
f.close()
167-
168-
print("PASSED: " + str(tests_passed) + " / FAILED: " + str(tests_failed))
133+
try:
134+
tmpl = ".+"
135+
for i in range(1, len(sys.argv) - 1):
136+
if sys.argv[i] == "-s":
137+
tmpl = sys.argv[i + 1]
138+
139+
for i in range(1, len(sys.argv)):
140+
if sys.argv[i] == "-c":
141+
clean()
142+
return 0
143+
144+
f = open("stderr.log", "wt")
145+
146+
tests_passed = 0
147+
tests_failed = 0
148+
149+
for sample in samples:
150+
name = sample[0]
151+
if re.search(tmpl, name) == None:
152+
continue
153+
for i in range(1, len(sample)):
154+
if test(f, name, sample[i]):
155+
tests_passed += 1
156+
else:
157+
tests_failed += 1
158+
159+
for tool in tools:
160+
name = tool[0]
161+
if re.search(tmpl, name) == None:
162+
continue
163+
for i in range(1, len(tool)):
164+
if test(f, name, tool[i], True):
165+
tests_passed += 1
166+
else:
167+
tests_failed += 1
168+
169+
f.close()
170+
171+
print("PASSED: " + str(tests_passed) + " / FAILED: " + str(tests_failed))
172+
173+
return 0 if tests_failed == 0 else 1
174+
175+
except:
176+
print(traceback.format_exc())
177+
return 1
169178

170179
if __name__ == "__main__":
171-
main()
180+
sys.exit( main() )

tools/ze_tracer/gen_tracing_callbacks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ def gen_enter_callback(f, func, params, enum_map):
340340
if type == "ze_ipc_mem_handle_t" or type == "ze_ipc_event_pool_handle_t":
341341
f.write(" stream << \" " + name + " = \" << (params->p" + name + ")->data;\n")
342342
else:
343-
if type.find("char*") >= 0 and type.find("char*") == len(type) - len("char*"):
343+
if ( (type.find("char*") >= 0 and type.find("char*") == len(type) - len("char*"))
344+
or (type.find("ze_bool_t*") >= 0) ):
344345
if func == "zeModuleGetFunctionPointer" or func == "zeModuleGetGlobalPointer":
345346
f.write(" if (*(params->p" + name + ") == nullptr) {\n")
346347
f.write(" stream << \" " + name + " = \" << \"0\";\n")

0 commit comments

Comments
 (0)