Print all the Copper test output to a log file 73/20173/2
authorjose.lausuch <jose.lausuch@ericsson.com>
Thu, 1 Sep 2016 15:40:33 +0000 (17:40 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Fri, 2 Sep 2016 08:29:00 +0000 (10:29 +0200)
To keep the jenkins console clean and readable,
dump all the output that the Copper test case
generates to a log file and push it to artifact
repository at the end.

Change-Id: If4812c7e92b4d050757ca07333f7c353a0220056
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
testcases/features/copper.py

index b1df99a..50319d9 100755 (executable)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+import argparse
 import sys
 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')
-COPPER_REPO = dirs.get('dir_repo_copper')
+COPPER_REPO = functest_utils.get_parameter_from_yaml(
+    'general.directories.dir_repo_copper')
+RESULTS_DIR = functest_utils.get_parameter_from_yaml(
+    'general.directories.dir_results')
 
 logger = ft_logger.Logger("copper").getLogger()
 
@@ -40,7 +41,10 @@ def main():
 
     start_time = time.time()
 
-    ret_val = functest_utils.execute_command(cmd, exit_on_error=False)
+    log_file = RESULTS_DIR + "/copper.log"
+    ret_val = functest_utils.execute_command(cmd,
+                                             exit_on_error=False,
+                                             output_file=log_file)
 
     stop_time = time.time()
     duration = round(stop_time - start_time, 1)