NetBSD GSoC 2020 : Script for automation of NetBSD regression framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
################################################################################ | |
# Configuration of VM system | |
################################################################################ | |
BENCH_SYS_NUM=0 | |
# Please adjust per-host configuration | |
SERVER_IP=192.168.43.219 | |
SERVER_HTTP_PORT=8640 | |
ACCOUNT_ID=4R5Y6M | |
# Please adjust per-guest configuration | |
CLIENT_IP=10.169.0.240 | |
ROUTERS=10.169.0.1 | |
DNS=10.169.0.1 | |
WORK_DIR=~/.anita/${BENCH_SYS_NUM}/ | |
mkdir -p $WORK_DIR && cd $WORK_DIR | |
################################################################################ | |
# Generation of script in mountable ISO | |
################################################################################ | |
mkdir -p script${BENCH_SYS_NUM} | |
cat << EOF > script${BENCH_SYS_NUM}/vm.sh | |
#!/bin/sh | |
echo 'hostname="bench_sys${BENCH_SYS_NUM}"' >> /etc/rc.conf | |
echo 'dhcpcd=YES' >> /etc/rc.conf | |
echo 'dhcpcd_flags="-qMS ip_address=${CLIENT_IP}/24 -S routers=${ROUTERS} -S domain_name_servers=${DNS} wm0"' >> /etc/rc.conf | |
# Currently used as PTS 9.6.1 isn't upstream in pkgsrc | |
printf '10.169.0.1:/home/apurvan/NetBSD/packages\t/root/NetBSD/packages\tnfs\tro\t0\t0\n' >> /etc/fstab | |
mkdir -p /root/NetBSD/packages | |
hostname -s bench_sys${BENCH_SYS_NUM} | |
service dhcpcd restart | |
mount -a | |
NETBSD_VERSION=\$(uname -r) | |
export PKG_PATH=/root/NetBSD/packages/amd64/\$NETBSD_VERSION/All | |
# https://pkgsrc.joyent.com/packages/NetBSD/\$NETBSD_VERSION/amd64/All/ | |
pkg_add phoronix-test-suite | |
# Printing two y's for license acceptance on first run after installation | |
printf 'y\ny\n' | phoronix-test-suite phoromatic.connect ${SERVER_IP}:${SERVER_HTTP_PORT}/${ACCOUNT_ID} | |
EOF | |
chmod +x script${BENCH_SYS_NUM}/vm.sh | |
makefs -t cd9660 -o rr-squash script${BENCH_SYS_NUM}.iso script${BENCH_SYS_NUM}/ | |
################################################################################ | |
# Creating VM system, installing NetBSD-current, setup networking & hostname, | |
# PTS 9.6.1 installation on VM, and connecting to Phoromatic Server | |
################################################################################ | |
macaddress="$(printf 'DE:AD:BE:EF:AE:%02X\n' $((BENCH_SYS_NUM%256)))" | |
xterm -e "anita interact https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/amd64/ --sets kern-GENERIC,modules,base,etc,xbase --vmm-args '-device e1000,netdev=net0,mac=$macaddress -netdev bridge,id=net0,br=virbr1 -hdd script${BENCH_SYS_NUM}.iso' --run 'mount /dev/wd1a /mnt && /mnt/vm.sh' --disk-size 5G --run-timeout 86400" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment