# should be handled in the main script, where it belongs.
################################################################################
+CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version
+
_opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \
- mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version \
- -- "$@"`
+ $CMDLINE_OPTS -- "$@"`
+
if [ $? != 0 ]; then
eerror "Try 'grml-debootstrap --help' for more information."; eend 1; exit 1
fi
Maintainer: Michael Prokop <mika@grml.org>
Uploaders: Alexander Wirt <formorer@grml.org>
Build-Depends: debhelper (>= 5)
-Build-Depends-Indep: asciidoc, docbook-xsl, xsltproc
+Build-Depends-Indep: asciidoc, docbook-xsl, xsltproc, shunit2
Standards-Version: 3.8.3
Homepage: http://grml.org/grml-debootstrap/
Vcs-git: git://git.grml.org/grml-debootstrap.git
build-stamp:
dh_testdir
+ (cd tests && ./run_tests.sh)
make
touch $@
--- /dev/null
+#!/bin/zsh
+# Filename: run_tests
+# Purpose: run unit tests for grml-autoconfig
+# Authors: grml-team (grml.org), (c) Ulrich Dangel <mru@grml.org>
+# Bug-Reports: see http://grml.org/bugs/
+# License: This file is licensed under the GPL v2.
+################################################################################
+
+
+GLOBRETVAL=0
+
+for FILE in test_*.sh ; do
+ if [ -x ${FILE} ] ; then
+ pretty_name="${FILE##test_}"
+ pretty_name="${pretty_name/.sh/}"
+
+ echo "Running test for: ${pretty_name}"
+
+ ./${FILE}
+ RETVAL=$?
+
+ [ "$RETVAL" -ne 0 ] && GLOBRETVAL=$RETVAL
+ fi
+done
+
+exit $GLOBRETVAL
+
+## END OF FILE #################################################################
+# vim:foldmethod=marker expandtab ai ft=zsh shiftwidth=3
--- /dev/null
+#!/bin/bash
+
+
+test_cmdlineopts() {
+ . ../cmdlineopts.clp
+ CMDLINE=
+ typeset -a VALUES
+ count=0
+ i=0
+
+ OLDIFS="$IFS"
+ IFS=,
+ for CMD in $CMDLINE_OPTS ; do
+ PARAM=""
+ if [[ $CMD == *: ]] ; then
+ PARAM=$RANDOM
+ fi
+ VALUES[$count]="${CMD%%:*} $PARAM"
+ ((count++))
+ done
+ IFS=$OLDIFS
+
+ while [ "$i" -lt "$count" ] ; do
+ CMDLINE+="--${VALUES[$i]} "
+ ((i++))
+ done
+
+ . ../cmdlineopts.clp $CMDLINE
+
+
+ i=0
+ while [ "$i" -lt "$count" ] ; do
+ ENTRY="${VALUES[$i]}"
+ VARNAME=${ENTRY% *}
+ RESULT=${ENTRY/* /}
+ VARNAME='$_opt_'${VARNAME/-/_}
+ VALUE="$(eval echo $VARNAME)"
+ if [ -z "$RESULT" ] ; then
+ assertNotNull "$VARNAME should be not null" "$VALUE"
+ else
+ assertEquals "$VARNAME" "$RESULT" "$VALUE"
+ fi
+ ((i++))
+ done
+}
+
+SHUNIT_PARENT=$0
+. /usr/share/shunit2/shunit2