summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2016-08-11 15:42:43 -0700
committerMatt Clay <matt@mystile.com>2016-08-11 15:42:43 -0700
commit901042f4587957bb2da10a21db2ef8fb3f0813b3 (patch)
tree912aac8e2a66915501b66f0c8e366aabc76f310e
parent2b0d63b0d892882c0651abc23ac2d3db45d6f012 (diff)
downloadansible-901042f4587957bb2da10a21db2ef8fb3f0813b3.tar.gz
Generate test script to file instead of stdout.
-rwxr-xr-xtest/utils/shippable/modules/generate-tests12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/utils/shippable/modules/generate-tests b/test/utils/shippable/modules/generate-tests
index 0902d863f3..c39f7a7f18 100755
--- a/test/utils/shippable/modules/generate-tests
+++ b/test/utils/shippable/modules/generate-tests
@@ -63,6 +63,8 @@ def main():
help='platform to run tests on')
parser.add_argument('--version', dest='version', default=os.environ.get('VERSION'),
help='version of platform to run tests on')
+ parser.add_argument('--output', dest='output', required=True,
+ help='path to write output script to')
args = parser.parse_args()
@@ -80,16 +82,17 @@ def main():
else:
raise Exception('job parameters not specified')
- generate_test_commands(args.module_group, targets, script, jobs=jobs, verbose=args.verbose, changes=args.changes)
+ generate_test_commands(args.module_group, targets, script, args.output, jobs=jobs, verbose=args.verbose, changes=args.changes)
-def generate_test_commands(module_group, targets, script, jobs=None, verbose=False, changes=None):
+def generate_test_commands(module_group, targets, script, output, jobs=None, verbose=False, changes=None):
"""Generate test commands for the given module group and test targets.
Args:
module_group: The module group (core, extras) to examine.
targets: The test targets to examine.
script: The script used to execute the test targets.
+ output: The path to write the output script to.
jobs: The test jobs to execute, or None to auto-detect.
verbose: True to write detailed output to stderr.
changes: Path to file containing list of changed files, or None to query git.
@@ -153,8 +156,9 @@ def generate_test_commands(module_group, targets, script, jobs=None, verbose=Fal
commands = ['TARGET="%s" TEST_FLAGS="-t %s" %s %s' % (target, tags, j, script_path) for j in jobs]
- for command in commands:
- print(command)
+ with open(output, 'w') as f:
+ f.writelines(commands)
+ f.write('\n')
def print_stderr(*args, **kwargs):