diff --git a/Jenkinsfiles/hw_test_set b/Jenkinsfiles/hw_test_set index 92b3547..05425e8 100644 --- a/Jenkinsfiles/hw_test_set +++ b/Jenkinsfiles/hw_test_set @@ -12,6 +12,7 @@ resultsDirectory = '' configPath = '' zipImagePath = '' bootSuite = 'boot_test.robot' +performanceSuite = 'performance/' batSuite = './' deviceName = '' usbHubSerial = '' @@ -27,6 +28,7 @@ pipeline { def splitted = "${JOB_NAME}".split('/') bootJob = "${splitted[0]}/Testing/boot_test" batJob = "${splitted[0]}/Testing/smoke_tests" + performanceJob = "${splitted[0]}/Testing/Performance_tests" configPath = "/home/${params.label}/Jenkins-agent/workspace/${splitted[0]}/Testing/test_config.json" // Check for which agent and which target device @@ -166,7 +168,37 @@ pipeline { } else { catchError(stageResult: 'FAILURE', buildResult: 'FAILURE'){ error("BAT build failed") - } + } + } + } + } + } + stage('Performance tests') { + steps { + script{ + // Make directory for test results + sh "mkdir -p ${params.resultsPath}/${params.buildID}/${resultsDirectory}/performance" + build = build( + job: "${performanceJob}", propagate: false, + parameters: [ + [$class: 'StringParameterValue', name: 'RF_SUITE', value: "${performanceSuite}"], + [$class: 'StringParameterValue', name: 'DESCRIPTION', value: "${params.server} buildID: ${params.buildID}"], + [$class: 'StringParameterValue', name: 'DEVICE_NAME', value: "${deviceName}"], + [$class: 'StringParameterValue', name: 'BUILD_ID', value: "${params.buildID}"] + ] + ) + // copy report, log and plots + sh "cp ~/Jenkins-agent/workspace/${performanceJob}/Robot-Framework/test-suites/report.html ${params.resultsPath}/${params.buildID}/${resultsDirectory}/performance/report.html" + sh "cp ~/Jenkins-agent/workspace/${performanceJob}/Robot-Framework/test-suites/log.html ${params.resultsPath}/${params.buildID}/${resultsDirectory}/performance/log.html" + sh "cp ~/Jenkins-agent/workspace/${performanceJob}/Robot-Framework/test-suites/*.png ${params.resultsPath}/${params.buildID}/${resultsDirectory}/performance/" + if(build.result == "SUCCESS") { + buildResults."bat" = "SUCCESS" + echo "BUILD NUMBER: ${build.number} SUCCESSFULLY BUILD" + } else { + echo "BUILD NUMBER: ${build.number} SUCCESSFULLY BUILD" + catchError(stageResult: 'FAILURE'){ + error("Error during performance tests") + } } } } diff --git a/Robot-Framework/config/variables.robot b/Robot-Framework/config/variables.robot index f0890f9..2d3eae4 100644 --- a/Robot-Framework/config/variables.robot +++ b/Robot-Framework/config/variables.robot @@ -4,6 +4,12 @@ *** Settings *** Library OperatingSystem + +*** Variables *** + +${BUILD_ID} ${EMPTY} + + *** Keywords *** Set Variables diff --git a/Robot-Framework/test-suites/performance/network.robot b/Robot-Framework/test-suites/performance/network.robot index c1b0766..e6ed516 100644 --- a/Robot-Framework/test-suites/performance/network.robot +++ b/Robot-Framework/test-suites/performance/network.robot @@ -21,16 +21,18 @@ TCP speed test [Tags] tcp SP-T91 Run iperf server on DUT &{tcp_speed} Run TCP test - Save Speed Data ${TEST NAME} ${buildID} ${tcp_speed} + Save Speed Data ${TEST NAME} ${BUILD_ID} ${tcp_speed} Log TCP Plot HTML + [Teardown] Stop iperf server UDP speed test [Documentation] Measure RX and TX speed for UDP [Tags] udp SP-T92 Run iperf server on DUT &{udp_speed} Run UDP test - Save Speed Data ${TEST NAME} ${buildID} ${udp_speed} + Save Speed Data ${TEST NAME} ${BUILD_ID} ${udp_speed} Log UDP Plot HTML + [Teardown] Stop iperf server *** Keywords *** @@ -42,6 +44,7 @@ Common Setup Run iperf server on DUT [Documentation] Run iperf on DUT in server mode + Clear iptables rules ${command} Set Variable iperf -s Execute Command nohup ${command} > output.log 2>&1 & @@ -59,3 +62,14 @@ Run UDP test Log ${output.stdout} &{udp_speed} Parse iperf output ${output.stdout} [Return] &{udp_speed} + +Clear iptables rules + [Documentation] Clear IP tables rules to open ports + Execute Command iptables -F sudo=True sudo_password=${PASSWORD} + +Stop iperf server + @{pid}= Find pid by name iperf + IF @{pid} != @{EMPTY} + Log to Console Close iperf server: @{pid} + Kill process @{pid} + END diff --git a/Robot-Framework/test-suites/performance/performance.robot b/Robot-Framework/test-suites/performance/performance.robot index 8c2804a..8d28230 100644 --- a/Robot-Framework/test-suites/performance/performance.robot +++ b/Robot-Framework/test-suites/performance/performance.robot @@ -11,6 +11,7 @@ Library ../../lib/PerformanceDataProcessing.py ${DEVICE} Suite Setup Common Setup Suite Teardown Close All Connections + *** Test Cases *** CPU One thread test @@ -21,7 +22,7 @@ CPU One thread test ${output} Execute Command sysbench cpu --time=10 --threads=1 --cpu-max-prime=20000 run Log ${output} &{cpu_data} Parse Cpu Results ${output} - Save Cpu Data ${TEST NAME} ${buildID} ${cpu_data} + Save Cpu Data ${TEST NAME} ${BUILD_ID} ${cpu_data} Log CPU Plot HTML CPU multimple threads test @@ -32,7 +33,7 @@ CPU multimple threads test ${output} Execute Command sysbench cpu --time=10 --threads=${threads_number} --cpu-max-prime=20000 run Log ${output} &{cpu_data} Parse Cpu Results ${output} - Save Cpu Data ${TEST NAME} ${buildID} ${cpu_data} + Save Cpu Data ${TEST NAME} ${BUILD_ID} ${cpu_data} Log CPU Plot HTML Memory Read One thread test @@ -44,7 +45,7 @@ Memory Read One thread test ${output} Execute Command sysbench memory --time=60 --memory-oper=read --threads=1 run Log ${output} &{cpu_data} Parse Memory Results ${output} - Save Memory Data ${TEST NAME} ${buildID} ${cpu_data} + Save Memory Data ${TEST NAME} ${BUILD_ID} ${cpu_data} Log Mem Plot HTML Memory Write One thread test @@ -56,7 +57,7 @@ Memory Write One thread test ${output} Execute Command sysbench memory --time=60 --memory-oper=write --threads=1 run Log ${output} &{cpu_data} Parse Memory Results ${output} - Save Memory Data ${TEST NAME} ${buildID} ${cpu_data} + Save Memory Data ${TEST NAME} ${BUILD_ID} ${cpu_data} Log Mem Plot HTML Memory Read multimple threads test @@ -68,7 +69,7 @@ Memory Read multimple threads test ${output} Execute Command sysbench memory --time=60 --memory-oper=read --threads=${threads_number} run Log ${output} &{cpu_data} Parse Memory Results ${output} - Save Memory Data ${TEST NAME} ${buildID} ${cpu_data} + Save Memory Data ${TEST NAME} ${BUILD_ID} ${cpu_data} Log Mem Plot HTML Memory Write multimple threads test @@ -80,7 +81,7 @@ Memory Write multimple threads test ${output} Execute Command sysbench memory --time=60 --memory-oper=write --threads=${threads_number} run Log ${output} &{cpu_data} Parse Memory Results ${output} - Save Memory Data ${TEST NAME} ${buildID} ${cpu_data} + Save Memory Data ${TEST NAME} ${BUILD_ID} ${cpu_data} Log Mem Plot HTML