import json from copy import deepcopy from pprint import pprint SIGNAL_PREFIX = "SIGNAL_PREFIX" MODE = "MODE" JOB_NAME = "JOB_NAME" AGENDA = "AGENDA" PARAMETERS = "parameters" TESTDEF_REPOS = "testdef_repos" ACTIONS = "actions" HOST_SHELL = { "command": "lava_test_shell", "parameters": { "testdef_repos": [ { "git-repo": "git://git.linaro.org/qa/wa2-lava.git", "testdef": "wa2host.yaml", "parameters": { "AGENDA": "$WA2_AGENDA", "JOB_NAME": "$WA2_JOB_NAME", "MODE": "$WA2_MODE", "SIGNAL_PREFIX": "$WA2_PREFIX" } } ], "timeout": 4200, "role": "host" } } TARGET_SHELL = { "command": "lava_test_shell", "parameters": { "testdef_repos": [ { "git-repo": "git://git.linaro.org/qa/wa2-lava.git", "testdef": "wa2target.yaml", "parameters": { "SIGNAL_PREFIX": "$WA2_PREFIX" } } ], "timeout": 2400, "role": "target" } } JSON_TEMPLATE = { "logging_level": "INFO", "timeout": 1800, "job_name": "$JOB_NAME", "device_group": [ { "role": "host", "count": 1, "device_type": "dummy-ssh" }, { "role": "target", "count": 1, "device_type": "$DUT_TYPE" } ], "actions": [ { "command": "dummy_deploy", "parameters": { "target_type": "ubuntu" } }, { "command": "deploy_linaro_android_image", "metadata": { "android.build": "$ANDROID_META_BUILD", "android.name": "$ANDROID_META_NAME", "android.url": "$ANDROID_META_URL" }, "parameters": { "boot": "$ANDROID_BOOT", "data": "$ANDROID_DATA", "system": "$ANDROID_SYSTEM", "role": "target" } } ] } SUBMIT_RESULTS = { "command": "submit_results_on_host", "parameters": { "stream": "$BUNDLE_STREAM", "server": "http://validation.linaro.org/RPC2/" } } POSTPROCESSING = { "command": "lava_test_shell", "parameters": { "testdef_repos": [ { "git-repo": "git://git.linaro.org/qa/wa2-lava.git", "testdef": "wa2host_postprocessing.yaml", "parameters": { "JOB_NAME": "$JOB_NAME" } } ], "timeout": 4200, "role": "host" } } modes = [ "hmp", "a57_only", "a53_only", ] agenda_hmp_workloads = [ "hmp_only_audio.yaml", "hmp_only_bbench_audio.yaml", ] agenda_hmp_benchmarks = [ "hmp_juno_andbench_t1.yaml", "hmp_juno_andbench_t5.yaml", "hmp_juno_antutu_4.0.3.yaml", "hmp_juno_benchmarkpi.yaml", "hmp_juno_caffeinemark.yaml", "hmp_juno_cfbench.yaml", "hmp_juno_geekbench3.yaml", "hmp_juno_linpack.yaml", "hmp_juno_quadrant.yaml", "hmp_juno_smartbench.yaml", "hmp_juno_sqlite.yaml", "hmp_juno_vellamo.yaml", ] agenda_a57_only_workloads = [ "a57_only_audio.yaml", "a57_only_bbench_audio.yaml", ] agenda_a53_only_workloads = [ "a53_only_audio.yaml", "a53_only_bbench_audio.yaml", ] agenda_a53_only_benchmarks = [ "a53_only_andbench_t1.yaml", "a53_only_andbench_t5.yaml", "a53_only_antutu_4.0.3.yaml", "a53_only_benchmarkpi.yaml", "a53_only_caffeinemark.yaml", "a53_only_cfbench.yaml", "a53_only_geekbench3.yaml", "a53_only_linpack.yaml", "a53_only_quadrant.yaml", "a53_only_smartbench.yaml", "a53_only_sqlite.yaml", "a53_only_vellamo.yaml", ] agenda_a57_only_benchmarks = [ "a57_only_andbench_t1.yaml", "a57_only_andbench_t5.yaml", "a57_only_antutu_4.0.3.yaml", "a57_only_benchmarkpi.yaml", "a57_only_caffeinemark.yaml", "a57_only_cfbench.yaml", "a57_only_geekbench3.yaml", "a57_only_linpack.yaml", "a57_only_quadrant.yaml", "a57_only_smartbench.yaml", "a57_only_sqlite.yaml", "a57_only_vellamo.yaml", ] for mode in modes: if mode.split("_")[1] == "workloads": for benchmark in globals()["agenda_" + mode]: test_case = deepcopy(JSON_TEMPLATE) for iteration in range(1,6): hostshell = deepcopy(HOST_SHELL) hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][AGENDA] = benchmark hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][MODE] = mode.split("_")[0] hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0] + "-iter" + str(iteration) targetshell = deepcopy(TARGET_SHELL) targetshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0] + "-iter" + str(iteration) test_case[ACTIONS].append(hostshell) test_case[ACTIONS].append(targetshell) #pprint(test_case) test_case[ACTIONS].append(deepcopy(SUBMIT_RESULTS)) f = open("wa2_%s.json" % benchmark.split(".")[0], "w") f.write(json.dumps(test_case, sort_keys=True, indent=4)) f.close() else: for benchmark in globals()["agenda_" + mode]: test_case = deepcopy(JSON_TEMPLATE) hostshell = deepcopy(HOST_SHELL) hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][AGENDA] = benchmark hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][MODE] = mode.split("_")[0] hostshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0] targetshell = deepcopy(TARGET_SHELL) targetshell[PARAMETERS][TESTDEF_REPOS][0][PARAMETERS][SIGNAL_PREFIX] = benchmark.split(".")[0] test_case[ACTIONS].append(hostshell) test_case[ACTIONS].append(targetshell) test_case[ACTIONS].append(deepcopy(SUBMIT_RESULTS)) #pprint(test_case) f = open("wa2_%s.json" % benchmark.split(".")[0], "w") f.write(json.dumps(test_case, sort_keys=True, indent=4)) f.close()