primitive 0.1.23__py3-none-any.whl → 0.1.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- primitive/__about__.py +1 -1
- primitive/agent/actions.py +1 -3
- primitive/sim/actions.py +56 -10
- {primitive-0.1.23.dist-info → primitive-0.1.25.dist-info}/METADATA +1 -1
- {primitive-0.1.23.dist-info → primitive-0.1.25.dist-info}/RECORD +8 -8
- {primitive-0.1.23.dist-info → primitive-0.1.25.dist-info}/WHEEL +0 -0
- {primitive-0.1.23.dist-info → primitive-0.1.25.dist-info}/entry_points.txt +0 -0
- {primitive-0.1.23.dist-info → primitive-0.1.25.dist-info}/licenses/LICENSE.txt +0 -0
primitive/__about__.py
CHANGED
primitive/agent/actions.py
CHANGED
@@ -188,9 +188,7 @@ class Agent(BaseAction):
|
|
188
188
|
|
189
189
|
# Attempt artifact collection
|
190
190
|
self.primitive.sim.collect_artifacts(
|
191
|
-
source=source_dir,
|
192
|
-
job_run_id=job_run["id"],
|
193
|
-
organization_id=job_run["organization"]["id"],
|
191
|
+
source=source_dir, job_run_id=job_run["id"]
|
194
192
|
)
|
195
193
|
|
196
194
|
if result:
|
primitive/sim/actions.py
CHANGED
@@ -9,6 +9,7 @@ from .vcd import TokenKind, tokenize
|
|
9
9
|
import io
|
10
10
|
from collections import defaultdict
|
11
11
|
import json
|
12
|
+
import xml.etree.ElementTree as ET
|
12
13
|
|
13
14
|
|
14
15
|
class Sim(BaseAction):
|
@@ -48,15 +49,16 @@ class Sim(BaseAction):
|
|
48
49
|
file_upload_response = self.primitive.files.file_upload(path, key_prefix=prefix)
|
49
50
|
return file_upload_response.json()["data"]["fileUpload"]["id"]
|
50
51
|
|
51
|
-
def collect_artifacts(
|
52
|
-
|
53
|
-
) -> None:
|
54
|
-
# Split VCD artifacts
|
52
|
+
def collect_artifacts(self, source: Path, job_run_id: str) -> None:
|
53
|
+
# Parse VCD artifacts
|
55
54
|
files = find_files_for_extension(source, ".vcd")
|
56
55
|
for file in files:
|
57
|
-
self.
|
58
|
-
|
59
|
-
|
56
|
+
self.parse_vcd(path=file)
|
57
|
+
|
58
|
+
# Parse XML artifacts
|
59
|
+
files = find_files_for_extension(source, ".xml")
|
60
|
+
for file in files:
|
61
|
+
self.parse_xml(path=file)
|
60
62
|
|
61
63
|
logger.debug("Uploading additional artifacts...")
|
62
64
|
# TODO: Figure out how to track ".log", ".history" files w/ analog stuff involved
|
@@ -80,7 +82,51 @@ class Sim(BaseAction):
|
|
80
82
|
)
|
81
83
|
logger.success(job_run_update_response)
|
82
84
|
|
83
|
-
def
|
85
|
+
def parse_xml(self, path: Path) -> None:
|
86
|
+
results = ET.parse(path)
|
87
|
+
testsuites = results.getroot()
|
88
|
+
|
89
|
+
parsed_results = {}
|
90
|
+
testsuites_name = testsuites.attrib["name"]
|
91
|
+
parsed_results[testsuites_name] = {}
|
92
|
+
|
93
|
+
for testsuite in testsuites.findall("testsuite"):
|
94
|
+
testsuite_name = testsuite.attrib["name"]
|
95
|
+
parsed_results[testsuites_name][testsuite_name] = {
|
96
|
+
"properties": {},
|
97
|
+
"testcases": {},
|
98
|
+
}
|
99
|
+
props = parsed_results[testsuites_name][testsuite_name]["properties"]
|
100
|
+
testcases = parsed_results[testsuites_name][testsuite_name]["testcases"]
|
101
|
+
|
102
|
+
for prop in testsuite.findall("property"):
|
103
|
+
props[prop.attrib["name"]] = prop.attrib["value"]
|
104
|
+
|
105
|
+
for testcase in testsuite.findall("testcase"):
|
106
|
+
testcases[testcase.attrib["name"]] = {
|
107
|
+
attr_key: attr_val for attr_key, attr_val in testcase.attrib.items()
|
108
|
+
}
|
109
|
+
|
110
|
+
failures = testcase.findall("failure")
|
111
|
+
|
112
|
+
if len(failures) > 0:
|
113
|
+
for failure in failures:
|
114
|
+
testcases[testcase.attrib["name"]]["status"] = {
|
115
|
+
"conclusion": "failure",
|
116
|
+
"message": failure.attrib["message"],
|
117
|
+
}
|
118
|
+
else:
|
119
|
+
testcases[testcase.attrib["name"]]["status"] = {
|
120
|
+
"conclusion": "success",
|
121
|
+
"message": "",
|
122
|
+
}
|
123
|
+
|
124
|
+
# Write parsed file
|
125
|
+
data_path = path.parent / f"{path.name}.json"
|
126
|
+
with open(data_path, "w") as f:
|
127
|
+
f.write(json.dumps(parsed_results))
|
128
|
+
|
129
|
+
def parse_vcd(self, path: Path) -> None:
|
84
130
|
logger.debug("Parsing VCD file...")
|
85
131
|
with open(path, "rb") as f:
|
86
132
|
tokens = tokenize(io.BytesIO(f.read()))
|
@@ -142,9 +188,9 @@ class Sim(BaseAction):
|
|
142
188
|
# Write header file
|
143
189
|
header_path = path.parent / f"{file_name}.header.vcd.json"
|
144
190
|
with open(header_path, "w") as f:
|
145
|
-
f.write(json.dumps(
|
191
|
+
f.write(json.dumps(header))
|
146
192
|
|
147
193
|
# Write data file
|
148
194
|
data_path = path.parent / f"{file_name}.data.vcd.json"
|
149
195
|
with open(data_path, "w") as f:
|
150
|
-
f.write(json.dumps(
|
196
|
+
f.write(json.dumps(data))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: primitive
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.25
|
4
4
|
Project-URL: Documentation, https://github.com//primitivecorp/primitive-cli#readme
|
5
5
|
Project-URL: Issues, https://github.com//primitivecorp/primitive-cli/issues
|
6
6
|
Project-URL: Source, https://github.com//primitivecorp/primitive-cli
|
@@ -1,8 +1,8 @@
|
|
1
|
-
primitive/__about__.py,sha256=
|
1
|
+
primitive/__about__.py,sha256=i0NlPJ8V0aw-MeG6oFFKWul3Sxet8naZe6kx_IfGXqM,129
|
2
2
|
primitive/__init__.py,sha256=bwKdgggKNVssJFVPfKSxqFMz4IxSr54WWbmiZqTMPNI,106
|
3
3
|
primitive/cli.py,sha256=VQPSewC6ouGdEG9W1gllawGJTydpOY0Lzg7LURXcqQg,2374
|
4
4
|
primitive/client.py,sha256=SFPG4H2wJao8euGdnYp-l7dk_fDpWeVn2aT2WNJUAqo,2370
|
5
|
-
primitive/agent/actions.py,sha256=
|
5
|
+
primitive/agent/actions.py,sha256=fAuQmd5Z8FX3w1AiwLd4a_PPuBynzmdiWRmWA9ftn-8,8632
|
6
6
|
primitive/agent/commands.py,sha256=-dVDilELfkGfbZB7qfEPs77Dm1oT62qJj4tsIk4KoxI,254
|
7
7
|
primitive/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
primitive/auth/actions.py,sha256=N2bGcwXNsB89pzs66gF9A5_WzUScY5fhfOyWixqo2y8,1054
|
@@ -30,7 +30,7 @@ primitive/projects/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
30
30
|
primitive/projects/actions.py,sha256=xhebDUMN9DXWvngWJyJkiijghbZwffy-JIPSsOg8agE,2061
|
31
31
|
primitive/projects/commands.py,sha256=Fqqgpi4cm6zOgkHK--0F0hiiIj32BmgZ-h1MydmWwdE,464
|
32
32
|
primitive/sim/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
-
primitive/sim/actions.py,sha256=
|
33
|
+
primitive/sim/actions.py,sha256=xLhXQKYwJ9MJH_FAexvUapdHO3VqEaRh6t5kQFR_x0U,7277
|
34
34
|
primitive/sim/commands.py,sha256=8PaOfL1MO6qxTn7mNVRnBU1X2wa3gk_mlbAhBW6MnI0,591
|
35
35
|
primitive/sim/vcd.py,sha256=mAbGnKWM0qzIUMkuSmO0p3sU25kOqbl31mvCsDSrXeM,22221
|
36
36
|
primitive/utils/actions.py,sha256=HOFrmM3-0A_A3NS84MqrZ6JmQEiiPSoDqEeuu6b_qfQ,196
|
@@ -42,8 +42,8 @@ primitive/utils/printer.py,sha256=f1XUpqi5dkTL3GWvYRUGlSwtj2IxU1q745T4Fxo7Tn4,37
|
|
42
42
|
primitive/utils/shell.py,sha256=-7UjQaBqSGHzEEyX8pNjeYFFP0P3lVnDV0OkgPz1qHU,1050
|
43
43
|
primitive/utils/verible.py,sha256=QYczN1IvxODfj4jeq0nqjFuF0Oi0Zdx-Q32ySOJgcw8,2205
|
44
44
|
primitive/utils/yaml.py,sha256=4UP_9MXHoNb9_SCeUDm9xqYg9sHltqpVhNgsY6GNfb8,527
|
45
|
-
primitive-0.1.
|
46
|
-
primitive-0.1.
|
47
|
-
primitive-0.1.
|
48
|
-
primitive-0.1.
|
49
|
-
primitive-0.1.
|
45
|
+
primitive-0.1.25.dist-info/METADATA,sha256=5NMhuWAXJ8_TyFlU18X_tye-uGgziJhnodXBhRCviQg,1840
|
46
|
+
primitive-0.1.25.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
47
|
+
primitive-0.1.25.dist-info/entry_points.txt,sha256=p1K8DMCWka5FqLlqP1sPek5Uovy9jq8u51gUsP-z334,48
|
48
|
+
primitive-0.1.25.dist-info/licenses/LICENSE.txt,sha256=B8kmQMJ2sxYygjCLBk770uacaMci4mPSoJJ8WoDBY_c,1098
|
49
|
+
primitive-0.1.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|