source: branches/3.3/contrib/pbtest @ 3700

Last change on this file since 3700 was 3700, checked in by bruno, 12 months ago

Adds a test script for RHEL/Fedora VMs

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/bash
2# Test a remote machine such as Fedora 20
3#
4
5#DISTRO=rhel-6.2-x86_64
6DISTRO=rhel-7-x86_64
7#DISTRO=rhel-5-x86_64
8#DISTRO=fedora-20-x86_64
9
10NAME=`pbdistrocheck $DISTRO | grep -E '^Name:' | awk '{print $2}'`
11VER=`pbdistrocheck $DISTRO | grep -E '^Ver:' | awk '{print $2}'`
12ARCH=`pbdistrocheck $DISTRO | grep -E '^Arch:' | awk '{print $2}'`
13D=$DISTRO
14DEST=/users/mondo/small
15DIR=images
16TEMP=temp
17CACHE=cache
18MNT=/mnt
19KEY=$HOME/.ssh/pb_rsa
20port=`ps auxww | grep qemu | grep -w $D | grep -v grep | perl -p -e 's|.*127.0.0.1:([0-9]+)-:.*|$1|'`
21if [ _"$port" == _"" ]; then
22    pb -p mondorescue -r branches/3.3 -m $D launchvm
23fi
24
25pb -p mondorescue -r branches/3.3 -m $D sbx2vm MondoRescue mondo mindi mindi-busybox
26cat > /tmp/test << EOF
27cd /etc/yum.repos.d
28yum install -y curl
29if [ ! -f /etc/yum.repos.d/mondorescue.repo ]; then
30    curl ftp://ftp.mondorescue.org/$NAME/$VER/$ARCH/mondorescue.repo -o mondorescue.repo
31fi
32if [ ! -f /etc/yum.repos.d/mondorescue-test.repo ]; then
33    curl ftp://ftp.mondorescue.org/test/$NAME/$VER/$ARCH/mondorescue-test.repo -o mondorescue-test.repo
34fi
35yum makecache fast
36yum install mondo -y
37yum update mondo mindi perl-MondoRescue mindi-busybox -y
38yum install nfs-utils -y
39modprobe nfsv3
40mount -o vers=3 10.0.2.2:$DEST $MNT
41mkdir -p $MNT/$DIR $MNT/$TEMP $MNT/$CACHE
42mondoarchive -N -G -K 99 -E '/home|/var/log|/usr/share/doc|/usr/src|/usr/share/texmf|/mnt' -s 4480m -n 10.0.2.2:$DEST -d $DIR -p $D -z -O -S $MNT/$CACHE -T $MNT/$TEMP
43umount $MNT/
44EOF
45# Now should be OK
46port=`ps auxww | grep qemu | grep -w $D | grep -v grep | perl -p -e 's|.*127.0.0.1:([0-9]+)-:.*|$1|'`
47
48ssh -i $KEY -p $port root@localhost "rm -rf ./test"
49scp -i $KEY -P $port /tmp/test root@localhost:
50ssh -i $KEY -p $port root@localhost "chmod 755 ./test ; ./test"
51
52sudo chown bruno $DEST/temp
53Q=$DEST/temp/test.qemu
54qemu-img create -f qcow2 $Q 7G
55cmd="qemu-kvm -m 2048 -boot d -cdrom $DEST/$DIR/$D-1.iso $Q"
56echo "Calling restore test: $cmd"
57$cmd
Note: See TracBrowser for help on using the repository browser.