From c5263675dd5ebb31fe8dbb560ddf62bd6754455d Mon Sep 17 00:00:00 2001 From: Jeff Bilyk Date: Sat, 11 Dec 2010 21:43:35 +0000 Subject: apts: adding more tests added more tests --- tests/asterisk | 10 ++++++++++ tests/dosfstools | 5 +++++ tests/dropbear | 13 +++++++++++++ tests/e2fsprogs | 6 ++++++ tests/ethtool | 3 +++ tests/gawk | 5 +++++ tests/logrotate | 3 +++ tests/man | 3 +++ tests/mdadm | 21 +++++++++++++++++++++ tests/minicom | 3 +++ tests/ngircd | 9 +++++++++ tests/opennhrp | 10 ++++++++++ tests/openssh | 6 ++++++ tests/openvpn | 29 +++++++++++++++++++++++++++++ tests/parted | 3 +++ tests/pciutils | 3 +++ tests/pcmciautils | 3 +++ tests/privoxy | 10 ++++++++++ tests/procps | 5 +++++ tests/python | 3 +++ tests/rsync | 10 ++++++++++ tests/rxmtp | 3 +++ tests/screen | 3 +++ tests/sfic | 1 + tests/shorewall | 24 ++++++++++++++++++++++++ tests/sysklogd | 17 +++++++++++++++++ tests/tinydns | 12 ++++++++++++ tests/xfsprogs | 1 + 28 files changed, 224 insertions(+) create mode 100644 tests/asterisk create mode 100644 tests/dosfstools create mode 100644 tests/dropbear create mode 100644 tests/e2fsprogs create mode 100644 tests/ethtool create mode 100644 tests/gawk create mode 100644 tests/logrotate create mode 100644 tests/man create mode 100644 tests/mdadm create mode 100644 tests/minicom create mode 100644 tests/ngircd create mode 100644 tests/opennhrp create mode 100644 tests/openssh create mode 100644 tests/openvpn create mode 100644 tests/parted create mode 100644 tests/pciutils create mode 100644 tests/pcmciautils create mode 100644 tests/privoxy create mode 100644 tests/procps create mode 100644 tests/python create mode 100644 tests/rsync create mode 100644 tests/rxmtp create mode 100644 tests/screen create mode 100644 tests/sfic create mode 100644 tests/shorewall create mode 100644 tests/sysklogd create mode 100644 tests/tinydns create mode 100644 tests/xfsprogs diff --git a/tests/asterisk b/tests/asterisk new file mode 100644 index 0000000..db50f82 --- /dev/null +++ b/tests/asterisk @@ -0,0 +1,10 @@ + apk_add $@ asterisk-doc + /etc/init.d/$@ start + pidof $@ + /etc/init.d/$@ stop + i=10; while pidof $@; do \ + [ $$i -eq 0 ] && exit 1; \ + i=$((i - 1)); \ + sleep 1; \ + done + apk_del asterisk-doc $@ diff --git a/tests/dosfstools b/tests/dosfstools new file mode 100644 index 0000000..55ccd4b --- /dev/null +++ b/tests/dosfstools @@ -0,0 +1,5 @@ + apk_add $@ + dd if=/dev/zero bs=1024 count=1440 of=tmp.img + mkfs.vfat tmp.img + apk_del $@ + rm -f tmp.img diff --git a/tests/dropbear b/tests/dropbear new file mode 100644 index 0000000..e231a33 --- /dev/null +++ b/tests/dropbear @@ -0,0 +1,13 @@ + apk_add $@ + # listen to other port since openssh is using port 22 + echo 'DROPBEAR_OPTS="-p 10022"' >/etc/conf.d/dropbear + /etc/init.d/$@ start + pidof $@ + /etc/init.d/$@ stop + while pidof $@; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + # while we are here, just check the client as well + dbclient -h + apk_del $@ diff --git a/tests/e2fsprogs b/tests/e2fsprogs new file mode 100644 index 0000000..1435347 --- /dev/null +++ b/tests/e2fsprogs @@ -0,0 +1,6 @@ + apk_add e2fsprogs xfsprogs + dd if=/dev/zero bs=1024 count=16384 of=tmp.img + mke2fs -j -F tmp.img + mkfs.xfs -f tmp.img + apk_del e2fsprogs xfsprogs + rm -f tmp.img diff --git a/tests/ethtool b/tests/ethtool new file mode 100644 index 0000000..384135e --- /dev/null +++ b/tests/ethtool @@ -0,0 +1,3 @@ + apk_add $@ + ethtool eth0 + apk_del $@ diff --git a/tests/gawk b/tests/gawk new file mode 100644 index 0000000..556cc93 --- /dev/null +++ b/tests/gawk @@ -0,0 +1,5 @@ + apk_add $@ + echo | gawk '{ print "hello world" }' + apk_del $@ + # verify bb link is restored + [ `readlink /usr/bin/awk` = /bin/busybox ] diff --git a/tests/logrotate b/tests/logrotate new file mode 100644 index 0000000..2e2fa20 --- /dev/null +++ b/tests/logrotate @@ -0,0 +1,3 @@ + apk_add $@ + /etc/periodic/daily/logrotate + apk_del $@ diff --git a/tests/man b/tests/man new file mode 100644 index 0000000..5bbb39c --- /dev/null +++ b/tests/man @@ -0,0 +1,3 @@ + apk_add $@ openvpn-doc + man -t openvpn + apk_del $@ openvpn-doc diff --git a/tests/mdadm b/tests/mdadm new file mode 100644 index 0000000..0ce80b9 --- /dev/null +++ b/tests/mdadm @@ -0,0 +1,21 @@ +LOOP1=/dev/loop4 +LOOP2=/dev/loop5 + modprobe raid1 + apk_add $@ + for i in 1 2; do \ + dd if=/dev/zero of=test$i.dsk bs=1024 count=16384; \ + losetup /dev/loop$((i + 3)) test$i.dsk; \ + done + mdadm --create --level=1 --metadata=0.90 --raid-devices=2 /dev/md0 $LOOP1 $LOOP2 --force + mdadm --detail --scan > /etc/mdadm.conf + mdadm --stop /dev/md0 + /etc/init.d/mdadm-raid start + mkswap /dev/md0 + swapon /dev/md0 + free + swapoff /dev/md0 + /etc/init.d/mdadm-raid stop + sleep 2 + for i in 1 2; do losetup -d /dev/loop$((i + 3)) ; done + rm test*.dsk + apk_del $@ diff --git a/tests/minicom b/tests/minicom new file mode 100644 index 0000000..dc473b2 --- /dev/null +++ b/tests/minicom @@ -0,0 +1,3 @@ + apk_add $@ + minicom --version | grep version + apk_del $@ diff --git a/tests/ngircd b/tests/ngircd new file mode 100644 index 0000000..5671790 --- /dev/null +++ b/tests/ngircd @@ -0,0 +1,9 @@ + apk_add $@ + /etc/init.d/$@ start + pidof $@ + /etc/init.d/$@ stop + while pidof $@; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ diff --git a/tests/opennhrp b/tests/opennhrp new file mode 100644 index 0000000..e21eb36 --- /dev/null +++ b/tests/opennhrp @@ -0,0 +1,10 @@ + apk_add $@ + /etc/init.d/opennhrp start + pidof opennhrp + /etc/init.d/opennhrp stop + i=10; while pidof $@; do \ + [ $i -eq 0 ] && exit 1; \ + i=$((i - 1)); \ + sleep 1; \ + done + apk_del $@ diff --git a/tests/openssh b/tests/openssh new file mode 100644 index 0000000..03c2724 --- /dev/null +++ b/tests/openssh @@ -0,0 +1,6 @@ + apk_add $@ + /etc/init.d/sshd start + pidof sshd + /etc/init.d/sshd stop + ! pidof ssh + apk_del $@ diff --git a/tests/openvpn b/tests/openvpn new file mode 100644 index 0000000..82c4955 --- /dev/null +++ b/tests/openvpn @@ -0,0 +1,29 @@ + modprobe tun + # Install program + apk_add openvpn + # Create test-config (Server) + echo 'dev tun' > /etc/openvpn/openvpn.conf + echo 'proto udp' >> /etc/openvpn/openvpn.conf + echo 'port 1194' >> /etc/openvpn/openvpn.conf + echo 'verb 2' >> /etc/openvpn/openvpn.conf + echo 'status /etc/openvpn/status.openvpn.log' >> /etc/openvpn/openvpn.conf + echo 'log /etc/openvpn/log.openvpn.log' >> /etc/openvpn/openvpn.conf + # Start service + /etc/init.d/openvpn start + # Check if it works + sleep 1 + pidof openvpn + # Stop service + /etc/init.d/openvpn stop + # Verify that it really dies + i=10; while pidof $@; do \ + [ $i -eq 0 ] && exit 1; \ + i=$((i - 1)); \ + sleep 1; \ + done + # Remove testscript + rm -rf /etc/openvpn/openvpn.conf + rm -rf /etc/openvpn/status.openvpn.log + rm -rf /etc/openvpn/log.openvpn.log + # Remove program + apk_del openvpn diff --git a/tests/parted b/tests/parted new file mode 100644 index 0000000..81c19fb --- /dev/null +++ b/tests/parted @@ -0,0 +1,3 @@ + apk_add $@ + parted -l + apk_del $@ diff --git a/tests/pciutils b/tests/pciutils new file mode 100644 index 0000000..438e41e --- /dev/null +++ b/tests/pciutils @@ -0,0 +1,3 @@ + apk_add $@ + lspci + apk_del $@ diff --git a/tests/pcmciautils b/tests/pcmciautils new file mode 100644 index 0000000..008b723 --- /dev/null +++ b/tests/pcmciautils @@ -0,0 +1,3 @@ + apk_add $@ + lspcmcia + apk_del $@ diff --git a/tests/privoxy b/tests/privoxy new file mode 100644 index 0000000..c8b4adc --- /dev/null +++ b/tests/privoxy @@ -0,0 +1,10 @@ + apk_add $@ + /etc/init.d/$@ start + sleep 1 + pidof $@ + /etc/init.d/$@ stop + while pidof $@; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ diff --git a/tests/procps b/tests/procps new file mode 100644 index 0000000..e40bc88 --- /dev/null +++ b/tests/procps @@ -0,0 +1,5 @@ + apk_add $@ + uptime + free + apk_del $@ + [ `readlink /usr/bin/uptime` = /bin/busybox ] diff --git a/tests/python b/tests/python new file mode 100644 index 0000000..71e86b2 --- /dev/null +++ b/tests/python @@ -0,0 +1,3 @@ + apk_add $@ + echo "print(\"hello world\")" | python + apk_del $@ diff --git a/tests/rsync b/tests/rsync new file mode 100644 index 0000000..ddb4601 --- /dev/null +++ b/tests/rsync @@ -0,0 +1,10 @@ + INITD=rsyncd + apk_add $@ + /etc/init.d/$INITD start + pidof $@ + /etc/init.d/$INITD stop + while pidof $@; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ diff --git a/tests/rxmtp b/tests/rxmtp new file mode 100644 index 0000000..f5af476 --- /dev/null +++ b/tests/rxmtp @@ -0,0 +1,3 @@ + apk_add $@ + rxmtp localhost | grep 451 + apk_del $@ diff --git a/tests/screen b/tests/screen new file mode 100644 index 0000000..bd9d2aa --- /dev/null +++ b/tests/screen @@ -0,0 +1,3 @@ + apk_add $@ + screen -v | grep ^Screen + apk_del $@ diff --git a/tests/sfic b/tests/sfic new file mode 100644 index 0000000..c88a251 --- /dev/null +++ b/tests/sfic @@ -0,0 +1 @@ +. tests/asterisk \ No newline at end of file diff --git a/tests/shorewall b/tests/shorewall new file mode 100644 index 0000000..b55693f --- /dev/null +++ b/tests/shorewall @@ -0,0 +1,24 @@ + IFACE=eth0 + d="/etc/shorewall" + IP=`ip addr show $IFACE | awk -F 'inet' '{print $2}' | tail -n1 | awk '{print $1}` + BCAST=`ipcalc -b $IP | cut -d= -f2` + + # verify that we actually have an eth0 device + ip addr show ${IFACE} + apk_add $@ + # save current iptables + /etc/init.d/iptables save + echo "STARTUP_ENABLED=Yes" >> "${d}/shorewall.conf" + echo "loc ipv4" >> "${d}/zones" + echo "loc ${IFACE}" >> "${d}/interfaces" + # so we dont lose our ssh connection + echo "all all ACCEPT" >> "${d}/policy" + echo "Ping/REJECT fw all" >> "${d}/rules" + /etc/init.d/$@ start + # detect the broadcast adress and try to ping it + echo "BROADCAST addr is $BCAST" + # we should not be allowed to ping + ping -c 1 $BCAST 2>&1 | grep "not permitted" + /etc/init.d/$@ stop + /etc/init.d/iptables restore + apk_del $@ diff --git a/tests/sysklogd b/tests/sysklogd new file mode 100644 index 0000000..061e37d --- /dev/null +++ b/tests/sysklogd @@ -0,0 +1,17 @@ + INITD=$@ + /etc/init.d/syslog stop + apk_add $@ + /etc/init.d/$INITD start + sleep 1 + pidof syslogd + /etc/periodic/daily/sysklogd + test -f /var/log/kern.log.0 + /etc/periodic/daily/sysklogd + test -f /var/log/kern.log.1.gz + /etc/init.d/$INITD stop + while pidof $INITD; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ + /etc/init.d/syslog start diff --git a/tests/tinydns b/tests/tinydns new file mode 100644 index 0000000..7ae1df9 --- /dev/null +++ b/tests/tinydns @@ -0,0 +1,12 @@ + apk_add $@ + echo "=localhost:127.0.0.1" > /etc/tinydns/localdomain + /etc/init.d/tinydns start + pidof $@ + /etc/init.d/tinydns stop + i=10; while pidof $@; do \ + [ $i -eq 0 ] && exit 1; \ + i=$((i - 1)); \ + sleep 1; \ + done + rm -f /etc/tinydns/localdomain + apk_del $@ diff --git a/tests/xfsprogs b/tests/xfsprogs new file mode 100644 index 0000000..267834b --- /dev/null +++ b/tests/xfsprogs @@ -0,0 +1 @@ +. tests/e2fsprogs \ No newline at end of file -- cgit v1.2.3