From 5905fc7494cb94e47ea5ffd748bc51c927704fb3 Mon Sep 17 00:00:00 2001 From: mahendrapaipuri Date: Wed, 18 Aug 2021 14:26:49 +0200 Subject: [PATCH 1/3] Add image name and propagate verbosity level from parent in generated CI script --- reframe/frontend/ci.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reframe/frontend/ci.py b/reframe/frontend/ci.py index c39d92e1a0..a82933c75c 100644 --- a/reframe/frontend/ci.py +++ b/reframe/frontend/ci.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: BSD-3-Clause +import os import sys import yaml @@ -18,6 +19,7 @@ def _emit_gitlab_pipeline(testcases): prefix = 'rfm-stage/${CI_COMMIT_SHORT_SHA}' checkpath = config.get('general/0/check_search_path') recurse = config.get('general/0/check_search_recursive') + verbosity = 'v' * int(config.get('general/0/verbose')) def rfm_command(testcase): if config.filename != '': @@ -40,7 +42,8 @@ def rfm_command(testcase): f'-R' if recurse else '', f'--report-file={report_file}', f'--restore-session={restore_files}' if restore_files else '', - '-n', testcase.check.name, '-r' + '-n', testcase.check.name, '-r', + f'{"".join("-" + verbosity)}' if verbosity else '' ]) max_level = 0 # We need the maximum level to generate the stages section @@ -51,6 +54,16 @@ def rfm_command(testcase): }, 'stages': [] } + + # Name of the image used for CI. If user does not explicitly provide + # image keyword on the top of CI script, this variable does not exist + image_name = os.getenv('CI_JOB_IMAGE') + if image_name: + json = { + 'image': image_name, + **json, + } + for tc in testcases: json[f'{tc.check.name}'] = { 'stage': f'rfm-stage-{tc.level}', From 2e69e0ea8a924a8123f4801fde78f4c5ac9a64ba Mon Sep 17 00:00:00 2001 From: mahendrapaipuri Date: Fri, 10 Sep 2021 10:47:04 +0200 Subject: [PATCH 2/3] Add image keyword after stages and remove redundant type conversion to int for verbosity --- reframe/frontend/ci.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/reframe/frontend/ci.py b/reframe/frontend/ci.py index a82933c75c..fe0fb8e2d1 100644 --- a/reframe/frontend/ci.py +++ b/reframe/frontend/ci.py @@ -19,7 +19,7 @@ def _emit_gitlab_pipeline(testcases): prefix = 'rfm-stage/${CI_COMMIT_SHORT_SHA}' checkpath = config.get('general/0/check_search_path') recurse = config.get('general/0/check_search_recursive') - verbosity = 'v' * int(config.get('general/0/verbose')) + verbosity = 'v' * config.get('general/0/verbose') def rfm_command(testcase): if config.filename != '': @@ -59,10 +59,7 @@ def rfm_command(testcase): # image keyword on the top of CI script, this variable does not exist image_name = os.getenv('CI_JOB_IMAGE') if image_name: - json = { - 'image': image_name, - **json, - } + json['image'] = image_name for tc in testcases: json[f'{tc.check.name}'] = { From 2e17d1216d7c4179edc8cdec92ea8061e0517998 Mon Sep 17 00:00:00 2001 From: mahendrapaipuri Date: Fri, 10 Sep 2021 10:56:27 +0200 Subject: [PATCH 3/3] Resolve conflicts with master --- reframe/frontend/ci.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reframe/frontend/ci.py b/reframe/frontend/ci.py index fe0fb8e2d1..90d89b30e0 100644 --- a/reframe/frontend/ci.py +++ b/reframe/frontend/ci.py @@ -42,8 +42,8 @@ def rfm_command(testcase): f'-R' if recurse else '', f'--report-file={report_file}', f'--restore-session={restore_files}' if restore_files else '', - '-n', testcase.check.name, '-r', - f'{"".join("-" + verbosity)}' if verbosity else '' + f'{"".join("-" + verbosity)}' if verbosity else '', + '-n', f"'^{testcase.check.name}$'", '-r' ]) max_level = 0 # We need the maximum level to generate the stages section