Jv2 Analysis2

This is now a working tested Jenkins V2 script (nearly!). I will update it if I find issues. Iíve done quite a bit of work on getting the percentile analysis reports working, including editing the html so they show up better in more browsers.

Watch this space for updates, as always.

ucs_one_hour

==========================================================

Log Rotation
30
60

==========================================================

loadrunner-slave.214

==========================================================

####!c:/cygwin/bin/bash

#sleep to wait for reboot controller to finish properly
#sleep 600s

#tidy up the workspace
echo tiding up workspace: ${WORKSPACE}
echo $PATH
PATH=/usr/bin:/cygdrive/c/cygwin/bin:$PATH
echo $PATH
cd "${WORKSPACE}"
echo ---------now in workspace---------
pwd
ls
rm --interactive=never -f *.xml
rm --interactive=never -f *.jtl
rm --interactive=never -f *.txt
rm --interactive=never -f report_location

#tidy up the workspace - NOTE: ALL OF THEM! - controller SHOULD be limited to one project running at once -
echo full tidy up workspace: ${WORKSPACE}
cd "${WORKSPACE}"
echo workspace =
pwd
ls
echo try finding directories
if [ ! -d "dir_temp" ]; then
  mkdir dir_temp
fi

/cygdrive/c/cygwin/bin/find . -name "*" -type d | grep / > dir_list
echo "now delete directories"
if [[ -s dir_list ]] ; then
echo "dir list file has data - deleting directories now"
rm -rf $(/cygdrive/c/cygwin/bin/find . -name "*" -type d | grep /)
echo "deleted directories"
fi
ls
echo done
printenv

echo start lr_variables setup - global test options
VtsServer=54.xxx.237.xxx
VTnPort=8878
cd /cygdrive/z/GitHub/PerformanceTesting/scripts/__utils/lr_variables_set
#Z:\GitHub\PerformanceTesting\scripts\__utils\lr_variables_set
pwd
#if you want to remove current variables set in this script uncomment the following line:
sed -i '/lr_variable/d' ./globals.h

echo "//lr_variable VtsServer=${VtsServer}" >> globals.h
echo "//lr_variable environment=stage" >> globals.h
echo "//lr_variable variable3=from jenkins main server - ais test" >> globals.h
echo "//lr_variable variable4=test3" >> globals.h
echo "//lr_variable VTnPort=${VTnPort}" >> globals.h
/cygdrive/c/Program\ Files\ \(x86\)/HP/LoadRunner/bin/mmdrv.exe -usr lr_variables_set.usr
echo done global variables

echo
echo start setting VTS server in scripts - COPIED from ais_check_urls job

cd /cygdrive/z/GitHub/PerformanceTesting/scripts/ais/ais_clear_table_urls
#if you want to remove current variables set in this script uncomment the following line:
sed -i '/lr_variable/d' ./globals.h
echo "//lr_variable VtsServer=${VtsServer}" >> globals.h
echo "//lr_variable VTnPort=${VTnPort}" >> globals.h

cd /cygdrive/z/GitHub/PerformanceTesting/scripts/ais/ais_check_urls
#if you want to remove current variables set in this script uncomment the following line:
sed -i '/lr_variable/d' ./globals.h
echo "//lr_variable VtsServer=${VtsServer}" >> globals.h
echo "//lr_variable VTnPort=${VTnPort}" >> globals.h

cd /cygdrive/z/GitHub/PerformanceTesting/scripts/ais/ais_check_licence_xml
#if you want to remove current variables set in this script uncomment the following line:
sed -i '/lr_variable/d' ./globals.h
echo "//lr_variable VtsServer=${VtsServer}" >> globals.h
echo "//lr_variable VTnPort=${VTnPort}" >> globals.h

cd /cygdrive/z/GitHub/PerformanceTesting/scripts/ais/ais_check_prlicence_xml
#if you want to remove current variables set in this script uncomment the following line:
sed -i '/lr_variable/d' ./globals.h
echo "//lr_variable VtsServer=${VtsServer}" >> globals.h
echo "//lr_variable VTnPort=${VTnPort}" >> globals.h

cd /cygdrive/z/GitHub/PerformanceTesting/scripts/ais/ais_run_test
#if you want to remove current variables set in this script uncomment the following line:
sed -i '/lr_variable/d' ./globals.h
echo "//lr_variable VtsServer=${VtsServer}" >> globals.h
echo "//lr_variable VTnPort=${VTnPort}" >> globals.h

echo done setting up script VTS server

#clear the injectors disc space
wget --no-check-certificate --no-check-certificate --timeout=10 --tries=1  http://54.xxx.141.xxx/job/clear_z_drive/build?delay=0sec
wget --no-check-certificate --no-check-certificate --timeout=10 --tries=1  http://54.xx.87.xxx/job/clear_z_drive/build?delay=0sec


echo "It is now $(date)"

exit 0 #in case the wgets fail




==========================================================

Z:\github\PerformanceTesting\scenarios\ucs\ucs_one_hour.lrs

==========================================================

#!c:/cygwin/bin/bash
echo "It is now $(date)"
echo $PATH
PATH=/usr/bin:/cygdrive/c/cygwin/bin:$PATH
echo $PATH
cd "${WORKSPACE}"
echo "workspace ="
pwd
ls
echo "run sla bash"
./sla_to_jtl.sh
./report.sh
stepname="27." ./disk_space.sh
ls
pwd

echo "It is now $(date)"

echo save lrr location to disk for next step
xml_file=$(ls -rt1 *.xml|tail -1)
grep 'result folder to' ${xml_file} | tail -1 | awk 'BEGIN {FS="result folder to "} {print $2}' > lrr_location.txt
cat lrr_location.txt

echo ======================================================
loc1=$(cat lrr_location.txt)
cd "${loc1}"
pwd
echo =============listing before removing reports:===============
ls
rm --recursive -f Report85
rm --recursive -f Session85
rm -f Report85.html
echo =============listing AFTER removing reports:=================
ls
pwd
cd "${WORKSPACE}"
echo now in workspace:
pwd
echo ======================================================

echo test new lrr find solution
find "$(pwd)" -type f -name "*.lrr"

lrr2_location=$(find "$(pwd)" -type f -name "*.lrr")
echo lrr2_location is: ${lrr2_location}

echo try changing to window format
echo ${lrr2_location} | sed 's#/#\\#g'
echo finished...

echo try changing to window format more
lrr3_location=$(echo ${lrr2_location} | sed 's#/#\\#g')
echo ${lrr3_location}
echo ${lrr3_location} | sed 's#\\cygdrive\\c#c\:#g | sed 's#\\cygdrive\\z#z\:#g''
lrr4_location=$(echo ${lrr3_location} | sed 's#\\cygdrive\\c#c\:#g' | sed 's#\\cygdrive\\z#z\:#g' )
echo lrr4_location is ${lrr4_location}
echo finished more...

lrr5_location=$(echo ${lrr4_location} | sed 's#Program Files (x86)#Progra~2#g')
echo lrr5_location is ${lrr5_location}
echo finished even more...


if [ -s lrr_location.txt ]; then
   res_folder=$(grep 'result folder to' ${xml_file} | tail -1 | awk 'BEGIN {FS="result folder to "} {print $2}')
   echo res_folder is $res_folder

   lrr_location=$(grep 'result folder to' ${xml_file} | tail -1 | awk 'BEGIN {FS="result folder to "} {print $2}')
   echo lrr_location is now $lrr_location
  
   res=$(grep 'launcher with arguments : ' ${xml_file} | tail -1 | awk 'BEGIN {FS="launcher with arguments : \""} {print $2}' | awk 'BEGIN {FS="\" "} {print $1}')
   echo res is: ${res}

     echo lrr5_location - again - is ${lrr5_location}
  
   lrr6_location=$(echo ${lrr5_location} | sed 's#\\#\\\\#g')
   echo lrr6_location is ${lrr6_location}
  
     res="${lrr5_location}"
     echo NEW RES IS ${res}
   echo current directory is:
   pwd

   echo lets get 85th percentiles:
   echo this worked in a cygwin console: /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "z:\jenkins\workspace\ucs_one_hour\344458\results0010\results0010.lrr" -TEMPLATENAME Percentile85

   echo /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile85
   /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile85

   #echo this next line does work - using windows cmd
   #echo cmd /c \"c:\\Progra~2\\HP\\LoadRunner\\bin\\AnalysisUI.exe -RESULTPATH ${res} -TEMPLATENAME Percentile85\"
   #cmd /c \"c:\\Progra~2\\HP\\LoadRunner\\bin\\AnalysisUI.exe -RESULTPATH ${res} -TEMPLATENAME Percentile85\"


   sleep 60
   echo lets get 90th percentiles:
   echo /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile90
   /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile90

   #/cygdrive/c/Program\ Files\ \(x86\)/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile90
   #cmd /c \"c:\\Progra~2\\HP\\LoadRunner\\bin\\AnalysisUI.exe -RESULTPATH ${res} -TEMPLATENAME Percentile90\"


   sleep 60
   echo lets get 95th percentiles:
   echo /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile95
   /cygdrive/c/Progra~2/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile95

   #/cygdrive/c/Program\ Files\ \(x86\)/HP/LoadRunner/bin/AnalysisUI.exe -RESULTPATH "${res}" -TEMPLATENAME Percentile95
   #cmd /c \"c:\\Progra~2\\HP\\LoadRunner\\bin\\AnalysisUI.exe -RESULTPATH ${res} -TEMPLATENAME Percentile95\"


   sleep 10
  
   echo editing the html files for better viewing on my machine - not working very well. HTML code looks ok. Maybe something wrong with Jenkins2 webserver.
   echo
   #<?xml version="1.0" encoding="UTF-8" ?>
   #<html>
   pwd
   cd "${res_folder}"
   #sed -i -- 's/<?xml version="1.0" encoding="UTF-8" ?>\n//g' *.html
   sed --in-place '/xml version/d' *.html
   sed -i -- 's/<HTML><HEAD>/<html>\n<HEAD>/g' *.html
   cd Report85
   #sed -i -- 's/<?xml version="1.0" encoding="UTF-8" ?>\n//g' *.html
   sed --in-place '/xml version/d' *.html
   sed -i -- 's/<HTML><HEAD>/<html>\n<HEAD>/g' *.html
   cd ..
   cd Report90
   #sed -i -- 's/<?xml version="1.0" encoding="UTF-8" ?>\n//g' *.html
   sed --in-place '/xml version/d' *.html
   sed -i -- 's/<HTML><HEAD>/<html>\n<HEAD>/g' *.html
   cd ..
   cd Report95
   #sed -i -- 's/<?xml version="1.0" encoding="UTF-8" ?>\n//g' *.html
   sed --in-place '/xml version/d' *.html
   sed -i -- 's/<HTML><HEAD>/<html>\n<HEAD>/g' *.html
   cd ..
  
  
   mv "${res_folder}/Report85" .
   mv "${res_folder}/Report85.html" .
   mv "${res_folder}/Report90" .
   mv "${res_folder}/Report90.html" .
   mv "${res_folder}/Report95" .
   mv "${res_folder}/Report95.html" .
   mv "${res_folder}/Session85" .
   #mv "${res_folder}/Session90" .
   #mv "${res_folder}/Session95" .
else
   echo cannot find lrr_location. exiting script.
fi

echo "It is now $(date)"

#check jtl files for pass mark and return value:

ls -all *.jtl | awk '{print $9}' > jtl_files
echo get number of jtl entries
jtl_nf=$(wc -l jtl_files | awk '{print $1}')
echo number = ${jtl_nf}

passmark=0
START=1
           END=${jtl_nf}
           echo start = $START
           echo end = $END
          
           ## save $START, just in case if we need it later ##
           i=$START
           while [[ $i -le $END ]]
           do
                 echo "$i"
                
                
                 tail -100 jtl_files | head -$i | tail -1
                 jtl_var=$(tail -100 jtl_files | head -$i | tail -1)

                 if grep -q 's="false"' ${jtl_var}
                 then
                       echo ---------------------------------------
                       echo FAIL - last jtl file sets value to fail
                       echo ---------------------------------------
                       passmark=1
                 fi
                            
                 ((i = i + 1))
                
                
           done
          
exit ${passmark}
          



==========================================================
Archive:

*.*,htmlReport/**/*,Report85/**/*,Report90/**/*,Report95/**/*,Session85/**/*,Session90/**/*,Session95/**/*


==========================================================
Groovy postbuild:

errpattern = ~/last jtl file sets value to fail.*/;
manager.build.logFile.eachLine{ line ->
   errmatcher=errpattern.matcher(line)
   if (errmatcher.find()) {
       println "Groovy setting build to FAILED"
       manager.build.@result = hudson.model.Result.FAILURE
   }
   else
   {
       println "Groovy setting build to PASSED"
       manager.build.@result = hudson.model.Result.SUCCESS
   }
 }
 
 
==========================================================


**/*.jtl

5
10

==========================================================




==========================================================


==========================================================



















 

[Home] [About (CV)] [Contact Us] [JMeter Cloud] [webPageTest] [_64 images] [asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave] [LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH] [Bash methods] [Jenkins V2] [J V2 Pipeline1] [Jv2 Jobs] [Jv2 Analysis] [Jv2 Analysis2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over] [VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal]

In the Cartesian Elements Ltd group of companies