diff options
author | Mike Pennisi <mike@mikepennisi.com> | 2016-04-18 16:13:52 -0400 |
---|---|---|
committer | Mike Pennisi <mike@mikepennisi.com> | 2016-04-18 16:18:54 -0400 |
commit | 613d33adbb79bf58727803350f85e631ef00cb3f (patch) | |
tree | 4da2c9f78dceb20102bf2f62a41f3c8dfe19c6dc /tools | |
parent | b0b41775e57f68eaf9f8e84576d0367f3de91cd4 (diff) | |
download | qtdeclarative-testsuites-613d33adbb79bf58727803350f85e631ef00cb3f.tar.gz |
[generation] Improve file creation heuristic
In expecting "case directories" to contain a sub-directory named
"default", the test generation tool is unable to generate tests for
features where a directory named "default" is not appropriate.
Modify the heuristic that identifies "case directories" to use a more
fundamental aspect (i.e. the existence of at least one "case" file).
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/generation/generator.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/generation/generator.py b/tools/generation/generator.py index 754f00fcf..80bc45409 100755 --- a/tools/generation/generator.py +++ b/tools/generation/generator.py @@ -12,15 +12,21 @@ from lib.test import Test def print_error(*values): print('ERROR:', *values, file=sys.stderr) +# When a directory contains at least one file with a `.case` extension, it +# should be interpreted as a "case directory" +def is_case_dir(location): + for file_name in os.listdir(location): + if file_name.lower().endswith('.case'): + return True + return False + def find_cases(location): # When a file is specified, return the file name and its containing # directory if os.path.isfile(location): return location, [os.path.dirname(location)] - # When a directory is specified, if that directory contains a sub-directory - # names "default" interpret it as a "case directory" - if (os.path.isdir(os.path.join(location, 'default'))): + if is_case_dir(location): return None, [location] else: return None, map( |