3c32f162f57c0dbdbf00e5219f21887ca8cc8e29 steve Tue Dec 11 09:34:43 2012 -0800 Made changes suggested by Brooke in code review (redmine #9723) diff --git src/utils/qa/checkTrackUiLinks.csh src/utils/qa/checkTrackUiLinks.csh index 1814eab..36e5134 100755 --- src/utils/qa/checkTrackUiLinks.csh +++ src/utils/qa/checkTrackUiLinks.csh @@ -1,27 +1,29 @@ #!/bin/tcsh source `which qaConfig.csh` ################################ # # 01-24-07 # Robert Kuhn # # checks all links on trackUi pages for a track # ################################ +onintr cleanup + set tableinput="" set tables="" set machine="hgwbeta" set rr="false" set baseUrl="" set target="" set hgsid="" set db="" set errorCount=0 set totalCount=0 if ( $#argv < 2 || $#argv > 3 ) then echo echo " checks all links on trackUi pages for a track." echo @@ -76,72 +78,77 @@ set baseUrl="http://$machine.cse.ucsc.edu" set hgsid=`htmlCheck getVars $baseUrl/cgi-bin/hgGateway | grep hgsid \ | head -1 | awk '{print $4}'` echo "hgw1 hgw2 hgw3 hgw4 hgw5 hgw6 hgw7 hgw8 " | grep $machine if ( $status ) then set rr="true" endif # process "all" choice if ("all" == $tableinput) then set tables=`getField.csh $db trackDb tableName $machine \ | grep -v tableName` set target="$baseUrl/cgi-bin/hgGateway?hgsid=$hgsid&db=$db" # check description page if doing all of an assembly - htmlCheck checkLinks "$target" >& error - if ( `wc -w error | awk '{print $1}'` != 0 ) then + htmlCheck checkLinks "$target" >& error$$ + if ( `wc -w error$$ | awk '{print $1}'` != 0 ) then echo echo "description.html page:" echo "======================" - cat error + cat error$$ @ errorCount = $errorCount + 1 endif - rm -f error + @ totalCount = $totalCount + 1 + rm -f error$$ endif foreach table ($tables) # check to see if the table exists on the machine getField.csh $db trackDb tableName $machine | grep -w $table > /dev/null if ( $status ) then echo "no such track" continue endif set target="$baseUrl/cgi-bin/hgTrackUi?hgsid=$hgsid&db=$db&g=$table" - htmlCheck checkLinks "$target" >& error + htmlCheck checkLinks "$target" >& error$$ # trap internal same-page anchors and discard - cat error | egrep -v "doesn't exist" > error2 - mv error2 error + cat error$$ | egrep -v "doesn't exist" > error2$$ + mv error2$$ error$$ # slow it down if hitting the RR if ( "true" == $rr ) then sleep 2 endif - if ( `wc -w error | awk '{print $1}'` != 0 ) then - if ( `cat error` != "403 from http://hgwbeta.cse.ucsc.edu/cgi-bin/" ) then + if ( `wc -w error$$ | awk '{print $1}'` != 0 ) then + if ( `cat error$$` != "403 from http://hgwbeta.cse.ucsc.edu/cgi-bin/" ) then echo echo $table echo "=============" - cat error + cat error$$ @ errorCount = $errorCount + 1 endif endif @ totalCount = $totalCount + 1 - rm -f error + rm -f error$$ end echo echo "Summary" echo "=======" if ( $totalCount == 1 ) then - echo $totalCount "table checked" + echo $totalCount "page checked" else - echo $totalCount "tables checked" + echo $totalCount "pages checked" endif if ( $errorCount > 0) then if ( $errorCount == 1) then - echo $errorCount "table with error(s) found" + echo $errorCount "page with error(s) found" else - echo $errorCount "tables with errors found" + echo $errorCount "pages with errors found" endif else echo "No errors found!" endif echo + +cleanup: +rm -f error$$ +rm -f error2$$