SF.net SVN: morphix: [2543] trunk/mmaker/utils/auto-testing

[email protected] Sat, 28 Jul 2007 00:22:25 -0700
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2543
          http://morphix.svn.sourceforge.net/morphix/?rev=2543&view=rev
Author:   bmsleight
Date:     2007-07-28 00:22:24 -0700 (Sat, 28 Jul 2007)

Log Message:
-----------
Working in progress

Added Paths:
-----------
    trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh

Removed Paths:
-------------
    trunk/mmaker/utils/auto-testing/auto_testing.webconverger.sh

Deleted: trunk/mmaker/utils/auto-testing/auto_testing.webconverger.sh
===================================================================
--- trunk/mmaker/utils/auto-testing/auto_testing.webconverger.sh	2007-07-16 21:41:27 UTC (rev 2542)
+++ trunk/mmaker/utils/auto-testing/auto_testing.webconverger.sh	2007-07-28 07:22:24 UTC (rev 2543)
@@ -1,128 +0,0 @@
-#!/bin/bash
-#
-# Copyleft (c) 2006 Brendan M. Sleight                    #
-#              <bmsleight@barwap._REMOVE_SPAM_TRAP.com>   # 
-#                                                         #
-# This script is licensed under the GNU GPL v2 or later.  #
-#                                                         #
-# On Debian systems, this license can be obtained via     #
-# /usr/share/common-licenses/GPL                          #
-#
-LOGO=/home/morph/images/webconverger.jpg
-MINILOGO=/home/morph/images/webconverger.jpg
-TODAY=$(date +"%F")  
-ISO=$1
-VIDEO=$2
-COMMENTS=$4
-if [ -z "$ISO" -a -z "$VIDEO" ]; then
-    echo "Usage: $0 ISO output.avi [Num capture frames] [comments]"
-    echo
-    echo "e.g. $0 Morphing-Morphix.iso Morphing-Morphix.avi  "
-    echo "e.g. $0 Morphing-Morphix.iso Morphing-Morphix.avi 800 "
-    echo "e.g. $0 Morphing-Morphix.iso Morphing-Morphix.avi 1000 \"D/load on 2006-01-01\" "
-    echo
-    echo "This script tests a Webconverger ISO using qemu "
-    echo " and then generates a video"
-    echo
-    exit
-fi
-
-if [ -z "$3" ]; then
-    FRAMES=480
-  else 
-    FRAMES=$(expr $3 + 16)
-fi
-
-TMP_D=/tmp/dump/
-DUMPS=$TMP_D/dump
-mkdir $TMP_D 		2>/dev/null
-
-qemu -vnc :1 -no-kqemu -full-screen -pidfile $TMP_D/qemu.pid  -cdrom $ISO &
-sleep 2
-vncviewer -encodings raw -fullscreen -viewonly 127.0.0.1:1 &
-l=16
-while [ $l -lt $FRAMES ]
-do
-  if [ "$l" -lt "10" ]
-  then
-    convert=$DUMPS'00'$l'.miff'
-  elif [ "$l" -lt "100" ]
-  then
-    convert=$DUMPS'0'$l'.miff'
-      if [ "$l" -eq "22" ]
-      then
-        # vncviewer does not like the jump from grub resolution to 800x600
-	# so we (very ugly) start a new vncview.	
-        killall vncviewer
-	vncviewer -encodings raw  -fullscreen -viewonly 127.0.0.1:1 &
-      fi
-  else
-    convert=$DUMPS$l'.miff'
-  fi
- import -display :0 -window root $convert
-# sleep 0.5
- l=$(expr $l + 1)
- echo "Frame " $convert " at " $(date +"%F_%H:%M:%S.%N")
-done
-
-kill_pid=$(cat $TMP_D/qemu.pid)
-kill $kill_pid
-rm $TMP_D/qemu.pid
-
-# Make minilog for top corner.
-# This ensures that there is no completely back jpg with no info 
-#  as mencode seg faults if a jpg is completly empty
-# Hey - it also looks pretty :)
-convert $MINILOGO -resize 200x200 -negate  -gravity South   -background Black -font Helvetica-Bold -fill white -splice 0x36 -pointsize 35 -draw "text 0,0 'AutoTesting'" -transparent black $TMP_D/minilogo.gif
-convert $TMP_D/minilogo.gif  -fill grey50 -colorize 40 $TMP_D/minilogo.gif
-l=16
-while [ $l -lt $FRAMES ]
-do
-  if [ "$l" -lt "10" ]
-  then
-    convert=$DUMPS'00'$l'.miff'
-  elif [ "$l" -lt "100" ]
-  then
-    convert=$DUMPS'0'$l'.miff'
-  else
-    convert=$DUMPS$l'.miff'
-  fi
-  
- echo "Converting $convert -> $convert.jpg"
-# convert $convert -resize 800x600 $convert.jpg
-#
- convert $convert -resize 800x600 $convert.jpg 
- composite -dissolve 15 -gravity northeast $TMP_D/minilogo.gif $convert.jpg $convert.jpg
- rm $convert
- l=$(expr $l + 1)
-done
-
-# Create the intro to the video
-title="Autotesting using Qemu"
-text=" $ISO - General Comments \n \n $COMMENTS"
-FOLD_TEXT=$(echo "$text" |  fold -s -w 100 )
-convert $LOGO -resize 200 /tmp/logo.jpg
-convert -size 600x440 xc:white -pointsize 25 -fill darkblue  -annotate 0x0+250+75 "$title" -pointsize 10 -fill blue  -annotate 0x0+50+200 "$FOLD_TEXT" -append /tmp/logo.jpg -bordercolor darkblue -border 20x20 -flatten "$DUMPS"0.jpg
-convert "$DUMPS"0.jpg -resize 800x600 "$DUMPS"1.jpg
-mv "$DUMPS"1.jpg "$DUMPS"0.jpg
-l=1
-while [ $l -lt 16 ]
-do
-   if [ "$l" -lt "10" ]
-  then
-    convert=$DUMPS'00'$l'.miff.jpg'
-  elif [ "$l" -lt "100" ]
-  then
-    convert=$DUMPS'0'$l'.miff.jpg'
-  else
-    convert=$DUMPS$l'.miff.jpg'
-  fi
- composite -dissolve 15 -gravity northeast $TMP_D/minilogo.gif "$DUMPS"0.jpg $convert
- l=$(expr $l + 1)
-done
-
-mencoder mf://$TMP_D*.jpg -mf w=800:h=600:fps=4:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o $VIDEO
-ffmpeg2theora $VIDEO --artist "AutoTesting" --title "$VIDEO $COMMENTS"  --organization "www.morphix.org" --copyright "copyleft" --date "$TODAY"
-rm $VIDEO
-rm $TMP_D -r
-rm /tmp/logo.jpg

Added: trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh
===================================================================
--- trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh	                        (rev 0)
+++ trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh	2007-07-28 07:22:24 UTC (rev 2543)
@@ -0,0 +1,145 @@
+#!/bin/bash
+get_global_variables ()
+{
+PASSWD="$RANDOM.$RANDOM.$RANDOM.$RANDOM.$RANDOM"
+HOSTNAME=$(hostname)
+OLD_DISPLAY="$DISPLAY"
+TMP_DIR=/tmp/vqbi.$$.tmp
+IPADDRESS=$(sudo ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
+
+ISO="/home/morph/webconverger/debian-live-sid-i386-gnome-desktop.iso"
+SENDKEYS="spc,l,i,v,e,spc,kp_enter"
+QEMU_MONITOR_PORT=4444
+GEOMETRY="1280x960"
+CONVERT_DIM="800x600"
+MCODER_DIM="w=800:h=600"
+VIDEO="/tmp/qemu.avi"
+TIME_Q="6"
+VNCREC_MOVIE_FRAMERATE=1
+}
+
+set_up_workspace ()
+{
+mkdir $TMP_DIR 2>/dev/null
+rm ~/.vnc/passwd
+
+cat<<EOF > ~/.vnc/xstartup
+#!/bin/sh
+xsetroot -solid grey
+EOF
+chmod 755 ~/.vnc/xstartup
+
+cat<<EOF > $TMP_DIR/vnc.exp
+spawn vncpasswd
+expect "Password:" { send "$PASSWD\r" }
+expect "Verify:" { send "$PASSWD\r" }
+interact
+puts "\nVNC Password changed\n"
+EOF
+
+expect $TMP_DIR/vnc.exp >/dev/null 2>/dev/null
+echo "VNC Password changed"
+}
+
+start_vnc_sessions ()
+{
+vncserver -nocursor -geometry $GEOMETRY >$TMP_DIR/vncserver.txt 2>&1
+VNSERVER_QEMU=$(cat $TMP_DIR/vncserver.txt | grep 'New' | awk '{ print $5}' )
+VNCSERVER_QMEU_NUMBER=$(cat $TMP_DIR/vncserver.txt | grep 'New' | cut -d: -f2)
+echo "Launched vncserver $VNSERVER_QEMU"
+vncserver -nocursor -geometry 1600x1200 >$TMP_DIR/vncserver.txt 2>&1
+VNSERVER_VNCREC=$(cat $TMP_DIR/vncserver.txt | grep 'New' | awk '{ print $5}' )
+VNCSERVER_VNCREC_NUMBER=$(cat $TMP_DIR/vncserver.txt | grep 'New' | cut -d: -f2)
+echo "Launched vncserver $VNSERVER_VNCREC"
+}
+
+start_vnc_record ()
+{
+#export DISPLAY="$VNSERVER_VNCREC"	
+rm /tmp/qemu.1.vnc
+export VNCREC_MOVIE_FRAMERATE
+echo "Starting vncrec, recording :$VNCSERVER_QMEU_NUMBER. Local display :$VNCSERVER_VNCREC_NUMBER"
+vncrec -display :$VNCSERVER_VNCREC_NUMBER -passwd ~/.vnc/passwd -shared -viewonly -encoding raw -record $TMP_DIR/qemu.1.vnc :$VNCSERVER_QMEU_NUMBER &
+}
+
+start_qemu ()
+{
+export DISPLAY=$VNSERVER_QEMU
+echo "Starting qemu, within Dispaly $VNSERVER_QEMU"
+qemu_0.8.4-etch1 -no-kqemu -full-screen  -cdrom $ISO -monitor telnet:$IPADDRESS:$QEMU_MONITOR_PORT,server,nowait &
+sleep 10
+i=1
+REACHED_LAST_KB=""
+while [ -z $REACHED_LAST_KB ]
+do
+ KEY=$(echo $SENDKEYS | cut -d, -f$i)
+ if [ "$KEY" != "" ]
+ then
+  echo "sendkey $KEY" | socat - TCP4:$IPADDRESS:$QEMU_MONITOR_PORT
+ else
+  REACHED_LAST_KB="Y"
+ fi
+ let i=i+1
+done
+sleep 3
+}
+
+let_qemu_run ()
+{
+echo "Sleeping for $TIME_Q seconds whilst qemu runs"  
+sleep $TIME_Q
+}
+
+stop_qemu ()
+{
+echo "Stopping vncrec and qemu"  
+killall vncrec
+killall qemu_0.8.4-etch1
+}
+
+stop_vncservers ()
+{
+echo "Stopping vncservers"  
+vncserver -kill :$VNCSERVER_QMEU_NUMBER
+vncserver -kill :$VNCSERVER_VNCREC_NUMBER
+}
+
+
+export_frames ()
+{
+VNCREC_MOVIE_CMD='convert xpm:-  '$TMP_DIR'/image-%05d.jpg'
+export VNCREC_MOVIE_CMD
+#vncrec  -movie $TMP_DIR/qemu.1.vnc 1>/dev/null 2>&1
+vncrec  -movie $TMP_DIR/qemu.1.vnc
+for i in $TMP_DIR/image-*.jpg
+do
+ convert $i -resize $CONVERT_DIM $i 
+ echo "Resized $i"
+done
+echo "Finished making Frames"
+}
+
+
+make_video ()
+{
+mencoder mf://$TMP_DIR/*.jpg -mf $MCODER_DIM:fps=4:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o $VIDEO
+}
+
+clean_up ()
+{
+DISPLAY="$OLD_DISPLAY"
+export DISPLAY="$OLD_DISPLAY"
+#rm $TMP_DIR -r
+}
+
+get_global_variables
+set_up_workspace
+start_vnc_sessions
+start_vnc_record
+start_qemu
+let_qemu_run
+stop_qemu
+export_frames
+make_video
+stop_vncservers
+clean_up


Property changes on: trunk/mmaker/utils/auto-testing/video-qemu-booting-iso.sh
___________________________________________________________________
Name: svn:executable
   + *


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/