aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2017-04-28 20:56:05 +0200
committerGravatar Jan Tattermusch <jtattermusch@google.com>2017-04-29 12:19:36 +0200
commitac9c9f93b99827f4efe32362ce23e855f845ecf6 (patch)
treee01ca6cae278eb63d6a7d70c2e77dbe26d58184d /tools
parent365c52b47e8d322dfc0bdf15ddea2b598f3b4dbb (diff)
reports can create subdirs
Diffstat (limited to 'tools')
-rwxr-xr-xtools/internal_ci/linux/grpc_portability.sh2
-rwxr-xr-xtools/internal_ci/linux/grpc_portability_build_only.sh2
-rw-r--r--tools/run_tests/python_utils/report_utils.py4
-rwxr-xr-xtools/run_tests/run_tests_matrix.py25
4 files changed, 28 insertions, 5 deletions
diff --git a/tools/internal_ci/linux/grpc_portability.sh b/tools/internal_ci/linux/grpc_portability.sh
index 58d3c58e70..613d5615f2 100755
--- a/tools/internal_ci/linux/grpc_portability.sh
+++ b/tools/internal_ci/linux/grpc_portability.sh
@@ -37,4 +37,4 @@ git submodule update --init
# download docker images from dockerhub
export DOCKERHUB_ORGANIZATION=grpctesting
-tools/run_tests/run_tests_matrix.py -f portability linux
+tools/run_tests/run_tests_matrix.py -f portability linux --internal_ci
diff --git a/tools/internal_ci/linux/grpc_portability_build_only.sh b/tools/internal_ci/linux/grpc_portability_build_only.sh
index 80b5c4cb96..787f0302c0 100755
--- a/tools/internal_ci/linux/grpc_portability_build_only.sh
+++ b/tools/internal_ci/linux/grpc_portability_build_only.sh
@@ -37,4 +37,4 @@ git submodule update --init
# download docker images from dockerhub
export DOCKERHUB_ORGANIZATION=grpctesting
-tools/run_tests/run_tests_matrix.py -f portability linux --build_only
+tools/run_tests/run_tests_matrix.py -f portability linux --internal_ci --build_only
diff --git a/tools/run_tests/python_utils/report_utils.py b/tools/run_tests/python_utils/report_utils.py
index 3b2b4f8712..c7c0ceea92 100644
--- a/tools/run_tests/python_utils/report_utils.py
+++ b/tools/run_tests/python_utils/report_utils.py
@@ -77,6 +77,10 @@ def render_junit_xml_report(resultset, xml_report, suite_package='grpc',
ET.SubElement(xml_test, 'error', message='Timeout')
elif result.state == 'SKIPPED':
ET.SubElement(xml_test, 'skipped', message='Skipped')
+ # ensure the report directory exists
+ report_dir = os.path.dirname(os.path.abspath(xml_report))
+ if not os.path.exists(report_dir):
+ os.makedirs(report_dir)
tree = ET.ElementTree(root)
tree.write(xml_report, encoding='UTF-8')
diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py
index 02f0ec5eff..70340cd747 100755
--- a/tools/run_tests/run_tests_matrix.py
+++ b/tools/run_tests/run_tests_matrix.py
@@ -55,6 +55,16 @@ _DEFAULT_INNER_JOBS = 2
_REPORT_SUFFIX = 'sponge_log.xml'
+def _report_filename(name):
+ """Generates report file name"""
+ return 'report_%s_%s' % (name, _REPORT_SUFFIX)
+
+
+def _report_filename_internal_ci(name):
+ """Generates report file name that leads to better presentation by internal CI"""
+ return '%s/%s' % (name, _REPORT_SUFFIX)
+
+
def _docker_jobspec(name, runtests_args=[], runtests_envs={},
inner_jobs=_DEFAULT_INNER_JOBS):
"""Run a single instance of run_tests.py in a docker container"""
@@ -63,7 +73,7 @@ def _docker_jobspec(name, runtests_args=[], runtests_envs={},
'--use_docker',
'-t',
'-j', str(inner_jobs),
- '-x', 'report_%s_%s' % (name, _REPORT_SUFFIX),
+ '-x', _report_filename(name),
'--report_suite_name', '%s' % name] + runtests_args,
environ=runtests_envs,
shortname='run_tests_%s' % name,
@@ -83,7 +93,7 @@ def _workspace_jobspec(name, runtests_args=[], workspace_name=None,
'tools/run_tests/helper_scripts/run_tests_in_workspace.sh',
'-t',
'-j', str(inner_jobs),
- '-x', '../report_%s_%s' % (name, _REPORT_SUFFIX),
+ '-x', '../%s' % _report_filename(name),
'--report_suite_name', '%s' % name] + runtests_args,
environ=env,
shortname='run_tests_%s' % name,
@@ -380,8 +390,17 @@ if __name__ == "__main__":
argp.add_argument('--max_time', default=-1, type=int,
help='Maximum amount of time to run tests for' +
'(other tests will be skipped)')
+ argp.add_argument('--internal_ci',
+ default=False,
+ action='store_const',
+ const=True,
+ help='Put reports into subdirectories to improve presentation of '
+ 'results by Internal CI.')
args = argp.parse_args()
+ if args.internal_ci:
+ _report_filename = _report_filename_internal_ci # override the function
+
extra_args = []
if args.build_only:
extra_args.append('--build_only')
@@ -450,7 +469,7 @@ if __name__ == "__main__":
ignored_num_skipped_failures, skipped_results = jobset.run(
skipped_jobs, skip_jobs=True)
resultset.update(skipped_results)
- report_utils.render_junit_xml_report(resultset, 'report_%s' % _REPORT_SUFFIX,
+ report_utils.render_junit_xml_report(resultset, _report_filename('aggregate_tests'),
suite_name='aggregate_tests')
if num_failures == 0: