Add suite name to the testtool log file name 14/34914/3
authorJozef Behran <jbehran@cisco.com>
Thu, 18 Feb 2016 16:03:29 +0000 (17:03 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 19 Feb 2016 12:03:15 +0000 (12:03 +0000)
To prevent suites using the test tool overwriting the log
file of the test tool(s) they use, add the name of the
suite to the name of the log file produced by the test
tool. This currently affects suites using the "testtool"
tool (CRUD and scaling suites). The core code in this change
was packaged into the keyword Utils.Get_Log_File_Name because
the functionality is going to be needed in the RestPerfClient
suite as well.

Change-Id: Idf5fbed8baf4b150d66e91c95c2bcaa6dbeab90b
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/libraries/NetconfKeywords.robot
csit/libraries/Utils.robot

index 66907f612d07fc235200cebecf49a3a81442724f..a89e449732348fae0be78c35b313589960e45b02 100644 (file)
@@ -17,6 +17,7 @@ Library           RequestsLibrary
 Resource          NetconfViaRestconf.robot
 Resource          NexusKeywords.robot
 Resource          SSHKeywords.robot
+Resource          Utils.robot
 
 *** Variables ***
 ${TESTTOOL_DEFAULT_JAVA_OPTIONS}    -Xmx1G -XX:MaxPermSize=256M -Dorg.apache.sshd.registerBouncyCastle=false
@@ -153,7 +154,9 @@ Install_And_Start_Testtool
     # Start the testtool
     ${command}    BuiltIn.Set_Variable    java ${java_options} -jar ${filename} ${tool_options} --device-count ${device-count} --debug ${debug} ${schemas_option} --md-sal ${mdsal}
     BuiltIn.Log    Running testtool: ${command}
-    SSHLibrary.Write    ${command} >testtool.log 2>&1
+    ${logfile}=    Utils.Get_Log_File_Name    testtool
+    BuiltIn.Set_Suite_Variable    ${testtool_log}    ${logfile}
+    SSHLibrary.Write    ${command} >${logfile} 2>&1
     # Store information needed by other keywords.
     BuiltIn.Set_Suite_Variable    ${NetconfKeywords__testtool_device_count}    ${device-count}
     # Wait for the testtool to boot up.
@@ -173,7 +176,7 @@ Stop_Testtool
     # TODO: Maybe this keyword's content shall be moved into SSHUtils and named somewhat like
     # "Interrupt_Program_And_Download_Its_Log" which will get an argument stating the name of
     # the log file to get.
-    SSHLibrary.Get_File    testtool.log
+    SSHLibrary.Get_File    ${testtool_log}
 
 NetconfKeywords__Check_Netconf_Test_Timeout_Not_Expired
     [Arguments]    ${deadline_Date}
index a18f2bec19ffec846ab62cb82c41a3364906b1d9..aed9a3e895013a554722f818dc31b9455e703817 100644 (file)
@@ -411,3 +411,12 @@ Post Log Check
     Log    ${resp.content}
     Should Be Equal As Strings    ${resp.status_code}    ${status_code}
     [Return]    ${resp}
+
+Get Log File Name
+    [Arguments]    ${testtool}
+    [Documentation]    Get the name of the suite sanitized to be usable as a part of filename.
+    ...    These names are used to constructs names of the log files produced
+    ...    by the testing tools so two suites using a tool wont overwrite the
+    ...    log files if they happen to run in one job.
+    ${name}=    BuiltIn.Evaluate    """${SUITE_NAME}""".replace(" ","-").replace("/","-").replace(".","-")
+    [Return]    ${testtool}--${name}.log