source: branches/stable/tools/test2qemu @ 1334

Last change on this file since 1334 was 1334, checked in by bruno, 12 years ago
  • Add a test env (local for laptop + QEMU based)
  • creates qemu-env for reuse of code
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5# Script to test packages on various distributions with qemu
6#
7
8# Syntax: test2qemu [[vm1]..[vmx]]
9
10(
11dname=`dirname $0`
12prem=`echo $dname |cut -c1`
13if [ _${prem} = _"/" ]; then
14    export TOOLHOME=$dname
15else
16    export TOOLHOME=${PWD}/$dname
17fi
18
19. $TOOLHOME/common-env
20. $TOOLHOME/distro-env
21. $TOOLHOME/qemu-env
22
23if [ _"$1" = _"" ]; then
24    export VMS=`cat ${TOOLHOME}/DISTROS` 
25    single=0
26else
27    export VMS="$*"
28    single=1
29fi
30
31for m in $VMS; do
32    echo "Working on $m"
33    vmp=0
34    if [ ! -f /users/qemu/pxe.qemu ]; then
35            echo "VM pxe unaccessible. Verify NFS mount"
36            rm -rf $MONDOTMP
37            exit -1
38    fi
39    ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/pxe-$m.qemu
40    if [ $? -ne 0 ]; then
41        # Virtual machine not alreday started
42        vmp=1
43        sudo mkdir -p /pub/users/svg/mnt
44        sudo mount -o loop /pub/users/svg/mondo/images/test-mondo-$m /pub/users/svg/mnt
45        cp -a /pub/users/svg/mnt/vmlinuz /users/qemu/pxe/$m
46        cp -a /pub/users/svg/mnt/initrd.img /users/qemu/pxe/$m.img
47        sudo umount /pub/users/svg/mnt
48        cp /users/qemu/pxe.qemu /users/qemu/pxe-$m.qemu
49        export QEMUOPT="-kernel /users/qemu/pxe/$m -initrd /users/qemu/pxe/$m.img -append 'load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=65536 rw root=/dev/ram iso_mode pxe prefix=test-mondo-$m ipconf=eth0:dhcp nfsmount=flecha.home.musique-ancienne.org:/users/svg/mondo/images'"
50        # ramdisk_blocksize=1024
51        $TOOLHOME/mkqemu pxe-$m &
52        sleep 300
53    fi
54    ssh -q -p $sp bruno@localhost "cd / ; rm -rf ~bruno/mondo ~bruno/RPMS/BUILD/* ~bruno/RPMS/tmp/* /tmp/* ; tar xfz ~bruno/test-mondo.tar.gz ; $MONDOTMP/test-mondo " | tee $MONDOTMP/mkvm.log
55    if [ $vmp -eq 1 ]; then
56        ssh -q -p $sp root@localhost "halt -p"
57        sleep 300
58        proces=`ps auxww | grep qemu | grep -v grep | grep /users/qemu/$m.qemu | awk '{print $2}'`
59        if [ "$proces" != "" ]; then
60            kill $proces
61            sleep 10
62        fi
63    fi
64done
65
66# Should be removed at the end
67rm -rf $MONDOTMP
68) 2>&1 | tee /tmp/test2qemu.log
Note: See TracBrowser for help on using the repository browser.