From faa343d036b5889a520a53250b8a4c3f1a8ba9bd Mon Sep 17 00:00:00 2001 From: Nicolas Dechesne Date: Mon, 23 Oct 2017 00:33:10 +0200 Subject: test-runner: ResultParser: handle custom params from command line When setting test params on the command line with -r, they are correctly passed down into run.sh script, however at the end of the test run when we print the result, the custom params from command line are ignored, and we incorrectly print the test params from the .yaml file. e.g. $ test-runner -d automated/linux/wlan-smoke/wlan-smoke.yaml -e -r BOOT=disabled incorrectly prints the following: name,test_case_id,result,measurement,units,test_params wlan-smoke,ip-link,pass,,,DEVICE=wlan0;BOOT=enabled wlan-smoke,wlan-boot,fail,,,DEVICE=wlan0;BOOT=enabled wlan-smoke,wlan-down,pass,,,DEVICE=wlan0;BOOT=enabled wlan-smoke,wlan-up,pass,,,DEVICE=wlan0;BOOT=enabled When parsing the result, we need to override the test params with any param from the command line. After this patch, the same command produces: name,test_case_id,result,measurement,units,test_params wlan-smoke,ip-link,pass,,,DEVICE=wlan0;BOOT=disabled wlan-smoke,wlan-boot,fail,,,DEVICE=wlan0;BOOT=disabled wlan-smoke,wlan-down,pass,,,DEVICE=wlan0;BOOT=disabled wlan-smoke,wlan-up,pass,,,DEVICE=wlan0;BOOT=disabled And for fun: $ test-runner -d automated/linux/wlan-smoke/wlan-smoke.yaml -e -r BOOT=disabled THEBUGISGONE=yes name,test_case_id,result,measurement,units,test_params wlan-smoke,ip-link,pass,,,DEVICE=wlan0;THEBUGISGONE=yes;BOOT=disabled wlan-smoke,wlan-boot,fail,,,DEVICE=wlan0;THEBUGISGONE=yes;BOOT=disabled wlan-smoke,wlan-down,pass,,,DEVICE=wlan0;THEBUGISGONE=yes;BOOT=disabled wlan-smoke,wlan-up,pass,,,DEVICE=wlan0;THEBUGISGONE=yes;BOOT=disabled Change-Id: Ib561620f73e868d53653aa158f35e7804d7e13f3 Signed-off-by: Nicolas Dechesne --- automated/utils/test-runner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/automated/utils/test-runner.py b/automated/utils/test-runner.py index 7783850..267a74a 100755 --- a/automated/utils/test-runner.py +++ b/automated/utils/test-runner.py @@ -604,6 +604,9 @@ class ResultParser(object): self.results['name'] = self.testdef['metadata']['name'] if 'params' in self.testdef.keys(): self.results['params'] = self.testdef['params'] + if self.args.test_def_params: + for param_name, param_value in self.args.test_def_params.items(): + self.results['params'][param_name] = param_value if 'parse' in self.testdef.keys() and 'pattern' in self.testdef['parse'].keys(): self.pattern = self.testdef['parse']['pattern'] self.logger.info("Enabling log parse pattern: %s" % self.pattern) -- cgit v1.2.3