summaryrefslogtreecommitdiff
path: root/cgi-bin
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-11-30 18:33:29 +0000
committerVincent Sanders <vince@kyllikki.org>2019-11-30 18:33:29 +0000
commit9ef04bd727252aee9dc6e074303f5a2aefb893e3 (patch)
treefa36b00b535dc8e80d5f6cb3182d1f8be6b10769 /cgi-bin
parente694e5f3723e3c45103f0e536d22cc613cf3b41b (diff)
downloadnetsurf-test-9ef04bd727252aee9dc6e074303f5a2aefb893e3.tar.gz
netsurf-test-9ef04bd727252aee9dc6e074303f5a2aefb893e3.tar.bz2
change how divisions are implemented
This allows tests to be limited to appear only in a single division reducing how many test files must be parsed for all divisions.
Diffstat (limited to 'cgi-bin')
-rwxr-xr-xcgi-bin/monkey-index.cgi19
1 files changed, 12 insertions, 7 deletions
diff --git a/cgi-bin/monkey-index.cgi b/cgi-bin/monkey-index.cgi
index da8d61d..9feecd9 100755
--- a/cgi-bin/monkey-index.cgi
+++ b/cgi-bin/monkey-index.cgi
@@ -27,7 +27,7 @@ def main():
params = cgi.FieldStorage()
- division = 'index'
+ division = 'default'
group_filter = None
if 'division' in params and re.match('^[A-Za-z0-9-]+$', params['division'].value):
@@ -39,18 +39,23 @@ def main():
print('Content-Type: text/plain')
print('')
+ if not os.path.isdir(testroot + '/' + division):
+ print('# Division ' + division + ' not found')
+ return
+
+ flist = [f for f in os.listdir(testroot) if f.endswith('.yaml')]
+ flist.extend(f for f in os.listdir(testroot + '/' + division) if f.endswith('.yaml'))
+
# load all test plan yaml files
- for fname in os.listdir(testroot):
- if not fname.endswith(".yaml"):
- continue
+ for fname in flist:
with open(os.path.join(testroot, fname), "r") as file_handle:
files[fname] = yaml.load(file_handle, Loader=yaml.CSafeLoader)
- if division + '.yaml' not in files:
- print('# Unknown division ' + division)
+ if 'index.yaml' not in files:
+ print('# Division has no index')
return
- for group in files[division + '.yaml']:
+ for group in files['index.yaml']:
if group_filter is not None and group_filter != group['group']:
continue
print("---")