ossp-pkg/rc/rc_test.sh
1.13
#! /bin/sh
# OSSP rc - Run-command processor
# Copyright (c) 2002 Ralf S. Engelschall
# Copyright (c) 2002 Cable & Wireless Deutschland GmbH
# Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
#
# This file is part of OSSP rc, a portable Run-command processor
# which can be found at http://www.ossp.org/pkg/lib/rc/
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# test_rc.sh: Run-command processor test script
# Test short options, should fail for false combination usage
#echo "./rc -dvef rcfunc/rc.func -hilpsrvxLcqt samba start sleep=2 restart"
#./rc -dVef rcfunc/rc.func -hilpsrvxLcqt samba start sleep=2 restart
# Test short options, should succeed
#echo; echo "./rc -derv -L /u/ms/ossp/rc/rcdings/rcfiles/rc.%{RCFILE:s/^all$/*/} -c /u/ms/ossp/rc/rcdings/rc.conf -f /u/ms/ossp/rc/rcfunc/rc.func -t /tmp openssh stop sleep=4 start daily minsize=2097152"
#./rc -derv -L /u/ms/ossp/rc/rcdings/rcfiles/rc.d/rc.%{RCFILE:s/^all$/*/} -c /u/ms/ossp/rc/rcdings/rc.conf -f /u/ms/ossp/rc/rcfunc/rc.func -t /tmp openssh stop sleep=4 start daily minsize=2097152
# Test some long options, should fail for false combination usage
echo; echo "./rc --verbose --silent uucp stop sleep=6 start"
./rc --verbose --silent uucp stop sleep=6 start
echo; echo "./rc --query myvar --silent zebra bing bang"
./rc --query myvar --silent zebra bing bang
echo; echo "./rc --conf /sfw/rc.conf --locate /u/ms/ossp/rc/rcdings/rcfiles/ --query this barf test"
./rc --conf /sfw/rc.conf --locate /u/ms/ossp/rc/rcdings/rcfiles/ --query this barf test
# Test minimal set of long options, should succeed
echo; echo "./rc --debug --version rsyncd nothing matters but the version"
./rc --debug --version rsyncd nothing matters but the version
echo; echo "./rc --conf /sfw/rc.conf --locate /cw/etc/rc.d:/u/ms/ossp/rc/rcdings/rcfiles:/etc/rc --query all barf test"
./rc --conf /sfw/rc.conf --locate /cw/etc/rc.d:/u/ms/ossp/rc/rcdings/rcfiles:/etc/rc --query all barf test
# FIXME these cases are not handled yet by our configuration FIXME #
#echo; echo "./rc --debug --version"
#./rc --debug --version
#echo; echo "./rc --debug --help"
#./rc --debug --help
#echo; echo "./rc --debug --info --verbose"
#./rc --debug --info --verbose
#echo; echo "./rc --conf /etc/rc.conf --debug --info --raw"
#./rc --conf /etc/rc.conf --debug --info --raw
#echo; echo "./rc --conf /sfw/rc.conf --tmp /sfw/RPM/TMP --debug --labels rsyncd"
#./rc --conf /sfw/rc.conf --tmp /sfw/RPM/TMP --debug --labels rsyncd
# FIXME these cases are not handled yet by our configuration FIXME #
echo; echo "./rc --func /u/ms/ossp/rc/rcfunc/rc.func --print --verbose openssh stop sleep=4 start"
./rc --func /u/ms/ossp/rc/rcfunc/rc.func --print --verbose openssh stop sleep=4 start
echo; echo "./rc --func /u/ms/ossp/rc/rcfunc/rc.func --debug --eval uucp restart"
./rc --func /u/ms/ossp/rc/rcfunc/rc.func --debug --eval uucp restart
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func --tmp /tmp --exec uucp start"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func --tmp /tmp --exec uucp start
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func --tmp /tmp --debug --exec ntp sync"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func --tmp /tmp --debug --exec ntp sync
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func --tmp /tmp --debug --silent --exec ralf feed suppe"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func --tmp /tmp --debug --silent --exec ralf feed suppe
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func
-L /u/ms/ossp/rc/rcfiles/ --tmp /tmp --silent --exec samba search finish destroy"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /u/ms/ossp/rc/rcfiles/ --tmp /tmp --silent --exec samba search finish destroy
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /u/ms/ossp/rc/rcfiles/ --tmp /tmp --silent --exec all feed suppe"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /u/ms/ossp/rc/rcfiles/ --tmp /tmp --silent --exec all go feed suppe
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /sw/etc/rc.d --tmp /tmp --silent --debug --exec all config barf gag"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /sw/etc/rc.d --tmp /tmp --silent --debug --exec all config barf gag
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /sw/etc/rc.d --tmp /tmp --silent --debug --exec all config start"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /sw/etc/rc.d --tmp /tmp --silent --debug --exec all config start
echo; echo "./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /sw/etc/rc.d --tmp /tmp --silent --debug --exec pam info"
./rc --conf rcdings/myrc.conf --func /u/ms/ossp/rc/rcfunc/rc.func -L /sw/etc/rc.d --tmp /tmp --silent --debug --exec pam info
# Next milestone
#RequireOwner
#RequireGroup
#RequireUmask
#ParseEnvAss
#ParseSectionDef
#ParseSectionRef
#ParseSectionParam
#ParseTerminal
#NameConfig
#NameCommon
#NameDefault
#NameError