Darryl L. Pierce
2009-May-19 21:34 UTC
[Ovirt-devel] [PATCH node-image] Fixing the autotest script.
The test_stateless_pxe_nohd test was broken. Fixed. Result code was not matching the success/failure state for the tests. Fixed. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- autotest.sh | 115 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 65 insertions(+), 50 deletions(-) diff --git a/autotest.sh b/autotest.sh index 12d3e30..e5e23a8 100755 --- a/autotest.sh +++ b/autotest.sh @@ -81,8 +81,7 @@ execute_test () { log "Completed test: $testname [result=$rc]" if [ $rc -ne 0 ]; then - log "Build fails smoke tests." - exit 1 + log "Build fails smoke tests." fi return $rc @@ -103,7 +102,7 @@ setup_pxeboot () { # set default kernel arguments if none were provided # the defaults boot in standalone mode if [ -z "$kernelargs" ]; then - kernelargs="ovirt_standalone" + kernelargs="standalone" fi local definition="DEFAULT pxeboot" @@ -133,18 +132,18 @@ start_dnsmasq () { stop_dnsmasq debug "Starting dnsmasq" dns_startup="sudo /usr/sbin/dnsmasq --read-ethers - --dhcp-range=${NETWORK}.100,${NETWORK}.254,255.255.255.0,24h - --conf-file- --interface=${iface} - --bind-interfaces - --except-interface=lo - --dhcp-boot=tftpboot/pxelinux.0 - --enable-tftp - --tftp-root=${tftproot} - --log-facility=/tmp/dnsmasq-${nodename}.log - --log-queries - --log-dhcp - --pid-file=${pidfile}" + --dhcp-range=${NETWORK}.100,${NETWORK}.254,255.255.255.0,24h + --conf-file+ --interface=${iface} + --bind-interfaces + --except-interface=lo + --dhcp-boot=tftpboot/pxelinux.0 + --enable-tftp + --tftp-root=${tftproot} + --log-facility=/tmp/dnsmasq-${nodename}.log + --log-queries + --log-dhcp + --pid-file=${pidfile}" if [ -n "$macaddress" ]; then dns_startup="${dns_startup} --dhcp-host=${macaddress},${NODE_ADDRESS}" fi @@ -407,8 +406,7 @@ tests=''; testcount=0; # $1 - test name add_test () { - tests[$testcount]=$1 - testcount=$testcount+1 + tests="${tests} $1" } # $1 - node name @@ -470,19 +468,20 @@ substitute_boot_device () { fi } -add_test "test_stateless_pxe_with_nohd" -test_stateless_pxe_with_nohd () { - local nodename="${vm_prefix}-stateless-pxe-nohd" +add_test "test_stateless_pxe" +test_stateless_pxe () { + local nodename="${vm_prefix}-stateless-pxe" local workdir=$(mktemp -d) start_networking $nodename $IFACE_NAME false true $workdir - configure_node "${nodename}" "network" "" "" "" "local noapic=true" - boot_with_pxe "${nodename}" "firstboot=no" "${workdir}" + configure_node "${nodename}" "network" "" "10000" "" "local noapic=true" + boot_with_pxe "${nodename}" "standalone firstboot=no" "${workdir}" expect -c ' set timeout 120 -log_file -noappend stateless-pxe-nohd.log + +log_file -noappend stateless-pxe.log spawn sudo virsh console '"${nodename}"' @@ -491,20 +490,18 @@ expect { -exact "Starting ovirt-early:" { send_log "\n\nMarker 2\n\n"; exp_continue } -exact "Starting ovirt:" { send_log "\n\nMarker 3\n\n"; exp_continue } -exact "Starting ovirt-post:" { send_log "\n\nMarker 4\n\n"; exp_continue } - -exact "login:" { send_log "\n\nMarker 5\n\n"; exit } + -re "localhost.*login:" { send_log "\n\nMarker 5\n\n"; exit } timeout { - send_log "\nMarker not found.\n\n" + send_log "\nTimeout waiting for marker..\n\n" exit 1 } eof { - send_log "Unexpected end of file." + send_log "Unexpected end of file." exit 2 } - - send_log \"\n\nUnexpected end of interaction.\n\n\" - exit 3 } -' +send_log "\n\nUnexpected end of interaction.\n\n" +exit 3' result=$? destroy_node $nodename @@ -513,14 +510,14 @@ expect { return $result } -add_test "test_stateless_pxe" -test_stateless_pxe () { - local nodename="${vm_prefix}-stateless-pxe" +add_test "test_stateless_pxe_with_nohd" +test_stateless_pxe_with_nohd () { + local nodename="${vm_prefix}-stateless-pxe-nohd" local workdir=$(mktemp -d) start_networking $nodename $IFACE_NAME false true $workdir - configure_node "${nodename}" "network" "" "10000" "" "local noapic=true" + configure_node "${nodename}" "network" "" "" "" "local noapic=true" boot_with_pxe "${nodename}" "firstboot=no" "${workdir}" expect -c ' @@ -537,16 +534,17 @@ expect { -exact "Starting ovirt-post:" { send_log "\n\nMarker 4\n\n"; exp_continue } -re "localhost.*login:" { send_log "\n\nMarker 5\n\n"; exit } timeout { - send_log "\nMarker not found.\n\n" - exit 1 + send_log "\nTimeout waiting for marker..\n\n" + exit 1 } eof { - send_log "Unexpected end of file." - exit 2 + send_log "Unexpected end of file." + exit 2 } } send_log "\n\nUnexpected end of interaction.\n\n" exit 3' + result=$? destroy_node $nodename @@ -568,7 +566,7 @@ test_stateful_pxe () { start_networking $nodename $IFACE_NAME false true $workdir configure_node "${nodename}" "network" "" "10000" "" "local noapic=true" - boot_with_pxe "${nodename}" "ovirt_standalone ovirt_init=/dev/vda ovirt_local_boot ip=${ipaddress}" ${workdir} + boot_with_pxe "${nodename}" "standalone storage_init=/dev/vda local_boot ip=${ipaddress}" ${workdir} # verify the booting and installation expect -c ' @@ -586,10 +584,10 @@ expect { -exact "Starting partitioning of /dev/vda" { send_log "\n\nMarker 6\n\n"; exp_continue } -exact "Restarting system" { send_log "\n\nMarker 7\n\n"; exit } timeout { - send_log "\nMarker not found.\n\n" + send_log "\nTimeout waiting for marker..\n\n" exit 1 } eof { - send_log "Unexpected end of file." + send_log "Unexpected end of file." exit 2 } } @@ -616,11 +614,11 @@ expect { -re "localhost.*login:" { send_log "\n\nLogin marker found\n\n"; exit } timeout { - send_log "\nMarker not found.\n\n" - exit 1 + send_log "\nMarker not found.\n\n" + exit 1 } eof { - send_log "Unexpected end of file." - exit 2 + send_log "Unexpected end of file." + exit 2 } } @@ -639,11 +637,11 @@ expect { -exact "64 bytes from '"${ipaddress}"'" { send_log "\n\nGot ping response!\n"; send_log "\n\nNetworking verified!\n"; exit } timeout { - send_log "\nMarker not found.\n\n" - exit 1 + send_log "\nMarker not found.\n\n" + exit 1 } eof { - send_log "Unexpected end of file." - exit 2 + send_log "Unexpected end of file." + exit 2 } } @@ -676,13 +674,15 @@ setup_for_testing () { # cleans up any loose ends cleanup_after_testing () { + debug "Cleaning up" stop_dnsmasq stop_networking # destroy any running vms vm_list=$(sudo virsh list --all | awk '/'${vm_prefix}-'/ { print $2 }') test -n "$vm_list" && for vm in $vm_list; do - destroy_node $vm + destroy_node $vm done + stop_networking } # check commandline options @@ -715,15 +715,30 @@ set +u if [ $# -gt 0 -a -n "$1" ]; then RESULTS=$1; else RESULTS=autotest.log; fi set -u +result_file=$(mktemp) +debug "result_file=${result_file}" + log "Logging results to file: ${RESULTS}" { setup_for_testing log "Begin Testing: ${isoname}" + log "Tests: ${tests}" for test in ${tests}; do execute_test $test + result=$? + + if [ $result != 0 ]; then + echo "${result}" > $result_file + break + fi done log "End Testing: ${isoname}" + } | sudo tee --append $RESULTS + +if [ -s "$result_file" ]; then + exit $(cat $result_file) +fi -- 1.6.0.6
Darryl L. Pierce
2009-May-22 12:26 UTC
[Ovirt-devel] Re: [PATCH node-image] Fixing the autotest script.
On Tue, May 19, 2009 at 05:34:07PM -0400, Darryl L. Pierce wrote:> The test_stateless_pxe_nohd test was broken. Fixed. > > Result code was not matching the success/failure state for the tests. > Fixed. > > Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> > ---If there are no objections, I'd like to push this. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ Is fearr Gaeilge bhriste n? B?arla cliste. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090522/2487b7e1/attachment.sig>
Seemingly Similar Threads
- [PATCH node] Update autobuild and autotest scripts for new build structure
- [PATCH node-image] Moved all temporary files into a single work directory to clean up.
- [PATCH] The autotest timeout is now a command line configurable option.
- [PATCH node-image] Removes the explicit setting of the emulator for testing.
- Unit Tests CMake configuration