Writing Shell Tests
Writing shell tests
Avoid writing new shell-based tests
New tests should be written in Python.
This particularly includes:
- Black-box tests of Samba binaries using samba.tests.BlackboxTestCase
- tests of samba-tool using samba.tests.samba_tool.base.SambaToolCmdTest.
On many systems (Debian and Ubuntu in particular)
Use helper functions
If your test is in testprogs/blackbox you can use:
. `dirname $0`/subunit.sh . `dirname $0`/common_test_fns.inc
otherwise you will need to use a ../ path to find these.
testit is the primary test command, testing one particular command for success.
testit "change dc password" $samba4srcdir/scripting/devel/chgtdcpass -s $PROVDIR/etc/smb.conf || failed=`expr $failed + 1`
The script should exit with the number of failures