File tree 6 files changed +52
-3
lines changed
6 files changed +52
-3
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ deploy_dev.sh
12
12
drgntools-fio.dat
13
13
testdata
14
14
test.log
15
+ vmcore.xml
Original file line number Diff line number Diff line change 6
6
- tox -e runner -- python -m testing.vmcore test --core-directory /var/drgn-tools/vmcores
7
7
- mkdir -p tmp/overlays tmp/info
8
8
- tox -e runner -- python -m testing.heavyvm.runner --image-dir /var/drgn-tools/images --vm-info-dir tmp/info --overlay-dir tmp/overlays --tarball archive.tar.gz
9
+ artifacts :
10
+ reports :
11
+ junit : vmcore.xml
Original file line number Diff line number Diff line change 4
4
paramiko
5
5
rich
6
6
types-paramiko
7
+ junitparser == 3.1.0
Original file line number Diff line number Diff line change 18
18
from typing import Tuple
19
19
20
20
import oci .config
21
+ from junitparser import JUnitXml
21
22
from oci .exceptions import ConfigFileNotFound
22
23
from oci .object_storage import ObjectStorageClient
23
24
from oci .object_storage import UploadManager
@@ -247,6 +248,11 @@ def should_run_vmcore(name: str) -> bool:
247
248
return True
248
249
return False
249
250
251
+ failed = []
252
+ passed = []
253
+ xml = JUnitXml ()
254
+ xml_run = Path ("test.xml" )
255
+
250
256
for path in CORE_DIR .iterdir ():
251
257
core_name = path .name
252
258
if not should_run_vmcore (core_name ):
@@ -256,17 +262,37 @@ def should_run_vmcore(name: str) -> bool:
256
262
f"Running tests on vmcore { core_name } " ,
257
263
collapsed = True ,
258
264
):
259
- subprocess .run (
265
+ if xml_run .exists ():
266
+ xml_run .unlink ()
267
+ res = subprocess .run (
260
268
[
261
269
"tox" ,
262
270
"--" ,
263
271
"--vmcore" ,
264
272
core_name ,
265
273
"--vmcore-dir" ,
266
274
str (CORE_DIR ),
275
+ "--junitxml=test.xml" ,
276
+ "-o" ,
277
+ "junit_logging=all" ,
267
278
],
268
- check = True ,
269
279
)
280
+ run_data = JUnitXml .fromfile (str (xml_run ))
281
+ xml += run_data
282
+ if res .returncode != 0 :
283
+ failed .append (core_name )
284
+ else :
285
+ passed .append (core_name )
286
+
287
+ xml_run .unlink ()
288
+ xml .write ("vmcore.xml" )
289
+ print ("Complete test logs: vmcore.xml" )
290
+ print ("Vmcore Test Summary -- Passed:" )
291
+ print ("\n " .join (f"- { n } " for n in passed ))
292
+ if failed :
293
+ print ("Vmcore Test Summary -- FAILED:" )
294
+ print ("\n " .join (f"- { n } " for n in failed ))
295
+ sys .exit (1 )
270
296
271
297
272
298
def get_client () -> ObjectStorageClient :
Original file line number Diff line number Diff line change 1
1
# Copyright (c) 2023, Oracle and/or its affiliates.
2
2
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3
+ import sys
3
4
from fnmatch import fnmatch
4
5
from pathlib import Path
5
6
from typing import List
@@ -37,6 +38,16 @@ def prog_type() -> str:
37
38
return "live"
38
39
39
40
41
+ @pytest .fixture (scope = "session" , autouse = True )
42
+ def log_global_env_facts (prog , record_testsuite_property ):
43
+ if VMCORE :
44
+ record_testsuite_property ("target" , VMCORE_NAME )
45
+ else :
46
+ record_testsuite_property ("target" , "live" )
47
+ release = prog ["UTS_RELEASE" ].string_ ().decode ("utf-8" )
48
+ record_testsuite_property ("release" , release )
49
+
50
+
40
51
def pytest_addoption (parser ):
41
52
parser .addoption (
42
53
"--vmcore" ,
@@ -104,6 +115,13 @@ def pytest_configure(config):
104
115
for module in vmcore_dir .glob ("*.ko.debug" ):
105
116
DEBUGINFO .append (module )
106
117
118
+ config .inicfg ["junit_suite_name" ] = "Python {}.{}.{} - {}" .format (
119
+ sys .version_info .major ,
120
+ sys .version_info .minor ,
121
+ sys .version_info .micro ,
122
+ f"vmcore { vmcore } " if vmcore else "live" ,
123
+ )
124
+
107
125
108
126
def pytest_runtest_setup (item : pytest .Item ):
109
127
skip_live = False
Original file line number Diff line number Diff line change 10
10
-rrequirements-dev.txt
11
11
pytest-cov
12
12
commands =
13
- python -m pytest --cov =drgn_tools --cov =tests -rP {posargs}
13
+ python -m pytest --cov =drgn_tools --cov =tests -- junitxml =test.xml -o junit_logging =all {posargs}
14
14
passenv = DRGNTOOLS_*, GITLAB_CI, GITHUB_ACTIONS
15
15
16
16
[testenv:docs]
You can’t perform that action at this time.
0 commit comments