From 1d902cd5813a2df252b6976bdcdc9cd7531590b4 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Wed, 5 Oct 2016 10:06:16 +0200 Subject: Move tests to shell scripts --- tools/compileconfig.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'tools/compileconfig.py') diff --git a/tools/compileconfig.py b/tools/compileconfig.py index 9acc702..cee9873 100755 --- a/tools/compileconfig.py +++ b/tools/compileconfig.py @@ -354,7 +354,7 @@ def gen_config(nodename, config, localconfig): configfile.close() -def gen_testmakefile(config, testmakefile, machines): +def gen_testmakefile(config, testmakefile, machines, shellvars=False): configfile = open(testmakefile, "w") frontendnodenames = set([node["name"] for node in config["frontendnodes"]]) storagenodenames = set([node["name"] for node in config["storagenodes"]]) @@ -368,11 +368,13 @@ def gen_testmakefile(config, testmakefile, machines): signingnodeaddresses = [node["address"] for node in config["signingnodes"]] mergenodeaddresses = [node["address"] for node in config["mergenodes"] if node["name"] != config["primarymergenode"]] - print >>configfile, "NODES=" + " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames) - print >>configfile, "ERLANGNODES=" + " ".join(erlangnodenames) - print >>configfile, "MACHINES=" + " ".join([str(e) for e in range(1, machines+1)]) - print >>configfile, "TESTURLS=" + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses+mergenodeaddresses) - print >>configfile, "BASEURL=" + config["baseurl"] + delimiter = '"' if shellvars else '' + + print >>configfile, "NODES=" + delimiter + " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames) + delimiter + print >>configfile, "ERLANGNODES=" + delimiter + " ".join(erlangnodenames) + delimiter + print >>configfile, "MACHINES=" + delimiter + " ".join([str(e) for e in range(1, machines+1)]) + delimiter + print >>configfile, "TESTURLS=" + delimiter + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses+mergenodeaddresses) + delimiter + print >>configfile, "BASEURL=" + delimiter + config["baseurl"] + delimiter configfile.close() @@ -382,12 +384,15 @@ def main(): parser.add_argument('--config', help="System configuration", required=True) parser.add_argument('--localconfig', help="Local configuration") parser.add_argument("--testmakefile", metavar="file", help="Generate makefile variables for test") + parser.add_argument("--testshellvars", metavar="file", help="Generate shell variable file for test") parser.add_argument("--machines", type=int, metavar="n", help="Number of machines") args = parser.parse_args() config = yaml.load(open(args.config)) if args.testmakefile and args.machines: gen_testmakefile(config, args.testmakefile, args.machines) + elif args.testshellvars and args.machines: + gen_testmakefile(config, args.testshellvars, args.machines, shellvars=True) elif args.localconfig: localconfig = yaml.load(open(args.localconfig)) localnodes = localconfig["localnodes"] -- cgit v1.1