[igt-dev] [PATCH i-g-t v3 2/6] scripts/test_list.py: add support to exclude files

Kamil Konieczny kamil.konieczny at linux.intel.com
Tue May 16 15:57:35 UTC 2023


On 2023-05-09 at 11:07:34 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
> 
> Specially when using wildcards, it is interesting to have a
> way to exclude some files. This is needed to support some kms
> helper functions that, instead of being part of the IGT library,
> are stored inside the tests sub-directories.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  scripts/test_list.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index e68a4cb3df71..7153b06df015 100755
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -208,6 +208,7 @@ class TestList:
>  
>      {
>          "files": [ "tests/driver/*.c" ],
> +        "exclude_files": [ "tests/driver/*-helper.c" ],
>          "fields": {
>              "Category": {
>                  "Sub-category": {
> @@ -302,10 +303,19 @@ class TestList:
>              has_implemented = False
>              if not self.filenames:
>                  self.filenames = []
> +                exclude_files = []
>                  files = self.config["files"]
> +                exclude_file_glob = self.config.get("exclude_files", [])
> +                for cfg_file in exclude_file_glob:
> +                    cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> +                    for fname in glob.glob(cfg_file):
> +                        exclude_files.append(fname)
> +
>                  for cfg_file in files:
>                      cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
>                      for fname in glob.glob(cfg_file):
> +                        if fname in exclude_files:
> +                            continue
>                          self.filenames.append(fname)
>                          has_implemented = True
>              else:
> -- 
> 2.40.1
> 


More information about the igt-dev mailing list