#!/bin/bash # # Analyze a given results directory for locktorture progress. # # Usage: kvm-recheck-lock.sh resdir # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # # Copyright (C) IBM Corporation, 2014 # # Authors: Paul E. McKenney global i := $1 if test -d $i { : } else { echo Unreadable results directory: $i exit 1 } global configfile := $[echo $i | sed -e 's/^.*\///] global ncs := $[grep "Writes: Total:" $i/console.log !2 > /dev/null | tail -1 | sed -e 's/^.* Total: //' -e 's/ .*$//] if test -z $ncs { echo "$configfile -------" } else { global title := ""$configfile ------- $ncs acquisitions/releases"" global dur := $[sed -e 's/^.* locktorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd !2 > /dev/null] if test -z $dur { : } else { global ncsps := $[awk -v ncs=$ncs -v dur=$dur ' BEGIN { print ncs / dur }' < /dev/null] global title := ""$title ($ncsps per second)"" } echo $title } (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(DQ ($ VSub_Number "$1"))} spids:[70])] spids: [70] ) (If arms: [ (if_arm cond: [(C {(test)} {(-d)} {($ VSub_Name "$i")})] action: [(C {(Lit_Other ":")})] spids: [-1 83] ) ] else_action: [ (C {(echo)} {(Unreadable)} {(results)} {(directory) (Lit_Other ":")} {($ VSub_Name "$i")}) (C {(exit)} {(1)}) ] spids: [88 107] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$i")}) (C {(sed)} {(-e)} {(SQ <"s/^.*\\///">)}) ] negated: False ) ] ) left_token: spids: [111 125] ) } spids: [110] ) ] spids: [110] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ncs) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (SimpleCommand words: [ {(grep)} {(DQ ("Writes: Total:"))} {($ VSub_Name "$i") (/console.log)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [138] ) ] ) (C {(tail)} {(-1)}) (C {(sed)} {(-e)} {(SQ <"s/^.* Total: //">)} {(-e)} {(SQ <"s/ .*$//">)}) ] negated: False ) ] ) left_token: spids: [128 163] ) } spids: [127] ) ] spids: [127] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$ncs"))})] action: [(C {(echo)} {(DQ ($ VSub_Name "$configfile") (" -------"))})] spids: [-1 175] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:title) op: Equal rhs: { (DQ ($ VSub_Name "$configfile") (" ------- ") ($ VSub_Name "$ncs") (" acquisitions/releases") ) } spids: [188] ) ] spids: [188] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dur) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(sed)} {(-e)} {(SQ <"s/^.* locktorture.shutdown_secs=//">)} {(-e)} {(SQ <"s/ .*$//">)} ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$i") (/qemu-cmd)} spids: [213] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [218] ) ] ) ] ) left_token: spids: [198 221] ) } spids: [197] ) ] spids: [197] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$dur"))})] action: [(C {(Lit_Other ":")})] spids: [-1 235] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ncsps) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(awk)} {(-v)} {(Lit_VarLike "ncs=") ($ VSub_Name "$ncs")} {(-v)} {(Lit_VarLike "dur=") ($ VSub_Name "$dur")} {(SQ <"\n"> <"\t\t\tBEGIN { print ncs / dur }">)} ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(/dev/null)} spids: [263] ) ] ) ] ) left_token: spids: [245 266] ) } spids: [244] ) ] spids: [244] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:title) op: Equal rhs: {(DQ ($ VSub_Name "$title") (" (") ($ VSub_Name "$ncsps") (" per second)"))} spids: [269] ) ] spids: [269] ) ] spids: [241 278] ) (C {(echo)} {($ VSub_Name "$title")}) ] spids: [185 285] ) ] )