Add "status" command, refs #8080
[arvados-dev.git] / jenkins / create-plot-data-from-log.sh
index daf3ef81f4e884b8313b67352f12929efffc8edf..ce3bfed005ca3a464c291ba5e7d691471be91586 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash 
+#!/bin/bash
 
 build=$1
 file=$2
@@ -12,14 +12,14 @@ usage() {
 
 if [ $# -ne 3 ]
 then
-    usage 
+    usage
     exit 1
 fi
 
 if [ ! -e $file ]
 then
     usage
-    echo "$file doesn't exists! exiting"
+    echo "$file doesn't exist! exiting"
     exit 2
 fi
 if [ ! -w $outputdir ]
@@ -30,22 +30,30 @@ then
 fi
 
 #------------------------------
-## max lines that a test will output
-MAXLINES=1000 
+## MAXLINE is the amount of lines that will read after the pattern
+## is match (the logfile could be hundred thousands lines long).
+## 1000 should be safe enough to capture all the output of the individual test
+MAXLINES=1000
 
 ## TODO: check $build and $file make sense
 
 for test in \
- test_Collection_page_renders_name \
- test_combine_selected_collections_into_new_collection \
- test_combine_selected_collection_files_into_new_collection_active_foo_collection_in_aproject_true \
- test_combine_selected_collection_files_into_new_collection_active_foo_file_false \
- test_combine_selected_collection_files_into_new_collection_project_viewer_foo_collection_in_aproject_false \
- test_combine_selected_collection_files_into_new_collection_project_viewer_foo_file_false 
+ test_Create_and_show_large_collection_with_manifest_text_of_20000000 \
+ test_Create,_show,_and_update_description_for_large_collection_with_manifest_text_of_100000 \
+ test_Create_one_large_collection_of_20000000_and_one_small_collection_of_10000_and_combine_them
 do
- zgrep -A$MAXLINES "^CollectionsTest: $test" $file | tail --lines=+3|grep -B$MAXLINES -E "^-*$" -m1 > $outputdir/$test-$build.txt
- echo processing  $outputdir/$test-$build.txt creating  $outputdir/$test.csv
- echo $(grep ^Completed $test-$build.txt | perl -n -e '/^Completed (.*) in [0-9]+ms.*$/;print "".++$line."-$1,";' | perl -p -e 's/,$//g'|tr " " "_" ) >  $outputdir/$test.csv
- echo $(grep ^Completed $test-$build.txt | perl -n -e '/^Completed.*in ([0-9]+)ms.*$/;print "$1,";' | perl -p -e 's/,$//g' ) >>  $outputdir/$test.csv
- #echo URL=https://ci.curoverse.com/view/job/arvados-api-server/ws/apps/workbench/log/$test-$build.txt/*view*/ >>  $outputdir/$test.properties
+ cleaned_test=$(echo $test | tr -d ",.:;/")
+ (zgrep -i -E -A$MAXLINES "^[A-Za-z0-9]+Test: $test" $file && echo "----") | tail -n +1 | tail --lines=+3|grep -B$MAXLINES -E "^-*$" -m1 > $outputdir/$cleaned_test-$build.txt
+ result=$?
+ if [ $result -eq 0 ]
+ then
+   echo processing  $outputdir/$cleaned_test-$build.txt creating  $outputdir/$cleaned_test.csv
+   echo $(grep ^Completed $outputdir/$cleaned_test-$build.txt | perl -n -e '/^Completed (.*) in [0-9]+ms.*$/;print "".++$line."-$1,";' | perl -p -e 's/,$//g'|tr " " "_" ) >  $outputdir/$cleaned_test.csv
+   echo $(grep ^Completed $outputdir/$cleaned_test-$build.txt | perl -n -e '/^Completed.*in ([0-9]+)ms.*$/;print "$1,";' | perl -p -e 's/,$//g' ) >>  $outputdir/$cleaned_test.csv
+   #echo URL=https://ci.curoverse.com/view/job/arvados-api-server/ws/apps/workbench/log/$cleaned_test-$build.txt/*view*/ >>  $outputdir/$test.properties
+ else
+   echo "$test was't found on $file"
+   cleaned_test=$(echo $test | tr -d ",.:;/")
+   >  $outputdir/$cleaned_test.csv
+ fi
 done