KVM test: Pass the test parameters through the command line
PATCH 1/1 KVM test: Pass the test parameters through the command line
From: Jason Wang <[email protected]>
The patch tries to make using kvm-autotest much more easier by enabling the ability of passing the test parameters from command line directly through --args="key1=value1 key2=value2 ... keyN=valueN".
The idea is simple, autotest test pass the additional parameters through args, and the control file analyzes them and generate the configuration string for kvm_config.
The keywords "only" and "no" were introduced to limit the variants, for each "only=variant1" the control file would generate a line "only variant1", same for "no". For others, "key = value" is generated.
User still need to be familiar with the test parameters in order to get the intended test matrix.
Change from V3:
Use a slightly bigger subset of the config file language by allowing "no" to limit the amount of variants.
Change from V2:
Use the args exported by autotest.
Analyze the cmd parameters in control and drop control.cli. Drop test_cli.cfg.sample so there's no default variants. Add "only" which is used to limit the varaints.
Change from V1:
Drop the wrapper method and use the control file directly.
--- client/tests/kvm/control | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
client/tests/kvm/control +14 -0
@@ -53,6 +53,20 @@ str = """ """ tests_cfg = kvm_config.config() tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg") + +if args: + # We get test parameters from command line + for arg in args: + try: + (key, value) = re.findall("(.*)=(.*)", arg)[0] + if key == "only": + str += "only %s\n" % value + if key == "no": + str += "no %s\n" % value + else: + str += "%s = %s\n" % (key, value) + except IndexError: + pass tests_cfg.fork_and_parse(tests_cfg_path, str) # Run the tests
Signature · 1 line
1.7.3.4
Quoted 51 lines · Lucas Meneghel Rodrigues
From: Jason Wang <[email protected]>
The patch tries to make using kvm-autotest much more easier by enabling the ability of passing the test parameters from command line directly through --args="key1=value1 key2=value2 ... keyN=valueN".
The idea is simple, autotest test pass the additional parameters through args, and the control file analyzes them and generate the configuration string for
kvm_config.The keywords "only" and "no" were introduced to limit the variants, for each "only=variant1" the control file would generate a line "only variant1", same for "no". For others, "key = value" is generated.
User still need to be familiar with the test parameters in order to get the intended test matrix.
Change from V3:
Use a slightly bigger subset of the config file language by allowing "no" to limit the amount of variants.Change from V2:
Use the args exported by autotest.
Analyze the cmd parameters in control and drop control.cli. Drop test_cli.cfg.sample so there's no default variants. Add "only" which is used to limit the varaints.Change from V1:
Drop the wrapper method and use the control file directly.Signed-off-by Jason Wang <[email protected]>--- client/tests/kvm/control | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)client/tests/kvm/control +7
-0@@ -53,6 +53,20 @@ str = """ """ tests_cfg = kvm_config.config() tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg") + +if args: + # We get test parameters from command line + for arg in args: + try: + (key, value) = re.findall("(.*)=(.*)", arg)[0] + if key == "only":
client/tests/kvm/control str = """ · line 72
Quoted 10 lines
client/tests/kvm/control +7
-0+ str += "only %s\n" % value + if key == "no": + str += "no %s\n" % value + else: + str += "%s = %s\n" % (key, value) + except IndexError: + pass tests_cfg.fork_and_parse(tests_cfg_path, str) # Run the tests
Is it possible to pass multiple names to an 'only' command, e.g. only='boot reboot migrate'? What about values with spaces? (vms='vm1 vm2 vm3')
Quoted 61 lines · Michael Goldish
Quoted 60 lines · Lucas Meneghel Rodrigues
From: Jason Wang <[email protected]>
The patch tries to make using kvm-autotest much more easier by enabling the ability of passing the test parameters from command line directly through --args="key1=value1 key2=value2 ... keyN=valueN".
The idea is simple, autotest test pass the additional parameters through args, and the control file analyzes them and generate the configuration string for
kvm_config.The keywords "only" and "no" were introduced to limit the variants, for each "only=variant1" the control file would generate a line "only variant1", same for "no". For others, "key = value" is generated.
User still need to be familiar with the test parameters in order to get the intended test matrix.
Change from V3:
Use a slightly bigger subset of the config file language by allowing "no" to limit the amount of variants.Change from V2:
Use the args exported by autotest.
Analyze the cmd parameters in control and drop control.cli. Drop test_cli.cfg.sample so there's no default variants. Add "only" which is used to limit the varaints.Change from V1:
Drop the wrapper method and use the control file directly.Signed-off-by Jason Wang <[email protected]>--- client/tests/kvm/control | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)client/tests/kvm/control +14
-0@@ -53,6 +53,20 @@ str = """ """ tests_cfg = kvm_config.config() tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg") + +if args: + # We get test parameters from command line + for arg in args: + try: + (key, value) = re.findall("(.*)=(.*)", arg)[0] + if key == "only": + str += "only %s\n" % value + if key == "no": + str += "no %s\n" % value + else: + str += "%s = %s\n" % (key, value) + except IndexError: + pass tests_cfg.fork_and_parse(tests_cfg_path, str)
Quoted 5 lines
client/tests/kvm/control str = """ · line 72
Quoted 1 line
client/tests/kvm/control +0
-0# Run the testsIs it possible to pass multiple names to an 'only' command, e.g. only='boot reboot migrate'? What about values with spaces? (vms='vm1 vm2 vm3')
No, with this logic is not possible to pass multiple names or values with spaces, although I don't think the scope of this change is to allow the full power of the configuration file without using the config file.
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html