1#!/bin/bash 2 3set -ex -o pipefail 4 5# DomU Busybox 6cd binaries 7mkdir -p initrd 8mkdir -p initrd/bin 9mkdir -p initrd/sbin 10mkdir -p initrd/etc 11mkdir -p initrd/dev 12mkdir -p initrd/proc 13mkdir -p initrd/sys 14mkdir -p initrd/lib 15mkdir -p initrd/var 16mkdir -p initrd/mnt 17cp /bin/busybox initrd/bin/busybox 18initrd/bin/busybox --install initrd/bin 19echo "#!/bin/sh 20 21mount -t proc proc /proc 22mount -t sysfs sysfs /sys 23mount -t devtmpfs devtmpfs /dev 24/bin/sh" > initrd/init 25chmod +x initrd/init 26# DomU rootfs 27cd initrd 28find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz 29cd .. 30 31# Dom0 rootfs 32cp rootfs.cpio.gz dom0-rootfs.cpio.gz 33cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz 34 35# test-local configuration 36mkdir -p rootfs 37cd rootfs 38mkdir -p root etc/local.d 39mv ../domU-rootfs.cpio.gz ./root 40cp ../bzImage ./root 41echo "name=\"domU\" 42memory=512 43vcpus=1 44kernel=\"/root/bzImage\" 45ramdisk=\"/root/domU-rootfs.cpio.gz\" 46extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\" 47" > root/domU.cfg 48echo "#!/bin/bash 49 50set -x 51 52bash /etc/init.d/xencommons start 53 54xl list 55 56xl -vvv create -c /root/domU.cfg 57 58" > etc/local.d/xen.start 59chmod +x etc/local.d/xen.start 60find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz 61cd ../.. 62 63cat >> binaries/pxelinux.0 << EOF 64#!ipxe 65 66kernel xen console=com1 console_timestamps=boot 67module bzImage console=hvc0 68module dom0-rootfs.cpio.gz 69boot 70EOF 71 72# Run the test 73rm -f smoke.serial 74export TEST_CMD="qemu-system-x86_64 \ 75 -cpu qemu64,+svm \ 76 -m 2G -smp 2 \ 77 -monitor none -serial stdio \ 78 -nographic \ 79 -device virtio-net-pci,netdev=n0 \ 80 -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0" 81 82export TEST_LOG="smoke.serial" 83export BOOT_MSG="Latest ChangeSet: " 84export LOG_MSG="Domain-0" 85export PASSED="BusyBox" 86 87./automation/scripts/console.exp | sed 's/\r\+$//' 88