source: branches/stable/tools/test2qemu @ 3656

Last change on this file since 3656 was 1340, checked in by Bruno Cornec, 13 years ago

Merging modifs from 2.2.2 on tools

  • Property svn:executable set to *
File size: 1.8 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-1.iso /pub/users/svg/mnt
45        sudo cp -a /pub/users/svg/mnt/vmlinuz /users/qemu/pxe/$m
46        sudo 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        set -x
50        export QEMUOPT="-kernel /users/qemu/pxe/$m -initrd /users/qemu/pxe/$m.img"
51        export QEMUAPP="load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=65536 rw root=/dev/ram iso_mode nuke pxe prefix=test-mondo-$m ipconf=eth0:dhcp nfsmount=192.168.8.55:/users/svg"
52        #nfsmount=flecha.home.musique-ancienne.org:/users/svg/mondo/images
53        # ramdisk_blocksize=1024
54        $TOOLHOME/mkqemu pxe-$m &
55        sleep 2000
56    fi
57    if [ $vmp -eq 1 ]; then
58        ssh -q -p $sp root@localhost "halt -p"
59        sleep 300
60        proces=`ps auxww | grep qemu | grep -v grep | grep /users/qemu/$m.qemu | awk '{print $2}'`
61        if [ "$proces" != "" ]; then
62            kill $proces
63            sleep 10
64        fi
65    fi
66done
67
68# Should be removed at the end
69rm -rf $MONDOTMP
70) 2>&1 | tee /tmp/test2qemu.log
Note: See TracBrowser for help on using the repository browser.