From 5b6c3589c60b49fcc90aaae388ac4a5b34d363ea Mon Sep 17 00:00:00 2001 From: Jozef Behran Date: Thu, 18 Feb 2016 17:03:29 +0100 Subject: [PATCH] Add suite name to the testtool log file name 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 --- csit/libraries/NetconfKeywords.robot | 7 +++++-- csit/libraries/Utils.robot | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/csit/libraries/NetconfKeywords.robot b/csit/libraries/NetconfKeywords.robot index 66907f612d..a89e449732 100644 --- a/csit/libraries/NetconfKeywords.robot +++ b/csit/libraries/NetconfKeywords.robot @@ -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} diff --git a/csit/libraries/Utils.robot b/csit/libraries/Utils.robot index a18f2bec19..aed9a3e895 100644 --- a/csit/libraries/Utils.robot +++ b/csit/libraries/Utils.robot @@ -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 -- 2.36.6