DPDK CI discussions
 help / color / mirror / Atom feed
* [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier
@ 2021-09-24 16:05 ohilyard
  2021-09-24 16:05 ` [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes ohilyard
  2021-10-11 17:53 ` [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier Ali Alnubani
  0 siblings, 2 replies; 4+ messages in thread
From: ohilyard @ 2021-09-24 16:05 UTC (permalink / raw)
  To: ci; +Cc: aconole, Owen Hilyard

From: Owen Hilyard <ohilyard@iol.unh.edu>

BREAKING CHANGE: --tags syntax changed

Due to limitations of the argparse library, the tags syntax needed
to be redone when the ability to specify individual tests was added.
As such, the syntax has gone from "--tags core documentation" to "--tag
core --tag documentation". This is because argparse does not allow
multiple greedy variadic arguments in all versions.

added syntax to force adding a specific test

syntax: "--test nic_single_core_perf --test hello_world"

This flag was added to help facilitate periodic testing. The list of
tests in the template file will be ignored by this argument. This allows
a more automated way to run tests which should not be run under normal
circumstances, such as rte_flow, which is lightly supported in many
NICs.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 tools/create_new_execution_file_from_tags.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/create_new_execution_file_from_tags.py b/tools/create_new_execution_file_from_tags.py
index d1d4447..61d801d 100755
--- a/tools/create_new_execution_file_from_tags.py
+++ b/tools/create_new_execution_file_from_tags.py
@@ -73,7 +73,10 @@ def __str__(self):
     parser.add_argument('output_path', help='The path to the output execution file')
     parser.add_argument('testing_type', type=TestingType, choices=list(TestingType),
                         help='What type of testing to create an execution file for')
-    parser.add_argument('tags', metavar='tag', type=str, nargs='*', help='The tags to create an execution file for.')
+    parser.add_argument('--tag', type=str, action='append',
+                        help='The tags to create an execution file for.')
+    parser.add_argument('--test', type=str, action='append',
+                        help='The tests to run along with the tests required by the provided tags')
 
     args = parser.parse_args()
 
@@ -86,7 +89,9 @@ def __str__(self):
     test_map = {key: parse_comma_delimited_list_from_string(value.strip()) for key, value in
                 tag_to_test_map_parser[str(args.testing_type)].items()}
 
-    tests = map_tags_to_tests(args.tags, test_map)
+    tests = set()
+    if args.tag is not None:
+        tests = map_tags_to_tests(args.tag, test_map)
 
     try:
         output_file = open(args.output_path, 'x')
@@ -98,7 +103,15 @@ def __str__(self):
         if execution_plan != 'DEFAULT':
             test_allowlist = parse_comma_delimited_list_from_string(
                 template_execution_file_parser[execution_plan]['test_suites'])
-            tests_to_run = list(set(test_allowlist).intersection(tests))
+            if len(tests) != 0:
+                tests_to_run = list(set(test_allowlist).intersection(tests))
+            else:  # no tags given
+                tests_to_run = [entry for entry in test_allowlist if entry != '']
+
+            if args.test is not None:
+                for test in args.test:
+                    tests_to_run.append(test)
+
             tests_to_run.sort()
             template_execution_file_parser[execution_plan]['test_suites'] = ", ".join(tests_to_run)
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes
  2021-09-24 16:05 [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier ohilyard
@ 2021-09-24 16:05 ` ohilyard
  2021-10-11 17:38   ` Ali Alnubani
  2021-10-11 17:53 ` [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier Ali Alnubani
  1 sibling, 1 reply; 4+ messages in thread
From: ohilyard @ 2021-09-24 16:05 UTC (permalink / raw)
  To: ci; +Cc: aconole, Owen Hilyard

From: Owen Hilyard <ohilyard@iol.unh.edu>

The import statements in the file have been moved below the module doc
comment per PEP 257.

A sanity check has been added to find_filenames. Occasionally, due to
how the community lab internally handles getting patches from
patchworks, a patch will result in no diff. This patch adds handling for
this case.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
 tools/guess_git_tree.py | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/tools/guess_git_tree.py b/tools/guess_git_tree.py
index c9eef39..63892e1 100755
--- a/tools/guess_git_tree.py
+++ b/tools/guess_git_tree.py
@@ -1,20 +1,8 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # SPDX-License-Identifier: (BSD-3-Clause AND GPL-2.0-or-later AND MIT)
 # Copyright 2019 Mellanox Technologies, Ltd
 
-import os
-import sys
-import re
-import argparse
-import fnmatch
-
-from requests.exceptions import HTTPError
-
-from git_pw import config
-from git_pw import api
-from git_pw import utils
-
 """
 Description:
 This script uses the git-pw API to retrieve Patchwork's
@@ -49,6 +37,17 @@
     tree = maintainers.get_tree(files)
 """
 
+import os
+import sys
+import re
+import argparse
+import fnmatch
+
+from requests.exceptions import HTTPError
+
+from git_pw import config
+from git_pw import api
+from git_pw import utils
 
 MAINTAINERS_FILE_PATH = os.environ.get('MAINTAINERS_FILE_PATH')
 if not MAINTAINERS_FILE_PATH:
@@ -93,6 +92,11 @@ def find_filenames(diff):
             - Moved _filename_re into the method.
             - Reduced newlines.
         """
+        # sanity check diff
+        # for patches without any diff, it will try to run diff.replace
+        # while diff is None. just return an empty list
+        if diff is None:
+            return []
         _filename_re = re.compile(r'^(---|\+\+\+) (\S+)')
         # normalise spaces
         diff = diff.replace('\r', '')
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes
  2021-09-24 16:05 ` [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes ohilyard
@ 2021-10-11 17:38   ` Ali Alnubani
  0 siblings, 0 replies; 4+ messages in thread
From: Ali Alnubani @ 2021-10-11 17:38 UTC (permalink / raw)
  To: ohilyard, ci; +Cc: aconole

> -----Original Message-----
> From: ci <ci-bounces@dpdk.org> On Behalf Of ohilyard@iol.unh.edu
> Sent: Friday, September 24, 2021 7:05 PM
> To: ci@dpdk.org
> Cc: aconole@redhat.com; Owen Hilyard <ohilyard@iol.unh.edu>
> Subject: [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes
> 
> From: Owen Hilyard <ohilyard@iol.unh.edu>
> 
> The import statements in the file have been moved below the module doc
> comment per PEP 257.
> 
> A sanity check has been added to find_filenames. Occasionally, due to
> how the community lab internally handles getting patches from
> patchworks, a patch will result in no diff. This patch adds handling for
> this case.
> 
> Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
> ---

The subject (commit summary) should be an imperative sentence (see https://doc.dpdk.org/guides/contributing/patches.html#commit-messages-subject-line).
I also think it would be better to split this into 2 patches (one for the style fix, and one for the empty list).

Thanks,
Ali

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier
  2021-09-24 16:05 [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier ohilyard
  2021-09-24 16:05 ` [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes ohilyard
@ 2021-10-11 17:53 ` Ali Alnubani
  1 sibling, 0 replies; 4+ messages in thread
From: Ali Alnubani @ 2021-10-11 17:53 UTC (permalink / raw)
  To: ohilyard, ci; +Cc: aconole

> -----Original Message-----
> From: ci <ci-bounces@dpdk.org> On Behalf Of ohilyard@iol.unh.edu
> Sent: Friday, September 24, 2021 7:05 PM
> To: ci@dpdk.org
> Cc: aconole@redhat.com; Owen Hilyard <ohilyard@iol.unh.edu>
> Subject: [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add
> test specifier
> 
> From: Owen Hilyard <ohilyard@iol.unh.edu>
> 
> BREAKING CHANGE: --tags syntax changed
> 
> Due to limitations of the argparse library, the tags syntax needed
> to be redone when the ability to specify individual tests was added.
> As such, the syntax has gone from "--tags core documentation" to "--tag
> core --tag documentation". This is because argparse does not allow
> multiple greedy variadic arguments in all versions.
> 
> added syntax to force adding a specific test
> 
> syntax: "--test nic_single_core_perf --test hello_world"
> 
> This flag was added to help facilitate periodic testing. The list of
> tests in the template file will be ignored by this argument. This allows
> a more automated way to run tests which should not be run under normal
> circumstances, such as rte_flow, which is lightly supported in many
> NICs.
> 
> Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
> ---

I suggest splitting this patch into 2 (one for modifying the tag usage, and one for adding the --test arg).

Regards,
Ali

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-11 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 16:05 [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier ohilyard
2021-09-24 16:05 ` [dpdk-ci] [PATCH 2/2] guess_git_tree: edge case and style changes ohilyard
2021-10-11 17:38   ` Ali Alnubani
2021-10-11 17:53 ` [dpdk-ci] [PATCH 1/2] create_new_execution_file_from_tags: add test specifier Ali Alnubani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).