Skip to content

Commit 1610adf

Browse files
Modified gen_coverage to also collect data from Pybind11 modules
This will provide coverage for the host portion of offloading Pybind11 extensions.
1 parent 46583b8 commit 1610adf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/gen_coverage.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
# limitations under the License.
1616

1717
import os
18+
import re
1819
import subprocess
1920
import sys
21+
import sysconfig
2022

2123

2224
def run(
@@ -105,6 +107,13 @@ def find_objects():
105107
import os
106108

107109
objects = []
110+
sfx_regexp = sysconfig.get_config_var("EXT_SUFFIX").replace(".", r"\.")
111+
regexp1 = re.compile(r"^_tensor_.*impl" + sfx_regexp)
112+
regexp2 = re.compile(r"^_device_queries" + sfx_regexp)
113+
114+
def is_py_ext(fn):
115+
return re.match(regexp1, fn) or re.match(regexp2, fn)
116+
108117
for root, _, files in os.walk("_skbuild"):
109118
for file in files:
110119
if not file.endswith(".so"):
@@ -116,7 +125,7 @@ def find_objects():
116125
for match in [
117126
"libsyclinterface",
118127
]
119-
):
128+
) or is_py_ext(file):
120129
objects.extend(["-object", os.path.join(root, file)])
121130
return objects
122131

0 commit comments

Comments
 (0)