diff options
-rwxr-xr-x | tests/flash.kermit | 6 | ||||
-rwxr-xr-x | tests/kwrapper | 11 | ||||
-rw-r--r-- | tests/libptxdisttest.kermit | 43 | ||||
-rwxr-xr-x | tests/setenv.kermit | 24 |
4 files changed, 39 insertions, 45 deletions
diff --git a/tests/flash.kermit b/tests/flash.kermit index c789c9090..e750afdc1 100755 --- a/tests/flash.kermit +++ b/tests/flash.kermit @@ -8,8 +8,8 @@ ptx_init \%2 ptx_uboot_enter_shell -ptx_uboot_exec_single "Flashing kernel" "run prg_kernel" 300 -ptx_uboot_exec_single "Flashing oftree" "run prg_oftree" 10 -#ptx_uboot_exec_single "Flashing jffs2" "run prg_jffs2" 600 +ptx_uboot_exec_single "Flashing kernel" 300 "run prg_kernel" +ptx_uboot_exec_single "Flashing oftree" 10 "run prg_oftree" +ptx_uboot_exec_single "Flashing jffs2" 600 "run prg_jffs2" ptx_exit diff --git a/tests/kwrapper b/tests/kwrapper index 6563d7117..8eb80cbd7 100755 --- a/tests/kwrapper +++ b/tests/kwrapper @@ -4,17 +4,18 @@ OURDIR="$(dirname $0)" KSCRIPT="${OURDIR}/$1.kermit" LIB="${OURDIR}/libptxdisttest.kermit" -if [ ! -e ${PTXDIST_WORKSPACE}/boardsetup/boardsetup ]; then +if [ ! -e "${PTXDIST_BOARDSETUP}" ]; then echo "Please run 'ptxdist boardsetup' first!" exit 1 fi -if [ ! -e $LIB ]; then +if [ ! -e "$LIB" ]; then echo "Could not find $LIB!" exit 1 fi +TMPFILE=$(mktemp -t ptxdist-kwrapper.XXXXXXXX) #we _must_ set the variables in kermit using 'define'! '.' has a bug there (patch already mainlined). -sed -e 's/^\(PTXCONF_BOARDSETUP_[A-Z0-9_]*\)=/define \1 /' ${PTXDIST_WORKSPACE}/boardsetup/boardsetup >/tmp/boardsetup.kermit - -$KSCRIPT ${LIB} /tmp/boardsetup.kermit $2 +sed -e 's/^\(PTXCONF_BOARDSETUP_[A-Z0-9_]*\)=/define \1 /' ${PTXDIST_BOARDSETUP} >$TMPFILE +$KSCRIPT ${LIB} $TMPFILE $2 +rm -f $TMPFILE diff --git a/tests/libptxdisttest.kermit b/tests/libptxdisttest.kermit index 6f9902fd7..bbcbbe3d0 100644 --- a/tests/libptxdisttest.kermit +++ b/tests/libptxdisttest.kermit @@ -22,11 +22,6 @@ define ptx_init { writeln ERROR "Please power on your board now!" writeln ERROR "===============================" writeln ERROR - - .uboot_version := 1 - .uboot_prompt := "uboot> " - .wait_time_default := 300 - } define ptx_exit { @@ -36,6 +31,7 @@ define ptx_exit { } define ptx_test_start { + #do padding with '.' write ERROR "\frpad(\%1,40,.)" } @@ -47,14 +43,9 @@ define ptx_test_end { define ptx_wait_string { - if def \%2 { - .wait_time := \%2 - } else { - .wait_time := \m(wait_time_default) - } - input \m(wait_time) \%1 + input \%1 \%2 if failure { - writeln ERROR "FAILED! (waiting for '\%1')" + writeln ERROR "FAILED! (waiting for '\%2')" exit 1 } } @@ -62,23 +53,23 @@ define ptx_wait_string { define ptx_uboot_enter_shell { ptx_test_start "Logging into U-Boot" - ptx_wait_string "U-Boot" 120 + minput 120 "U-Boot 1" "U-Boot 2" + if failure { + writeln ERROR "FAILED! (waiting for u-boot-signature)" + exit 1 + } lineout - ptx_wait_string \m(uboot_prompt) 10 + .uboot_version := \v(minput) + ptx_wait_string 10 "\m(PTXCONF_BOARDSETUP_UBOOTPROMPT)" ptx_test_end } define ptx_uboot_exec { - if def \%2 { - .wait_time := \%2 - } else { - .wait_time := \m(wait_time_default) - } - lineout "\%1" - input \m(wait_time) \m(uboot_prompt) + lineout "\%2" + input \%1 \m(PTXCONF_BOARDSETUP_UBOOTPROMPT) if failure { - writeln ERROR "FAILED! (timeout while waiting for shell prompt after \%1)" + writeln ERROR "FAILED! (timeout while waiting for u-boot prompt after \%2)" exit 1 } @@ -87,24 +78,24 @@ define ptx_uboot_exec { input 10 \fpattern(k-res:0$) if failure { - writeln ERROR "FAILED! (returncode from \%1 is not 0)" + writeln ERROR "FAILED! (returncode from \%2 is not 0)" exit 1 } - input 10 \m(uboot_prompt) + input 10 \m(PTXCONF_BOARDSETUP_UBOOTPROMPT) } } define ptx_uboot_exec_single { ptx_test_start "\%1" - ptx_uboot_exec "\%2" \%3 + ptx_uboot_exec "\%2" "\%3" ptx_test_end } define ptx_wait_string_single { ptx_test_start "\%1" - ptx_wait_string "\%2" \%3 + ptx_wait_string "\%2" "\%3" ptx_test_end } diff --git a/tests/setenv.kermit b/tests/setenv.kermit index eb02ccbab..effeb8f11 100755 --- a/tests/setenv.kermit +++ b/tests/setenv.kermit @@ -1,32 +1,34 @@ #!/usr/bin/kermit + -#Read the library +# Read the library take \%1 -#Set up the line +open read \%3 +if failure { + writeln ERROR "FAILED! Could not open \%3." + exit 1 +} + +# Set up the line ptx_init \%2 ptx_uboot_enter_shell ptx_test_start "Setting new environment" -ptx_uboot_exec "printenv" 10 -open read \%3 -if failure { - writeln ERROR "FAILED! Could not open \%3." - exit 1 -} +# Print out old environment (for debugging) +ptx_uboot_exec 10 "printenv" while true { read \%l if fail break - ptx_uboot_exec "\%l" 5 + ptx_uboot_exec 5 "\%l" } close read -ptx_uboot_exec "printenv" -#ptx_uboot_exec "saveenv" +ptx_uboot_exec 5 "printenv" +ptx_uboot_exec 10 "saveenv" ptx_test_end ptx_exit |