blob: 9afd379b8be74fad733cb787ee9c0f286a5e6f36 [file] [log] [blame]
James E. Blair6cdf2f22016-07-25 16:07:02 -07001#!/usr/bin/env python
2
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15import argparse
16import os
17import sys
18
19import tests.base
20
21CONFIG_DIR = os.path.join(tests.base.FIXTURE_DIR, 'config')
22
23
24def print_file(title, path):
25 print('')
26 print(title)
27 print('-' * 78)
28 with open(path) as f:
29 print(f.read())
30 print('-' * 78)
31
32
33def main():
34 parser = argparse.ArgumentParser(description='Print test layout.')
35 parser.add_argument(dest='config', nargs='?',
36 help='the test configuration name')
37 args = parser.parse_args()
38 if not args.config:
39 print('Available test configurations:')
40 for d in os.listdir(CONFIG_DIR):
41 print(' ' + d)
42 sys.exit(1)
43 configdir = os.path.join(CONFIG_DIR, args.config)
44
45 title = ' Configuration: %s ' % args.config
46 print('=' * len(title))
47 print(title)
48 print('=' * len(title))
49 print_file('Main Configuration',
50 os.path.join(configdir, 'main.yaml'))
51
52 gitroot = os.path.join(configdir, 'git')
53 for gitrepo in os.listdir(gitroot):
54 reporoot = os.path.join(gitroot, gitrepo)
55 print('')
56 print('=== Git repo: %s ===' % gitrepo)
57 filenames = os.listdir(reporoot)
58 for fn in filenames:
59 if fn in ['zuul.yaml', '.zuul.yaml']:
60 print_file('File: ' + os.path.join(gitrepo, fn),
61 os.path.join(reporoot, fn))
62
63
64if __name__ == '__main__':
65 main()