From be2dce01aaf55626d85932572a69316b5740a753 Mon Sep 17 00:00:00 2001 From: Jeff Bilyk Date: Sat, 11 Dec 2010 23:07:56 +0000 Subject: apts: more tests more tests --- apts | 69 +++++------------------------------------------------ tests/attr | 3 +++ tests/bash | 3 +++ tests/bbsuid | 3 +++ tests/bc | 3 +++ tests/beep | 3 +++ tests/cdparanoia | 3 +++ tests/dialog | 3 +++ tests/dmidecode | 3 +++ tests/dpkg | 3 +++ tests/dtach | 3 +++ tests/fetchmail | 4 ++++ tests/gzip | 4 ++++ tests/haserl | 9 +++++++ tests/hypermail | 3 +++ tests/iperf | 3 +++ tests/ipsec-tools | 16 +++++++++++++ tests/iputils | 4 ++++ tests/lighttpd | 9 +++++++ tests/lua-discount | 3 +++ tests/mini_httpd | 11 +++++++++ tests/mlmmj | 3 +++ tests/newt | 3 +++ tests/obexftp | 3 +++ tests/quagga | 16 +++++++++++++ tests/reiserfsprogs | 5 ++++ tests/sqlite | 3 +++ tests/squid | 14 +++++++++++ tests/syslinux | 6 +++++ tests/transmission | 13 ++++++++++ tests/ucarp | 3 +++ 31 files changed, 171 insertions(+), 63 deletions(-) mode change 100755 => 100644 apts create mode 100644 tests/attr create mode 100644 tests/bash create mode 100644 tests/bbsuid create mode 100644 tests/bc create mode 100644 tests/beep create mode 100644 tests/cdparanoia create mode 100644 tests/dialog create mode 100644 tests/dmidecode create mode 100644 tests/dpkg create mode 100644 tests/dtach create mode 100644 tests/fetchmail create mode 100644 tests/gzip create mode 100644 tests/haserl create mode 100644 tests/hypermail create mode 100644 tests/iperf create mode 100644 tests/ipsec-tools create mode 100644 tests/iputils create mode 100644 tests/lighttpd create mode 100644 tests/lua-discount create mode 100644 tests/mini_httpd create mode 100644 tests/mlmmj create mode 100644 tests/newt create mode 100644 tests/obexftp create mode 100644 tests/quagga create mode 100644 tests/reiserfsprogs create mode 100644 tests/sqlite create mode 100644 tests/squid create mode 100644 tests/syslinux create mode 100644 tests/transmission create mode 100644 tests/ucarp diff --git a/apts b/apts old mode 100755 new mode 100644 index e91ca10..da80b1a --- a/apts +++ b/apts @@ -1,63 +1,6 @@ -#!/bin/sh - -# apts is a testing suite for packages on the Alpine Linux system -# In theory, it will work on any distribution that uses the apk-tools -# package manager -# Author: Jeff Bilyk -# Version History: -# Dec 4 2010 - Initial version -# Dec 11 2010 - Added generic-apk test for cases where there isn't a package test file - -# Get file to output to -program=$0 - -usage() { - echo "Usage: $program outputfile " - exit 1 -} - -# parse opts -while getopts "h" opt; do - case "$opt" in - h) usage;; - help) usage;; - esac -done - -OUTFILE=$1 - -# are there any file arguments -if [ $# -eq 0 ]; then - echo "no outfile specified" - usage -fi - -#remove opts so that package is $@ -shift $(( $OPTIND - 1 )) - -# shift once more -shift - -# if there aren't any args besides outfile test all packages -if [ $# -eq 0 ]; - then totaltests=`ls ./tests/ | wc -w` && echo "All (${totaltests}) packages to be tested" && passedtests="0" && for package in `ls ./tests/`; - do echo "Testing $package apk" && /bin/sh -e ./tests/$package $package >> "$OUTFILE" 2>&1 && echo "$package passed tests" >> "$OUTFILE" && echo "$package passed tests" && passedtests=$((passedtests + 1)); - done && echo "$passedtests of $totaltests passed" && exit 0; -fi - -# If script still running, there's args, so test all specified packages -i=1 -while [ $# -gt 0 ]; do - echo "file number $i: $1" - PACKAGE=$1 - # does testing file exist - test -e ./tests/$PACKAGE - # If no testing file exists then run generic-apk - if [ "$?" == "1" ]; - then echo "Testing file for $PACKAGE does not exist" && /bin/sh -e ./tests/generic-apk $PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests" && exit 0; - # if testing file exists, then keep running - else echo "Testing $PACKAGE apk" && /bin/sh -e ./tests/$PACKAGE $PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests" && exit 0; - fi - i=$(( $i + 1 )) - shift -done + apk_add $@ + soft=`cat /proc/sys/kernel/pax/softmode` + echo 1 > /proc/sys/kernel/pax/softmode + valgrind /bin/busybox && + echo $soft >/proc/sys/kernel/pax/softmode + apk_del $@ diff --git a/tests/attr b/tests/attr new file mode 100644 index 0000000..aa4ce2d --- /dev/null +++ b/tests/attr @@ -0,0 +1,3 @@ + apk_add $@ + getfattr . + apk_del $@ diff --git a/tests/bash b/tests/bash new file mode 100644 index 0000000..7837a78 --- /dev/null +++ b/tests/bash @@ -0,0 +1,3 @@ + apk_add $@ + /bin/bash -c "echo hello world" + apk_del $@ diff --git a/tests/bbsuid b/tests/bbsuid new file mode 100644 index 0000000..518ce86 --- /dev/null +++ b/tests/bbsuid @@ -0,0 +1,3 @@ + apk_add $@ + su - root -c "whoami" + apk_del $@ diff --git a/tests/bc b/tests/bc new file mode 100644 index 0000000..f669c02 --- /dev/null +++ b/tests/bc @@ -0,0 +1,3 @@ + apk_add $@ + echo "23*9" | bc + apk_del $@ diff --git a/tests/beep b/tests/beep new file mode 100644 index 0000000..310c9f6 --- /dev/null +++ b/tests/beep @@ -0,0 +1,3 @@ + apk_add $@ + beep + apk_del $@ diff --git a/tests/cdparanoia b/tests/cdparanoia new file mode 100644 index 0000000..d8544db --- /dev/null +++ b/tests/cdparanoia @@ -0,0 +1,3 @@ + apk_add $@ + $@ -V + apk_del $@ diff --git a/tests/dialog b/tests/dialog new file mode 100644 index 0000000..77505eb --- /dev/null +++ b/tests/dialog @@ -0,0 +1,3 @@ + apk_add $@ + dialog --version + apk_del $@ diff --git a/tests/dmidecode b/tests/dmidecode new file mode 100644 index 0000000..b3bf157 --- /dev/null +++ b/tests/dmidecode @@ -0,0 +1,3 @@ + apk_add $@ + dmidecode + apk_del $@ diff --git a/tests/dpkg b/tests/dpkg new file mode 100644 index 0000000..73086b9 --- /dev/null +++ b/tests/dpkg @@ -0,0 +1,3 @@ + apk_add $@ + dpkg --version + apk_del $@ diff --git a/tests/dtach b/tests/dtach new file mode 100644 index 0000000..1e7b6ec --- /dev/null +++ b/tests/dtach @@ -0,0 +1,3 @@ + apk_add $@ + dtach -n sock cal + apk_del $@ diff --git a/tests/fetchmail b/tests/fetchmail new file mode 100644 index 0000000..cfbe5e0 --- /dev/null +++ b/tests/fetchmail @@ -0,0 +1,4 @@ + apk_add $@ + fetchmail --version + ! which fetchmailconf + apk_del $@ diff --git a/tests/gzip b/tests/gzip new file mode 100644 index 0000000..41eb1c4 --- /dev/null +++ b/tests/gzip @@ -0,0 +1,4 @@ + apk_add $@ + gzip --version | gzip -c | gunzip -c | grep GNU + apk_del $@ + [ `readlink /bin/gzip` = /bin/busybox ] diff --git a/tests/haserl b/tests/haserl new file mode 100644 index 0000000..91da389 --- /dev/null +++ b/tests/haserl @@ -0,0 +1,9 @@ + SCRIPT=tmp.haserl + apk_add $@ + echo '#!/usr/bin/haserl --shell=lua' >$SCRIPT + echo '' >>$SCRIPT + echo '<% print"hello world" %>' >>$SCRIPT + chmod +x $SCRIPT + ./$SCRIPT | grep 'hello world' + rm -f $SCRIPT + apk_del $@ diff --git a/tests/hypermail b/tests/hypermail new file mode 100644 index 0000000..f48ce06 --- /dev/null +++ b/tests/hypermail @@ -0,0 +1,3 @@ + apk_add $@ + echo -e "Message-id: 123\nSubject: test\n\nhello" | hypermail + apk_del $@ diff --git a/tests/iperf b/tests/iperf new file mode 100644 index 0000000..e1c9d3e --- /dev/null +++ b/tests/iperf @@ -0,0 +1,3 @@ + apk_add $@ + iperf + apk_del $@ diff --git a/tests/ipsec-tools b/tests/ipsec-tools new file mode 100644 index 0000000..1168c9c --- /dev/null +++ b/tests/ipsec-tools @@ -0,0 +1,16 @@ + apk_add $@ + mkdir -p /etc/racoon + touch /etc/ipsec.conf + touch /etc/racoon/racoon.conf + touch /etc/racoon/psk.txt + chmod 400 /etc/racoon/psk.txt + /etc/init.d/racoon start + sleep 1 + pidof racoon + /etc/init.d/racoon stop + killall racoon + while pidof racoon; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ diff --git a/tests/iputils b/tests/iputils new file mode 100644 index 0000000..c0a1d9c --- /dev/null +++ b/tests/iputils @@ -0,0 +1,4 @@ + apk_add $@ + tracepath localhost + apk_del $@ + [ `readlink /bin/ping` = /bin/busybox ] diff --git a/tests/lighttpd b/tests/lighttpd new file mode 100644 index 0000000..5671790 --- /dev/null +++ b/tests/lighttpd @@ -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/lua-discount b/tests/lua-discount new file mode 100644 index 0000000..766b377 --- /dev/null +++ b/tests/lua-discount @@ -0,0 +1,3 @@ + apk_add $@ + lua -e 'd = require("discount"); d("foo*bar*")' + apk_del $@ diff --git a/tests/mini_httpd b/tests/mini_httpd new file mode 100644 index 0000000..61566cd --- /dev/null +++ b/tests/mini_httpd @@ -0,0 +1,11 @@ + apk_add $@ + echo "MINI_HTTPD_DOCROOT=`pwd`" >> /etc/conf.d/mini_httpd + /etc/init.d/$@ start + sleep 1 + pidof $@2 + /etc/init.d/$@ stop + while pidof $@; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ diff --git a/tests/mlmmj b/tests/mlmmj new file mode 100644 index 0000000..2eaae4b --- /dev/null +++ b/tests/mlmmj @@ -0,0 +1,3 @@ + apk_add $@ + mlmmj-list -V + apk_del $@ diff --git a/tests/newt b/tests/newt new file mode 100644 index 0000000..dbf0b0e --- /dev/null +++ b/tests/newt @@ -0,0 +1,3 @@ + apk_add $@ + whiptail --help + apk_del $@ diff --git a/tests/obexftp b/tests/obexftp new file mode 100644 index 0000000..f9095d5 --- /dev/null +++ b/tests/obexftp @@ -0,0 +1,3 @@ + apk_add $@ + obexftp --version + apk_del $@ diff --git a/tests/quagga b/tests/quagga new file mode 100644 index 0000000..1d65094 --- /dev/null +++ b/tests/quagga @@ -0,0 +1,16 @@ +INITD=zebra +PROC=$INITD + apk_add $@ + if ! [ test -e /etc/quagga ]; + then mkdir -p /etc/quagga; + fi + touch /etc/quagga/zebra.conf + /etc/init.d/$INITD start + sleep 1 + pidof $PROC + /etc/init.d/$INITD stop + while pidof $PROC; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ diff --git a/tests/reiserfsprogs b/tests/reiserfsprogs new file mode 100644 index 0000000..f20d008 --- /dev/null +++ b/tests/reiserfsprogs @@ -0,0 +1,5 @@ + apk_add $@ + dd if=/dev/zero count=67000 of=tmp.img + mkreiserfs -q tmp.img + apk_del $@ + rm -f tmp.img diff --git a/tests/sqlite b/tests/sqlite new file mode 100644 index 0000000..f2212ff --- /dev/null +++ b/tests/sqlite @@ -0,0 +1,3 @@ + apk_add $@ + echo .help | sqlite3 + apk_del $@ diff --git a/tests/squid b/tests/squid new file mode 100644 index 0000000..c34a9b6 --- /dev/null +++ b/tests/squid @@ -0,0 +1,14 @@ + apk_add $@ + if ! [ test -e /etc/squid ]; + then mkdir -p /etc/squid; + fi + echo "visible_hostname test.domain" >> /etc/squid/squid.conf + /etc/init.d/$@ start + pidof squid + /etc/init.d/$@ stop + i=10; while pidof $@; do \ + [ $i -eq 0 ] && exit 1; \ + i=$((i - 1)); \ + sleep 1; \ + done + apk_del $@ diff --git a/tests/syslinux b/tests/syslinux new file mode 100644 index 0000000..268eece --- /dev/null +++ b/tests/syslinux @@ -0,0 +1,6 @@ + apk_add $@ dosfstools + dd if=/dev/zero bs=1024 count=1440 of=tmp.img + mkfs.vfat tmp.img + syslinux tmp.img + apk_del $@ dosfstools + rm -f tmp.img diff --git a/tests/transmission b/tests/transmission new file mode 100644 index 0000000..1fcd816 --- /dev/null +++ b/tests/transmission @@ -0,0 +1,13 @@ +INITD=transmission-daemon +PROC=$INITD + apk_add $@ transmission-daemon + /etc/init.d/$INITD start + sleep 1 + pidof $PROC + killall transmission-daemon + /etc/init.d/$INITD zap + while pidof $PROC; do\ + echo -n "." >/dev/tty;\ + sleep 1;\ + done + apk_del $@ transmission-daemon diff --git a/tests/ucarp b/tests/ucarp new file mode 100644 index 0000000..932b7d5 --- /dev/null +++ b/tests/ucarp @@ -0,0 +1,3 @@ + apk_add $@ + ucarp --help + apk_del $@ -- cgit v1.2.3