#!/bin/bash # # Run a kvm-based test of the specified tree on the specified configs. # Fully automated run and error checking, no graphics console. # # Execute this in the source tree. Do not run it as a background task # because qemu does not seem to like that much. # # Usage: kvm-test-1-run.sh config builddir resdir seconds qemu-args boot_args # # qemu-args defaults to "-enable-kvm -nographic", along with arguments # specifying the number of CPUs and other options # generated from the underlying CPU architecture. # boot_args defaults to value returned by the per_version_boot_params # shell function. # # Anything you specify for either qemu-args or boot_args is appended to # the default values. The "-smp" value is deduced from the contents of # the config fragment. # # More sophisticated argument parsing is clearly needed. # # 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, 2011 # # Authors: Paul E. McKenney global T := "/tmp/kvm-test-1-run.sh.$Pid" trap 'rm -rf $T' 0 touch $T source $KVM/bin/functions.sh source $CONFIGFRAG/ver_functions.sh global config_template := $(1) global config_dir := $[echo $config_template | sed -e 's,/[^/]*$,,] global title := $[echo $config_template | sed -e 's/^.*\///] global builddir := $(2) if test -z $builddir -o ! -d $builddir -o ! -w $builddir { echo "kvm-test-1-run.sh :$builddir: Not a writable directory, cannot build into it" exit 1 } global resdir := $(3) if test -z $resdir -o ! -d $resdir -o ! -w $resdir { echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot store results into it" exit 1 } cp $config_template $resdir/ConfigFragment echo ' ---' $[date]: Starting build echo ' ---' Kconfig fragment at: $config_template >> $resdir/log if test -r "$config_dir/CFcommon" { cat < $config_dir/CFcommon >> $T } # Optimizations below this point # CONFIG_USB=n # CONFIG_SECURITY=n # CONFIG_NFS_FS=n # CONFIG_SOUND=n # CONFIG_INPUT_JOYSTICK=n # CONFIG_INPUT_TABLET=n # CONFIG_INPUT_TOUCHSCREEN=n # CONFIG_INPUT_MISC=n # CONFIG_INPUT_MOUSE=n # # CONFIG_NET=n # disables console access, so accept the slower build. # CONFIG_SCSI=n # CONFIG_ATA=n # CONFIG_FAT_FS=n # CONFIG_MSDOS_FS=n # CONFIG_VFAT_FS=n # CONFIG_ISO9660_FS=n # CONFIG_QUOTA=n # CONFIG_HID=n # CONFIG_CRYPTO=n # CONFIG_PCCARD=n # CONFIG_PCMCIA=n # CONFIG_CARDBUS=n # CONFIG_YENTA=n global base_resdir := $[echo $resdir | sed -e 's/\.[0-9]\+$//] if test $base_resdir != $resdir -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux { # Rerunning previous test, so use that test's kernel. global QEMU := $[identify_qemu $base_resdir/vmlinux] global BOOT_IMAGE := $[identify_boot_image $QEMU] global KERNEL := "$base_resdir/$(BOOT_IMAGE##*/)" # use the last component of ${BOOT_IMAGE} ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh ln -s $base_resdir/.config $resdir # for kvm-recheck.sh } elif kvm-build.sh $config_template $builddir $T { # Had to build a kernel for this test. global QEMU := $[identify_qemu $builddir/vmlinux] global BOOT_IMAGE := $[identify_boot_image $QEMU] cp $builddir/Make*.out $resdir cp $builddir/vmlinux $resdir cp $builddir/.config $resdir if test -n $BOOT_IMAGE { cp $builddir/$BOOT_IMAGE $resdir global KERNEL := "$resdir/$(BOOT_IMAGE##*/)" } else { echo No identifiable boot image, not running KVM, see $resdir. echo Do the torture scripts know about your architecture? } parse-build.sh $resdir/Make.out $title } else { # Build failed. cp $builddir/Make*.out $resdir cp $builddir/.config $resdir || : echo Build failed, not running KVM, see $resdir. if test -f $builddir.wait { mv $builddir.wait $builddir.ready } exit 1 } if test -f $builddir.wait { mv $builddir.wait $builddir.ready } while test -f $builddir.ready { sleep 1 } global seconds := $4 global qemu_args := $5 global boot_args := $6 cd $KVM global kstarttime := $[awk 'BEGIN { print systime() }' < /dev/null] if test -z $TORTURE_BUILDONLY { echo ' ---' $[date]: Starting kernel } # Generate -smp qemu argument. global qemu_args := ""-enable-kvm -nographic $qemu_args"" global cpu_count := $[configNR_CPUS.sh $config_template] global cpu_count := $[configfrag_boot_cpus $boot_args $config_template $cpu_count] global vcpus := $[identify_qemu_vcpus] if test $cpu_count -gt $vcpus { echo CPU count limited from $cpu_count to $vcpus touch $resdir/Warnings echo CPU count limited from $cpu_count to $vcpus >> $resdir/Warnings global cpu_count := $vcpus } global qemu_args := $[specify_qemu_cpus $QEMU $qemu_args $cpu_count] # Generate architecture-specific and interaction-specific qemu arguments global qemu_args := ""$qemu_args $[identify_qemu_args $QEMU "$resdir/console.log]"" # Generate qemu -append arguments global qemu_append := $[identify_qemu_append $QEMU] # Pull in Kconfig-fragment boot parameters global boot_args := $[configfrag_boot_params $boot_args $config_template] # Generate kernel-version-specific boot parameters global boot_args := $[per_version_boot_params $boot_args $builddir/.config $seconds] if test -n $TORTURE_BUILDONLY { echo Build-only run specified, boot/test omitted. touch $resdir/buildonly exit 0 } echo "NOTE: $QEMU either did not run or was interactive" > $resdir/console.log echo $QEMU $qemu_args -m 512 -kernel $KERNEL -append '"'$qemu_append $boot_args'"' > $resdir/qemu-cmd shell { $QEMU $qemu_args -m 512 -kernel $KERNEL -append "$qemu_append $boot_args"& echo $BgPid > $resdir/qemu_pid; wait $[cat $resdir/qemu_pid]; echo $Status > $resdir/qemu-retval } & global commandcompleted := '0' sleep 10 # Give qemu's pid a chance to reach the file if test -s "$resdir/qemu_pid" { global qemu_pid := $[cat "$resdir/qemu_pid] echo Monitoring qemu job at pid $qemu_pid } else { global qemu_pid := ''"" echo Monitoring qemu job at yet-as-unknown pid } while : { if test -z $qemu_pid -a -s "$resdir/qemu_pid" { global qemu_pid := $[cat "$resdir/qemu_pid] } global kruntime := $[awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null] if test -z $qemu_pid || kill -0 $qemu_pid > /dev/null !2 > !1 { if test $kruntime -ge $seconds { break; } sleep 1 } else { global commandcompleted := '1' if test $kruntime -lt $seconds { echo Completed in $kruntime vs. $seconds >> $resdir/Warnings !2 > !1 grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> $resdir/Warnings !2 > !1 global killpid := $[sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdir/Warnings] if test -n $killpid { echo "ps -fp $killpid" >> $resdir/Warnings !2 > !1 ps -fp $killpid >> $resdir/Warnings !2 > !1 } } else { echo ' ---' $[date]: "Kernel done" } break } } if test -z $qemu_pid -a -s "$resdir/qemu_pid" { global qemu_pid := $[cat "$resdir/qemu_pid] } if test $commandcompleted -eq 0 -a -n $qemu_pid { echo Grace period for qemu job at pid $qemu_pid global oldline := $[tail $resdir/console.log] while : { global kruntime := $[awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null] if kill -0 $qemu_pid > /dev/null !2 > !1 { : } else { break } global must_continue := 'no' global newline := $[tail $resdir/console.log] if test $newline != $oldline && echo $newline | grep -q ' [0-9]\+us : ' { global must_continue := 'yes' } global last_ts := $[tail $resdir/console.log | grep '^\[ *[0-9]\+\.[0-9]\+]' | tail -1 | sed -e 's/^\[ *//' -e 's/\..*$//] if test -z "last_ts" { global last_ts := '0' } if test $newline != $oldline -a $last_ts -lt $(seconds + $TORTURE_SHUTDOWN_GRACE) { global must_continue := 'yes' } if test $must_continue = no -a $kruntime -ge $(seconds + $TORTURE_SHUTDOWN_GRACE) { echo "!!! PID $qemu_pid hung at $kruntime vs. $seconds seconds" >> $resdir/Warnings !2 > !1 kill -KILL $qemu_pid break } global oldline := $newline sleep 10 } } elif test -z $qemu_pid { echo Unknown PID, cannot kill qemu command } parse-torture.sh $resdir/console.log $title parse-console.sh $resdir/console.log $title (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:T) op: Equal rhs: {(/tmp/kvm-test-1-run.sh.) ($ VSub_Dollar "$$")} spids: [118] ) ] spids: [118] ) (C {(trap)} {(SQ <"rm -rf $T">)} {(0)}) (C {(touch)} {($ VSub_Name "$T")}) (C {(.)} {($ VSub_Name "$KVM") (/bin/functions.sh)}) (C {(.)} {($ VSub_Name "$CONFIGFRAG") (/ver_functions.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:config_template) op: Equal rhs: {(${ VSub_Number 1)} spids: [146] ) ] spids: [146] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:config_dir) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$config_template")}) (C {(sed)} {(-e)} {(SQ <"s,/[^/]*$,,">)}) ] negated: False ) ] ) left_token: spids: [152 166] ) } spids: [151] ) ] spids: [151] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:title) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$config_template")}) (C {(sed)} {(-e)} {(SQ <"s/^.*\\///">)}) ] negated: False ) ] ) left_token: spids: [169 183] ) } spids: [168] ) ] spids: [168] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:builddir) op:Equal rhs:{(${ VSub_Number 2)} spids:[185])] spids: [185] ) (If arms: [ (if_arm cond: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$builddir"))} {(-o)} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$builddir"))} {(-o)} {(KW_Bang "!")} {(-w)} {(DQ ($ VSub_Name "$builddir"))} ) ] action: [ (C {(echo)} { (DQ ("kvm-test-1-run.sh :") ($ VSub_Name "$builddir") (": Not a writable directory, cannot build into it") ) } ) (C {(exit)} {(1)}) ] spids: [-1 220] ) ] spids: [-1 236] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:resdir) op:Equal rhs:{(${ VSub_Number 3)} spids:[238])] spids: [238] ) (If arms: [ (if_arm cond: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$resdir"))} {(-o)} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$resdir"))} {(-o)} {(KW_Bang "!")} {(-w)} {(DQ ($ VSub_Name "$resdir"))} ) ] action: [ (C {(echo)} { (DQ ("kvm-test-1-run.sh :") ($ VSub_Name "$resdir") (": Not a writable directory, cannot store results into it") ) } ) (C {(exit)} {(1)}) ] spids: [-1 273] ) ] spids: [-1 289] ) (C {(cp)} {($ VSub_Name "$config_template")} {($ VSub_Name "$resdir") (/ConfigFragment)}) (C {(echo)} {(SQ <" ---">)} { (CommandSubPart command_list: (CommandList children:[(C {(date)})]) left_token: spids: [304 306] ) (Lit_Other ":") } {(Starting)} {(build)} ) (SimpleCommand words: [ {(echo)} {(SQ <" ---">)} {(Kconfig)} {(fragment)} {(at) (Lit_Other ":")} {($ VSub_Name "$config_template")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/log)} spids: [328] ) ] ) (If arms: [ (if_arm cond: [(C {(test)} {(-r)} {(DQ ($ VSub_Name "$config_dir") (/CFcommon))})] action: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$config_dir") (/CFcommon)} spids: [349] ) (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$T")} spids: [354] ) ] ) ] spids: [-1 344] ) ] spids: [-1 358] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:base_resdir) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$resdir")}) (C {(sed)} {(-e)} {(SQ <"s/\\.[0-9]\\+$//">)}) ] negated: False ) ] ) left_token: spids: [433 447] ) } spids: [432] ) ] spids: [432] ) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$base_resdir"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ ($ VSub_Name "$resdir"))} {(-a)} {(-f)} {($ VSub_Name "$base_resdir") (/bzImage)} {(-a)} {(-f)} {($ VSub_Name "$base_resdir") (/vmlinux)} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:QEMU) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(identify_qemu)} {($ VSub_Name "$base_resdir") (/vmlinux)}) ] ) left_token: spids: [487 492] ) ) } spids: [485] ) ] spids: [485] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BOOT_IMAGE) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(identify_boot_image)} {($ VSub_Name "$QEMU")})] ) left_token: spids: [498 502] ) ) } spids: [496] ) ] spids: [496] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KERNEL) op: Equal rhs: {($ VSub_Name "$base_resdir") (/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)}) spids: [509 514] ) } spids: [506] ) ] spids: [506] ) (C {(ln)} {(-s)} {($ VSub_Name "$base_resdir") (/Make) (Lit_Other "*") (.out)} {($ VSub_Name "$resdir")} ) (C {(ln)} {(-s)} {($ VSub_Name "$base_resdir") (/.config)} {($ VSub_Name "$resdir")}) ] spids: [-1 478] ) (if_arm cond: [ (C {(kvm-build.sh)} {($ VSub_Name "$config_template")} {($ VSub_Name "$builddir")} {($ VSub_Name "$T")} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:QEMU) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(identify_qemu)} {($ VSub_Name "$builddir") (/vmlinux)})] ) left_token: spids: [566 571] ) ) } spids: [564] ) ] spids: [564] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BOOT_IMAGE) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(identify_boot_image)} {($ VSub_Name "$QEMU")})] ) left_token: spids: [577 581] ) ) } spids: [575] ) ] spids: [575] ) (C {(cp)} {($ VSub_Name "$builddir") (/Make) (Lit_Other "*") (.out)} {($ VSub_Name "$resdir")} ) (C {(cp)} {($ VSub_Name "$builddir") (/vmlinux)} {($ VSub_Name "$resdir")}) (C {(cp)} {($ VSub_Name "$builddir") (/.config)} {($ VSub_Name "$resdir")}) (If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Name "$BOOT_IMAGE"))})] action: [ (C {(cp)} {($ VSub_Name "$builddir") (/) ($ VSub_Name "$BOOT_IMAGE")} {($ VSub_Name "$resdir")} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KERNEL) op: Equal rhs: {($ VSub_Name "$resdir") (/) (BracedVarSub token: suffix_op: (StringUnary op_id: VOp1_DPound arg_word: {("*") (Lit_Slash /)} ) spids: [637 642] ) } spids: [634] ) ] spids: [634] ) ] spids: [-1 622] ) ] else_action: [ (C {(echo)} {(No)} {(identifiable)} {(boot)} {(image) (Lit_Comma ",")} {(not)} {(running)} {(KVM) (Lit_Comma ",")} {(see)} {($ VSub_Name "$resdir") (.)} ) (C {(echo)} {(Do)} {(the)} {(torture)} {(scripts)} {(know)} {(about)} {(your)} {(architecture) (Lit_Other "?")} ) ] spids: [645 692] ) (C {(parse-build.sh)} {($ VSub_Name "$resdir") (/Make.out)} {($ VSub_Name "$title")}) ] spids: [547 557] ) ] else_action: [ (C {(cp)} {($ VSub_Name "$builddir") (/Make) (Lit_Other "*") (.out)} {($ VSub_Name "$resdir")}) (AndOr children: [ (C {(cp)} {($ VSub_Name "$builddir") (/.config)} {($ VSub_Name "$resdir")}) (C {(Lit_Other ":")}) ] op_id: Op_DPipe ) (C {(echo)} {(Build)} {(failed) (Lit_Comma ",")} {(not)} {(running)} {(KVM) (Lit_Comma ",")} {(see)} {($ VSub_Name "$resdir") (.)} ) (If arms: [ (if_arm cond: [(C {(test)} {(-f)} {($ VSub_Name "$builddir") (.wait)})] action: [ (C {(mv)} {($ VSub_Name "$builddir") (.wait)} {($ VSub_Name "$builddir") (.ready)}) ] spids: [-1 761] ) ] spids: [-1 773] ) (C {(exit)} {(1)}) ] spids: [702 780] ) (If arms: [ (if_arm cond: [(C {(test)} {(-f)} {($ VSub_Name "$builddir") (.wait)})] action: [(C {(mv)} {($ VSub_Name "$builddir") (.wait)} {($ VSub_Name "$builddir") (.ready)})] spids: [-1 791] ) ] spids: [-1 802] ) (While cond: [(C {(test)} {(-f)} {($ VSub_Name "$builddir") (.ready)})] body: (DoGroup children:[(C {(sleep)} {(1)})] spids:[813820]) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:seconds) op: Equal rhs: {($ VSub_Number "$4")} spids: [822] ) ] spids: [822] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_args) op: Equal rhs: {($ VSub_Number "$5")} spids: [825] ) ] spids: [825] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:boot_args) op: Equal rhs: {($ VSub_Number "$6")} spids: [828] ) ] spids: [828] ) (C {(cd)} {($ VSub_Name "$KVM")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kstarttime) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(awk)} {(SQ <"BEGIN { print systime() }">)}] redirects: [(Redir op_id:Redir_Less fd:-1 arg_word:{(/dev/null)} spids:[844])] ) ] ) left_token: spids: [837 847] ) } spids: [836] ) ] spids: [836] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$TORTURE_BUILDONLY"))})] action: [ (C {(echo)} {(SQ <" ---">)} { (CommandSubPart command_list: (CommandList children:[(C {(date)})]) left_token: spids: [868 870] ) (Lit_Other ":") } {(Starting)} {(kernel)} ) ] spids: [-1 859] ) ] spids: [-1 877] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_args) op: Equal rhs: {(DQ ("-enable-kvm -nographic ") ($ VSub_Name "$qemu_args"))} spids: [883] ) ] spids: [883] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cpu_count) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(configNR_CPUS.sh)} {($ VSub_Name "$config_template")})] ) left_token: spids: [890 894] ) } spids: [889] ) ] spids: [889] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cpu_count) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(configfrag_boot_cpus)} {(DQ ($ VSub_Name "$boot_args"))} {(DQ ($ VSub_Name "$config_template"))} {(DQ ($ VSub_Name "$cpu_count"))} ) ] ) left_token: spids: [897 911] ) } spids: [896] ) ] spids: [896] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:vcpus) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(identify_qemu_vcpus)})]) left_token: spids: [914 916] ) } spids: [913] ) ] spids: [913] ) (If arms: [ (if_arm cond: [(C {(test)} {($ VSub_Name "$cpu_count")} {(-gt)} {($ VSub_Name "$vcpus")})] action: [ (C {(echo)} {(CPU)} {(count)} {(limited)} {(from)} {($ VSub_Name "$cpu_count")} {(to)} {($ VSub_Name "$vcpus")} ) (C {(touch)} {($ VSub_Name "$resdir") (/Warnings)}) (SimpleCommand words: [ {(echo)} {(CPU)} {(count)} {(limited)} {(from)} {($ VSub_Name "$cpu_count")} {(to)} {($ VSub_Name "$vcpus")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/Warnings)} spids: [970] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cpu_count) op: Equal rhs: {($ VSub_Name "$vcpus")} spids: [976] ) ] spids: [976] ) ] spids: [-1 928] ) ] spids: [-1 979] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_args) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(specify_qemu_cpus)} {(DQ ($ VSub_Name "$QEMU"))} {(DQ ($ VSub_Name "$qemu_args"))} {(DQ ($ VSub_Name "$cpu_count"))} ) ] ) left_token: spids: [983 997] ) ) } spids: [981] ) ] spids: [981] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_args) op: Equal rhs: { (DQ ($ VSub_Name "$qemu_args") (" ") (CommandSubPart command_list: (CommandList children: [ (C {(identify_qemu_args)} {(DQ ($ VSub_Name "$QEMU"))} {(DQ ($ VSub_Name "$resdir") (/console.log))} ) ] ) left_token: spids: [1008 1019] ) ) } spids: [1004] ) ] spids: [1004] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_append) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(identify_qemu_append)} {(DQ ($ VSub_Name "$QEMU"))})] ) left_token: spids: [1028 1034] ) ) } spids: [1026] ) ] spids: [1026] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:boot_args) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(configfrag_boot_params)} {(DQ ($ VSub_Name "$boot_args"))} {(DQ ($ VSub_Name "$config_template"))} ) ] ) left_token: spids: [1043 1053] ) ) } spids: [1041] ) ] spids: [1041] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:boot_args) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(per_version_boot_params)} {(DQ ($ VSub_Name "$boot_args"))} {($ VSub_Name "$builddir") (/.config)} {($ VSub_Name "$seconds")} ) ] ) left_token: spids: [1061 1072] ) ) } spids: [1059] ) ] spids: [1059] ) (If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Name "$TORTURE_BUILDONLY"))})] action: [ (C {(echo)} {(Build-only)} {(run)} {(specified) (Lit_Comma ",")} {(boot/test)} {(omitted.)}) (C {(touch)} {($ VSub_Name "$resdir") (/buildonly)}) (C {(exit)} {(0)}) ] spids: [-1 1086] ) ] spids: [-1 1113] ) (SimpleCommand words: [ {(echo)} {(DQ ("NOTE: ") ($ VSub_Name "$QEMU") (" either did not run or was interactive"))} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$resdir") (/console.log)} spids: [1123] ) ] ) (SimpleCommand words: [ {(echo)} {($ VSub_Name "$QEMU")} {($ VSub_Name "$qemu_args")} {(-m)} {(512)} {(-kernel)} {($ VSub_Name "$KERNEL")} {(-append)} {(EscapedLiteralPart token:) ($ VSub_Name "$qemu_append")} {($ VSub_Name "$boot_args") (EscapedLiteralPart token:)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$resdir") (/qemu-cmd)} spids: [1150] ) ] ) (Sentence child: (Subshell child: (CommandList children: [ (Sentence child: (C {($ VSub_Name "$QEMU")} {($ VSub_Name "$qemu_args")} {(-m)} {(512)} {(-kernel)} {($ VSub_Name "$KERNEL")} {(-append)} {(DQ ($ VSub_Name "$qemu_append") (" ") ($ VSub_Name "$boot_args"))} ) terminator: ) (Sentence child: (SimpleCommand words: [{(echo)} {($ VSub_Bang "$!")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$resdir") (/qemu_pid)} spids: [1182] ) ] ) terminator: ) (Sentence child: (C {(wait)} { (CommandSubPart command_list: (CommandList children: [(C {(cat)} {($ VSub_Name "$resdir") (/qemu_pid)})] ) left_token: spids: [1190 1195] ) } ) terminator: ) (SimpleCommand words: [{(echo)} {($ VSub_QMark "$?")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$resdir") (/qemu-retval)} spids: [1202] ) ] ) ] ) spids: [1155 1207] ) terminator: ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:commandcompleted) op:Equal rhs:{(0)} spids:[1211])] spids: [1211] ) (C {(sleep)} {(10)}) (If arms: [ (if_arm cond: [(C {(test)} {(-s)} {(DQ ($ VSub_Name "$resdir") (/qemu_pid))})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_pid) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(cat)} {(DQ ($ VSub_Name "$resdir") (/qemu_pid))})] ) left_token: spids: [1236 1243] ) } spids: [1235] ) ] spids: [1235] ) (C {(echo)} {(Monitoring)} {(qemu)} {(job)} {(at)} {(pid)} {($ VSub_Name "$qemu_pid")}) ] spids: [-1 1232] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:qemu_pid) op:Equal rhs:{(DQ )} spids:[1263])] spids: [1263] ) (C {(echo)} {(Monitoring)} {(qemu)} {(job)} {(at)} {(yet-as-unknown)} {(pid)}) ] spids: [1260 1282] ) (While cond: [(C {(Lit_Other ":")})] body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$qemu_pid"))} {(-a)} {(-s)} {(DQ ($ VSub_Name "$resdir") (/qemu_pid))} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_pid) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(cat)} {(DQ ($ VSub_Name "$resdir") (/qemu_pid))})] ) left_token: spids: [1315 1322] ) } spids: [1314] ) ] spids: [1314] ) ] spids: [-1 1311] ) ] spids: [-1 1325] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kruntime) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(awk)} {(SQ <"BEGIN { print systime() - ">) (DQ ($ VSub_Name "$kstarttime")) (SQ <" }">) } ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(/dev/null)} spids: [1342] ) ] ) ] ) left_token: spids: [1329 1345] ) } spids: [1328] ) ] spids: [1328] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$qemu_pid"))}) (SimpleCommand words: [{(kill)} {(-0)} {(DQ ($ VSub_Name "$qemu_pid"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1368] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1372] ) ] ) ] op_id: Op_DPipe ) ] action: [ (If arms: [ (if_arm cond: [ (C {(test)} {($ VSub_Name "$kruntime")} {(-ge)} {($ VSub_Name "$seconds")}) ] action: [ (Sentence child: (ControlFlow token:) terminator: ) ] spids: [-1 1390] ) ] spids: [-1 1397] ) (C {(sleep)} {(1)}) ] spids: [-1 1376] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commandcompleted) op: Equal rhs: {(1)} spids: [1408] ) ] spids: [1408] ) (If arms: [ (if_arm cond: [ (C {(test)} {($ VSub_Name "$kruntime")} {(-lt)} {($ VSub_Name "$seconds")}) ] action: [ (SimpleCommand words: [ {(echo)} {(Completed)} {(KW_In in)} {($ VSub_Name "$kruntime")} {(vs.)} {($ VSub_Name "$seconds")} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/Warnings)} spids: [1438] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1443] ) ] ) (SimpleCommand words: [ {(grep)} {(DQ ("^(qemu) qemu:"))} {($ VSub_Name "$resdir") (/kvm-test-1-run.sh.out)} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/Warnings)} spids: [1456] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1461] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:killpid) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(sed)} {(-n)} { (DQ ( "s/^(qemu) qemu: terminating on signal [0-9]* from pid " ) (EscapedLiteralPart token:) ("[0-9]*") (EscapedLiteralPart token: ) (".*") (Lit_Other "$") (/) (EscapedLiteralPart token:) (/p) ) } {($ VSub_Name "$resdir") (/Warnings)} ) ] ) left_token: spids: [1467 1486] ) ) } spids: [1465] ) ] spids: [1465] ) (If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Name "$killpid"))})] action: [ (SimpleCommand words: [{(echo)} {(DQ ("ps -fp ") ($ VSub_Name "$killpid"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/Warnings)} spids: [1511] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1516] ) ] ) (SimpleCommand words: [{(ps)} {(-fp)} {($ VSub_Name "$killpid")}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/Warnings)} spids: [1526] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1531] ) ] ) ] spids: [-1 1501] ) ] spids: [-1 1535] ) ] spids: [-1 1423] ) ] else_action: [ (C {(echo)} {(SQ <" ---">)} { (CommandSubPart command_list: (CommandList children:[(C {(date)})]) left_token: spids: [1547 1549] ) (Lit_Other ":") } {(DQ ("Kernel done"))} ) ] spids: [1538 1557] ) (ControlFlow token:) ] spids: [1405 1563] ) ] spids: [1288 1565] ) ) (If arms: [ (if_arm cond: [ (C {(test)} {(-z)} {(DQ ($ VSub_Name "$qemu_pid"))} {(-a)} {(-s)} {(DQ ($ VSub_Name "$resdir") (/qemu_pid))} ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:qemu_pid) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(cat)} {(DQ ($ VSub_Name "$resdir") (/qemu_pid))})] ) left_token: spids: [1590 1597] ) } spids: [1589] ) ] spids: [1589] ) ] spids: [-1 1586] ) ] spids: [-1 1599] ) (If arms: [ (if_arm cond: [ (C {(test)} {($ VSub_Name "$commandcompleted")} {(-eq)} {(0)} {(-a)} {(-n)} {(DQ ($ VSub_Name "$qemu_pid"))} ) ] action: [ (C {(echo)} {(Grace)} {(period)} {(KW_For for)} {(qemu)} {(job)} {(at)} {(pid)} {($ VSub_Name "$qemu_pid")} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:oldline) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(tail)} {($ VSub_Name "$resdir") (/console.log)})] ) left_token: spids: [1643 1648] ) ) } spids: [1641] ) ] spids: [1641] ) (While cond: [(C {(Lit_Other ":")})] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:kruntime) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(awk)} {(SQ <"BEGIN { print systime() - ">) (DQ ($ VSub_Name "$kstarttime")) (SQ <" }">) } ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(/dev/null)} spids: [1674] ) ] ) ] ) left_token: spids: [1661 1677] ) } spids: [1660] ) ] spids: [1660] ) (If arms: [ (if_arm cond: [ (SimpleCommand words: [{(kill)} {(-0)} {($ VSub_Name "$qemu_pid")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1688] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1692] ) ] ) ] action: [(C {(Lit_Other ":")})] spids: [-1 1696] ) ] else_action: [(ControlFlow token:)] spids: [1702 1708] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:must_continue) op: Equal rhs: {(no)} spids: [1711] ) ] spids: [1711] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:newline) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(tail)} {($ VSub_Name "$resdir") (/console.log)})] ) left_token: spids: [1717 1722] ) ) } spids: [1715] ) ] spids: [1715] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {(DQ ($ VSub_Name "$newline"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ ($ VSub_Name "$oldline"))} ) (Pipeline children: [ (C {(echo)} {($ VSub_Name "$newline")}) (C {(grep)} {(-q)} {(SQ <" [0-9]\\+us : ">)}) ] negated: False ) ] op_id: Op_DAmp ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:must_continue) op: Equal rhs: {(yes)} spids: [1761] ) ] spids: [1761] ) ] spids: [-1 1758] ) ] spids: [-1 1765] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:last_ts) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(tail)} {($ VSub_Name "$resdir") (/console.log)}) (C {(grep)} {(SQ <"^\\[ *[0-9]\\+\\.[0-9]\\+]">)}) (C {(tail)} {(-1)}) (C {(sed)} {(-e)} {(SQ <"s/^\\[ *//">)} {(-e)} {(SQ <"s/\\..*$//">)} ) ] negated: False ) ] ) left_token: spids: [1770 1805] ) ) } spids: [1768] ) ] spids: [1768] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ (last_ts))})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:last_ts) op: Equal rhs: {(0)} spids: [1823] ) ] spids: [1823] ) ] spids: [-1 1820] ) ] spids: [-1 1827] ) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$newline"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ ($ VSub_Name "$oldline"))} {(-a)} {(DQ ($ VSub_Name "$last_ts"))} {(-lt)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithVarRef name:seconds) right: (ArithWord w:{($ VSub_Name "$TORTURE_SHUTDOWN_GRACE")}) ) spids: [1853 1860] ) } ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:must_continue) op: Equal rhs: {(yes)} spids: [1866] ) ] spids: [1866] ) ] spids: [-1 1863] ) ] spids: [-1 1870] ) (If arms: [ (if_arm cond: [ (C {(test)} {($ VSub_Name "$must_continue")} {(Lit_Other "=")} {(no)} {(-a)} {($ VSub_Name "$kruntime")} {(-ge)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithVarRef name:seconds) right: (ArithWord w:{($ VSub_Name "$TORTURE_SHUTDOWN_GRACE")}) ) spids: [1889 1896] ) } ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("!!! PID ") ($ VSub_Name "$qemu_pid") (" hung at ") ($ VSub_Name "$kruntime") (" vs. ") ($ VSub_Name "$seconds") (" seconds") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {($ VSub_Name "$resdir") (/Warnings)} spids: [1914] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [1919] ) ] ) (C {(kill)} {(-KILL)} {($ VSub_Name "$qemu_pid")}) (ControlFlow token:) ] spids: [-1 1899] ) ] spids: [-1 1933] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:oldline) op: Equal rhs: {($ VSub_Name "$newline")} spids: [1936] ) ] spids: [1936] ) (C {(sleep)} {(10)}) ] spids: [1657 1945] ) ) ] spids: [-1 1619] ) (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$qemu_pid"))})] action: [ (C {(echo)} {(Unknown)} {(PID) (Lit_Comma ",")} {(cannot)} {(kill)} {(qemu)} {(command)}) ] spids: [1947 1957] ) ] spids: [-1 1975] ) (C {(parse-torture.sh)} {($ VSub_Name "$resdir") (/console.log)} {($ VSub_Name "$title")}) (C {(parse-console.sh)} {($ VSub_Name "$resdir") (/console.log)} {($ VSub_Name "$title")}) ] )