<div dir="ltr">It seems like the v2 never got properly sent. It's in my outbox but the mailing list archive doesn't have a record of it. I've sent in another patch with a couple of stability changes and minor feature tweaks that were made. That should complete the list of features in the original commit. <div><br></div><div>Sorry about that</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 15, 2021 at 4:42 PM Aaron Conole <<a href="mailto:aconole@redhat.com">aconole@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Owen Hilyard <<a href="mailto:ohilyard@iol.unh.edu" target="_blank">ohilyard@iol.unh.edu</a>> writes:<br>
<br>
> Please ignore this patch. I messed up directories and this patch was not created from the correct file. <br>
<br>
Is there an update for this that I missed?<br>
<br>
> On Thu, Jan 14, 2021 at 12:59 PM <<a href="mailto:ohilyard@iol.unh.edu" target="_blank">ohilyard@iol.unh.edu</a>> wrote:<br>
><br>
> Fixed parsing bugs with the tag parsing script<br>
> Parsing the patch file directly proved to be too unreliabler, so the approach to patch parsing was changed so that<br>
> it relies instead on using a directory with those patches already applied in them and then use a git diff command to get<br>
> the changed files. This avoids needing to parse the patch files directly and should be more reliable.<br>
><br>
> Added a tool to create an execution file from tags using another execution file as a template<br>
> This tool is intended to allow a list of patch tags to be used in combination with an execution file containing<br>
> information on crbs to only change which test suites are run. This tool enables using the mappings in the<br>
> tests_for_tag.cfg file to run only necessary tests. At present, the mappings represent how tests are currently run at the<br>
> UNH-IOL Community Lab, with the same tests being run for every patch, with the requested change from bug 511<br>
> where documentation changes do not cause any testing.<br>
><br>
> Signed-off-by: Owen Hilyard <<a href="mailto:ohilyard@iol.unh.edu" target="_blank">ohilyard@iol.unh.edu</a>><br>
> ---<br>
> config/tests_for_tag.cfg | 19 ++++++++++++--<br>
> tools/patch_parser.py | 54 ++++++++++++++++++++++++----------------<br>
> 2 files changed, 49 insertions(+), 24 deletions(-)<br>
><br>
> diff --git a/config/tests_for_tag.cfg b/config/tests_for_tag.cfg<br>
> index 77f797f..7d95c4a 100644<br>
> --- a/config/tests_for_tag.cfg<br>
> +++ b/config/tests_for_tag.cfg<br>
> @@ -5,11 +5,26 @@ core = dynamic_config,<br>
> mtu_update,<br>
> scatter,<br>
> stats_checks,<br>
> + unit_tests_mbuf<br>
> +driver = dynamic_config,<br>
> + link_status_interrupt,<br>
> + mac_filter,<br>
> + mtu_update,<br>
> + scatter,<br>
> + stats_checks,<br>
> + unit_tests_mbuf<br>
> +application = dynamic_config,<br>
> + link_status_interrupt,<br>
> + mac_filter,<br>
> + mtu_update,<br>
> + scatter,<br>
> stats_checks,<br>
> unit_tests_mbuf<br>
> -<br>
> ; Nothing in documentation<br>
> documentation =<br>
><br>
> [performance]<br>
> -core = nic_single_core_perf,<br>
> +core = nic_single_core_perf<br>
> +driver = nic_single_core_perf<br>
> +application = nic_single_core_perf<br>
> +documentation =<br>
> diff --git a/tools/patch_parser.py b/tools/patch_parser.py<br>
> index 80b8194..73df91f 100755<br>
> --- a/tools/patch_parser.py<br>
> +++ b/tools/patch_parser.py<br>
> @@ -31,30 +31,39 @@<br>
> # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT<br>
> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE<br>
> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br>
> -<br>
> +import subprocess<br>
><br>
> import itertools<br>
> from configparser import ConfigParser<br>
> from typing import List, Dict, Set<br>
> import argparse<br>
> +import re<br>
><br>
> def get_patch_files(patch_file: str) -> List[str]:<br>
> + file_match_pattern = re.compile(r"[\w\-\/.]+ +\| +\d+ [+\-]+")<br>
> with open(patch_file, 'r') as f:<br>
> - lines = list(itertools.takewhile(<br>
> - lambda line: line.strip().endswith('+') or line.strip().endswith('-'),<br>
> - itertools.dropwhile(<br>
> - lambda line: not line.strip().startswith("---"),<br>
> - f.readlines()<br>
> + file_lines = f.readlines()<br>
> + lines = list(filter(<br>
> + lambda line: file_match_pattern.match(line.strip()),<br>
> + itertools.takewhile(<br>
> + lambda line: not line.startswith('---'),<br>
> + list(<br>
> + itertools.dropwhile(<br>
> + lambda line: not line.strip().startswith("---"),<br>
> + file_lines<br>
> + )<br>
> + )[1:]<br>
> )<br>
> ))<br>
> filenames = map(lambda line: line.strip().split(' ')[0], lines)<br>
> - # takewhile includes the --- which starts the filenames<br>
> - return list(filenames)[1:]<br>
> + return list(filenames)<br>
><br>
> def get_all_files_from_patches(patch_files: List[str]) -> Set[str]:<br>
> - return set(itertools.chain.from_iterable(map(get_patch_files, patch_files)))<br>
> + num_patch_files: int = len(patch_files)<br>
> + files = subprocess.check_output(f"cd dpdk && git diff --name-only HEAD~{num_patch_files}", shell=True).decode<br>
> ('utf-8').splitlines()<br>
> + return set(files)<br>
><br>
> def parse_comma_delimited_list_from_string(mod_str: str) -> List[str]:<br>
> @@ -80,21 +89,22 @@ def get_tags_for_patches(patch_files: Set[str], dir_attrs: Dict[str, Set[str]])<br>
> ))<br>
><br>
> -parser = argparse.ArgumentParser(<br>
> - description='Takes a patch file and a config file and creates a list of tags for that patch')<br>
> -parser.add_argument('config_file_path', help='The path to patch_parser.cfg', default='config/patch_parser.cfg')<br>
> -parser.add_argument('patch_file_paths', help='A list of patch files', type=str, metavar='patch file', nargs='+')<br>
> +if __name__ == '__main__':<br>
> + parser = argparse.ArgumentParser(<br>
> + description='Takes a patch file and a config file and creates a list of tags for that patch')<br>
> + parser.add_argument('config_file_path', help='The path to patch_parser.cfg', default='config/patch_parser.cfg')<br>
> + parser.add_argument('patch_file_paths', help='A list of patch files', type=str, metavar='patch file', nargs='+')<br>
><br>
> -args = parser.parse_args()<br>
> + args = parser.parse_args()<br>
><br>
> -conf_obj = ConfigParser()<br>
> -conf_obj.read(args.config_file_path)<br>
> + conf_obj = ConfigParser()<br>
> + conf_obj.read(args.config_file_path)<br>
><br>
> -patch_files = get_all_files_from_patches(args.patch_file_paths)<br>
> -dir_attrs = get_dictionary_attributes_from_config_file(conf_obj)<br>
> -priority_list = parse_comma_delimited_list_from_string(conf_obj['Priority']['priority_list'])<br>
> + patch_files = get_all_files_from_patches(args.patch_file_paths)<br>
> + dir_attrs = get_dictionary_attributes_from_config_file(conf_obj)<br>
> + priority_list = parse_comma_delimited_list_from_string(conf_obj['Priority']['priority_list'])<br>
><br>
> -unordered_tags: Set[str] = get_tags_for_patches(patch_files, dir_attrs)<br>
> -ordered_tags: List[str] = [tag for tag in priority_list if tag in unordered_tags]<br>
> + unordered_tags: Set[str] = get_tags_for_patches(patch_files, dir_attrs)<br>
> + ordered_tags: List[str] = [tag for tag in priority_list if tag in unordered_tags]<br>
><br>
> -print("\n".join(ordered_tags))<br>
> + print("\n".join(ordered_tags))<br>
> -- <br>
> 2.27.0<br>
<br>
</blockquote></div>