Print all the Parser test output to a log file 21/20221/1
authorjose.lausuch <jose.lausuch@ericsson.com>
Thu, 1 Sep 2016 15:55:14 +0000 (17:55 +0200)
committerJose Lausuch <jose.lausuch@ericsson.com>
Fri, 2 Sep 2016 08:27:00 +0000 (08:27 +0000)
To keep the jenkins console clean and readable,
dump all the output that the Parser test case
generates to a log file and push it to artifact
repository at the end.

Change-Id: I04c8507fda535c7bcb0919fc3bc5877336664942
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
(cherry picked from commit fde68435a66f999a0121b20c64e671ac06086cb3)

testcases/vnf/vRNC/parser.py

index d22ca8e..4632612 100755 (executable)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+import argparse
 import time
 
-import argparse
 import functest.utils.functest_logger as ft_logger
 import functest.utils.functest_utils as functest_utils
 
+
 parser = argparse.ArgumentParser()
 parser.add_argument("-r", "--report",
                     help="Create json result file",
                     action="store_true")
 args = parser.parse_args()
 
-functest_yaml = functest_utils.get_functest_yaml()
-
-dirs = functest_yaml.get('general').get('directories')
-PARSER_REPO = dirs.get('dir_repo_parser')
+PARSER_REPO = functest_utils.get_parameter_from_yaml(
+    'general.directories.dir_repo_parser')
+RESULTS_DIR = functest_utils.get_parameter_from_yaml(
+    'general.directories.dir_results')
 
 logger = ft_logger.Logger("parser").getLogger()
 
@@ -40,10 +41,12 @@ def main():
     cmd = 'cd %s/tests && ./functest_run.sh' % PARSER_REPO
 
     start_time = time.time()
+    log_file = RESULTS_DIR + "/parser.log"
     ret = functest_utils.execute_command(cmd,
                                          logger,
                                          info=True,
-                                         exit_on_error=False)
+                                         exit_on_error=False,
+                                         output_file=log_file)
     stop_time = time.time()
 
     status, details = functest_utils.check_test_result(project,