From: Stefan Metzmacher Date: Tue, 3 Feb 2009 15:23:13 +0000 (+0100) Subject: s4:selftest: avoid hardcoded pathes in blackbox tests X-Git-Url: http://git.samba.org/samba.git/?p=kai%2Fsamba.git;a=commitdiff_plain;h=8b408f781970b3f2b310389f9ae73ad0c5e42881 s4:selftest: avoid hardcoded pathes in blackbox tests metze --- diff --git a/nsswitch/tests/test_wbinfo.sh b/nsswitch/tests/test_wbinfo.sh index 84876e35d12..2e94c246406 100755 --- a/nsswitch/tests/test_wbinfo.sh +++ b/nsswitch/tests/test_wbinfo.sh @@ -14,8 +14,8 @@ TARGET=$4 shift 4 failed=0 -samba4bindir=`dirname $0`/../../source4/bin -wbinfo=$samba4bindir/wbinfo +samba4bindir="$BUILDDIR/bin" +wbinfo="$samba4bindir/wbinfo$EXEEXT" . `dirname $0`/../../testprogs/blackbox/subunit.sh diff --git a/source4/client/tests/test_cifsdd.sh b/source4/client/tests/test_cifsdd.sh index 08bfb25e808..2268b6a0914 100755 --- a/source4/client/tests/test_cifsdd.sh +++ b/source4/client/tests/test_cifsdd.sh @@ -16,8 +16,8 @@ DOMAIN=$4 . `dirname $0`/../../../testprogs/blackbox/subunit.sh -samba4bindir=`dirname $0`/../../bin -DD=$samba4bindir/cifsdd +samba4bindir="$BUILDDIR/bin" +DD="$samba4bindir/cifsdd$EXEEXT" SHARE=tmp DEBUGLEVEL=1 diff --git a/source4/client/tests/test_smbclient.sh b/source4/client/tests/test_smbclient.sh index 7ff03ba6e2c..7775422e332 100755 --- a/source4/client/tests/test_smbclient.sh +++ b/source4/client/tests/test_smbclient.sh @@ -18,8 +18,8 @@ PREFIX=$5 shift 5 failed=0 -samba4bindir=`dirname $0`/../../bin -smbclient=$samba4bindir/smbclient +samba4bindir="$BUILDDIR/bin" +smbclient="$samba4bindir/smbclient$EXEEXT" . `dirname $0`/../../../testprogs/blackbox/subunit.sh diff --git a/source4/librpc/tests/test_ndrdump.sh b/source4/librpc/tests/test_ndrdump.sh index 511856061ce..dccf86df885 100755 --- a/source4/librpc/tests/test_ndrdump.sh +++ b/source4/librpc/tests/test_ndrdump.sh @@ -8,8 +8,8 @@ failed=0 -samba4bindir=`dirname $0`/../../bin -ndrdump=$samba4bindir/ndrdump +samba4bindir="$BUILDDIR/bin" +ndrdump="$samba4bindir/ndrdump$EXEEXT" files=`dirname $0`/ testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` diff --git a/source4/torture/tests/test_gentest.sh b/source4/torture/tests/test_gentest.sh index 2f4d00dc774..c7f66c8445d 100755 --- a/source4/torture/tests/test_gentest.sh +++ b/source4/torture/tests/test_gentest.sh @@ -17,8 +17,8 @@ DOMAIN=$4 shift 4 failed=0 -samba4bindir=`dirname $0`/../../bin -gentest=$samba4bindir/gentest +samba4bindir="$BUILDDIR/bin" +gentest="$samba4bindir/gentest$EXEEXT" . `dirname $0`/../../../testprogs/blackbox/subunit.sh diff --git a/source4/torture/tests/test_locktest.sh b/source4/torture/tests/test_locktest.sh index 1fe39b4d1d3..a8f11ee0baf 100755 --- a/source4/torture/tests/test_locktest.sh +++ b/source4/torture/tests/test_locktest.sh @@ -18,8 +18,8 @@ PREFIX=$5 shift 5 failed=0 -samba4bindir=`dirname $0`/../../bin -locktest=$samba4bindir/locktest +samba4bindir="$BUILDDIR/bin" +locktest="$samba4bindir/locktest$EXEEXT" . `dirname $0`/../../../testprogs/blackbox/subunit.sh diff --git a/source4/torture/tests/test_masktest.sh b/source4/torture/tests/test_masktest.sh index 59165e47dfd..e4fa65ccfb6 100755 --- a/source4/torture/tests/test_masktest.sh +++ b/source4/torture/tests/test_masktest.sh @@ -18,8 +18,8 @@ PREFIX=$5 shift 5 failed=0 -samba4bindir=`dirname $0`/../../bin -masktest=$samba4bindir/masktest +samba4bindir="$BUILDDIR/bin" +masktest="$samba4bindir/masktest$EXEEXT" . `dirname $0`/../../../testprogs/blackbox/subunit.sh diff --git a/source4/utils/tests/test_net.sh b/source4/utils/tests/test_net.sh index 3406c87cdad..eb598bf5e1c 100755 --- a/source4/utils/tests/test_net.sh +++ b/source4/utils/tests/test_net.sh @@ -9,8 +9,9 @@ shift 4 failed=0 -samba4bindir=`dirname $0`/../../bin -smbclient=$samba4bindir/smbclient +samba4bindir="$BUILDDIR/bin" +smbclient="$samba4bindir/smbclient$EXEEXT" +net="$samba4bindir/net$EXEEXT" testit() { name="$1" @@ -28,7 +29,7 @@ testit() { return $status } -testit "domain join" $VALGRIND bin/net join $DOMAIN $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` +testit "domain join" $VALGRIND $net join $DOMAIN $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` testit "Test login with --machine-pass without kerberos" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --machine-pass -k no || failed=`expr $failed + 1` diff --git a/source4/utils/tests/test_nmblookup.sh b/source4/utils/tests/test_nmblookup.sh index ad9b3ba7998..e2230e162f4 100755 --- a/source4/utils/tests/test_nmblookup.sh +++ b/source4/utils/tests/test_nmblookup.sh @@ -26,11 +26,14 @@ testit() { return $status } -testit "nmblookup -U \$SERVER_IP \$SERVER" bin/nmblookup $TORTURE_OPTIONS -U $SERVER_IP $SERVER -testit "nmblookup -U \$SERVER_IP \$NETBIOSNAME" bin/nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSNAME -testit "nmblookup -U \$SERVER_IP \$NETBIOSALIAS" bin/nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSALIAS -testit "nmblookup \$SERVER" bin/nmblookup $TORTURE_OPTIONS $SERVER -testit "nmblookup \$NETBIOSNAME" bin/nmblookup $TORTURE_OPTIONS $NETBIOSNAME -testit "nmblookup \$NETBIOSALIAS" bin/nmblookup $TORTURE_OPTIONS $NETBIOSALIAS +samba4bindir="$BUILDDIR/bin" +nmblookup="$samba4bindir/nmblookup$EXEEXT" + +testit "nmblookup -U \$SERVER_IP \$SERVER" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $SERVER +testit "nmblookup -U \$SERVER_IP \$NETBIOSNAME" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSNAME +testit "nmblookup -U \$SERVER_IP \$NETBIOSALIAS" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSALIAS +testit "nmblookup \$SERVER" $nmblookup $TORTURE_OPTIONS $SERVER +testit "nmblookup \$NETBIOSNAME" $nmblookup $TORTURE_OPTIONS $NETBIOSNAME +testit "nmblookup \$NETBIOSALIAS" $nmblookup $TORTURE_OPTIONS $NETBIOSALIAS exit $failed diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh index 90e3d374539..b19edfbb380 100755 --- a/testprogs/blackbox/test_kinit.sh +++ b/testprogs/blackbox/test_kinit.sh @@ -19,10 +19,12 @@ PREFIX=$6 shift 6 failed=0 -samba4bindir=`dirname $0`/../../source4/bin -smbclient=$samba4bindir/smbclient -samba4kinit=$samba4bindir/samba4kinit -net=$samba4bindir/net +samba4bindir="$BUILDDIR/bin" +smbclient="$samba4bindir/smbclient$EXEEXT" +samba4kinit="$samba4bindir/samba4kinit$EXEEXT" +net="$samba4bindir/net$EXEEXT" +rkpty="$samba4bindir/rkpty$EXEEXT" +samba4kpasswd="$samba4bindir/samba4kpasswd$EXEEXT" enableaccount="$PYTHON `dirname $0`/../../source4/setup/enableaccount" . `dirname $0`/subunit.sh @@ -68,7 +70,7 @@ testit "enable user with kerberos cache" $VALGRIND $enableaccount nettestuser -H KRB5CCNAME="$PREFIX/tmpuserccache" export KRB5CCNAME -testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` +testit "kinit with user password" $samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` @@ -76,7 +78,7 @@ NEWUSERPASS=testPaSS@34% testit "change user password with 'net password change' (rpc)" $VALGRIND $net password change -W$DOMAIN -U$DOMAIN\\nettestuser%$USERPASS $CONFIGURATION -k no $NEWUSERPASS $@ || failed=`expr $failed + 1` echo $NEWUSERPASS > ./tmpuserpassfile -testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` +testit "kinit with user password" $samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` @@ -95,9 +97,9 @@ send ${NEWUSERPASS}\n expect Success EOF -testit "change user password with kpasswd" $samba4bindir/rkpty ./tmpkpasswdscript $samba4bindir/samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1` +testit "change user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd nettestuser@$REALM || failed=`expr $failed + 1` -testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` +testit "kinit with user password" $samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` NEWUSERPASS=testPaSS@78% echo $NEWUSERPASS > ./tmpuserpassfile @@ -112,9 +114,9 @@ send ${NEWUSERPASS}\n expect Success EOF -testit "set user password with kpasswd" $samba4bindir/rkpty ./tmpkpasswdscript $samba4bindir/samba4kpasswd --cache=$PREFIX/tmpccache nettestuser@$REALM || failed=`expr $failed + 1` +testit "set user password with kpasswd" $rkpty ./tmpkpasswdscript $samba4kpasswd --cache=$PREFIX/tmpccache nettestuser@$REALM || failed=`expr $failed + 1` -testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` +testit "kinit with user password" $samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM || failed=`expr $failed + 1` test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh index 042457e9e3d..e301b5485ad 100755 --- a/testprogs/blackbox/test_ldb.sh +++ b/testprogs/blackbox/test_ldb.sh @@ -32,19 +32,22 @@ check() { return $status } -check "RootDSE" bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || failed=`expr $failed + 1` + +ldbsearch="$BUILDDIR/bin/ldbsearch$EXEEXT" + +check "RootDSE" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || failed=`expr $failed + 1` echo "Getting defaultNamingContext" -BASEDN=`bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'` +BASEDN=`$ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'` echo "BASEDN is $BASEDN" -check "Listing Users" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` +check "Listing Users" $ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` -check "Listing Users (sorted)" bin/ldbsearch -S $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` +check "Listing Users (sorted)" $ldbsearch -S $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1` -check "Listing Groups" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=group)' sAMAccountName || failed=`expr $failed + 1` +check "Listing Groups" $ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=group)' sAMAccountName || failed=`expr $failed + 1` -nentries=`bin/ldbsearch $options -H $p://$SERVER $CONFIGURATION '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))' sAMAccountName | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options -H $p://$SERVER $CONFIGURATION '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))' sAMAccountName | grep sAMAccountName | wc -l` echo "Found $nentries entries" if [ $nentries -lt 10 ]; then echo "Should have found at least 10 entries" @@ -52,66 +55,66 @@ failed=`expr $failed + 1` fi echo "Check rootDSE for Controls" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER -s base -b "" '(objectclass=*)' | grep -i supportedControl | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER -s base -b "" '(objectclass=*)' | grep -i supportedControl | wc -l` if [ $nentries -lt 4 ]; then echo "Should have found at least 4 entries" failed=`expr $failed + 1` fi echo "Test Paged Results Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=paged_results:1:5 '(objectclass=user)' | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=paged_results:1:5 '(objectclass=user)' | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Paged Results Control test returned 0 items" failed=`expr $failed + 1` fi echo "Test Server Sort Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=server_sort:1:0:sAMAccountName '(objectclass=user)' | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=server_sort:1:0:sAMAccountName '(objectclass=user)' | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Server Sort Control test returned 0 items" failed=`expr $failed + 1` fi echo "Test Extended DN Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1 '(objectclass=user)' | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1 '(objectclass=user)' | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Extended DN Control test returned 0 items" failed=`expr $failed + 1` fi -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:0 '(objectclass=user)' | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:0 '(objectclass=user)' | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Extended DN Control test returned 0 items" failed=`expr $failed + 1` fi -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:1 '(objectclass=user)' | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=extended_dn:1:1 '(objectclass=user)' | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Extended DN Control test returned 0 items" failed=`expr $failed + 1` fi echo "Test Domain scope Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=domain_scope:1 '(objectclass=user)' | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=domain_scope:1 '(objectclass=user)' | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Extended Domain scope Control test returned 0 items" failed=`expr $failed + 1` fi echo "Test Attribute Scope Query Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=asq:1:member -s base -b "CN=Administrators,CN=Builtin,$BASEDN" | grep sAMAccountName | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=asq:1:member -s base -b "CN=Administrators,CN=Builtin,$BASEDN" | grep sAMAccountName | wc -l` if [ $nentries -lt 1 ]; then echo "Attribute Scope Query test returned 0 items" failed=`expr $failed + 1` fi echo "Test Search Options Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2 '(objectclass=crossRef)' | grep crossRef | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2 '(objectclass=crossRef)' | grep crossRef | wc -l` if [ $nentries -lt 1 ]; then echo "Search Options Control Query test returned 0 items" failed=`expr $failed + 1` fi echo "Test Search Options Control with Domain Scope Control" -nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2,domain_scope:1 '(objectclass=crossRef)' | grep crossRef | wc -l` +nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER --controls=search_options:1:2,domain_scope:1 '(objectclass=crossRef)' | grep crossRef | wc -l` if [ $nentries -lt 1 ]; then echo "Search Options Control Query test returned 0 items" failed=`expr $failed + 1` @@ -130,7 +133,7 @@ wellknown_object_test() { basedns=" " for dn in ${basedns}; do echo "Test ${dn} => ${object}" - r=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectClass=*)' -b "${dn}" | grep 'dn: '` + r=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectClass=*)' -b "${dn}" | grep 'dn: '` n=`echo "${r}" | grep 'dn: ' | wc -l` c=`echo "${r}" | grep "${object}" | wc -l` @@ -181,18 +184,18 @@ if [ x"$st" != x"0" ]; then fi echo "Getting HEX GUID/SID of $BASEDN" -HEXDN=`bin/ldbsearch $CONFIGURATION $options -b "$BASEDN" -H $p://$SERVER -s base "(objectClass=*)" --controls=extended_dn:1:0 distinguishedName | grep 'distinguishedName: ' | cut -d ' ' -f2-` +HEXDN=`$ldbsearch $CONFIGURATION $options -b "$BASEDN" -H $p://$SERVER -s base "(objectClass=*)" --controls=extended_dn:1:0 distinguishedName | grep 'distinguishedName: ' | cut -d ' ' -f2-` HEXGUID=`echo "$HEXDN" | cut -d ';' -f1` echo "HEXGUID[$HEXGUID]" echo "Getting STR GUID/SID of $BASEDN" -STRDN=`bin/ldbsearch $CONFIGURATION $options -b "$BASEDN" -H $p://$SERVER -s base "(objectClass=*)" --controls=extended_dn:1:1 distinguishedName | grep 'distinguishedName: ' | cut -d ' ' -f2-` +STRDN=`$ldbsearch $CONFIGURATION $options -b "$BASEDN" -H $p://$SERVER -s base "(objectClass=*)" --controls=extended_dn:1:1 distinguishedName | grep 'distinguishedName: ' | cut -d ' ' -f2-` echo "STRDN: $STRDN" STRGUID=`echo "$STRDN" | cut -d ';' -f1` echo "STRGUID[$STRGUID]" echo "Getting STR GUID/SID of $BASEDN" -STRDN=`bin/ldbsearch $CONFIGURATION $options -b "$BASEDN" -H $p://$SERVER -s base "(objectClass=*)" --controls=extended_dn:1:1 | grep 'dn: ' | cut -d ' ' -f2-` +STRDN=`$ldbsearch $CONFIGURATION $options -b "$BASEDN" -H $p://$SERVER -s base "(objectClass=*)" --controls=extended_dn:1:1 | grep 'dn: ' | cut -d ' ' -f2-` echo "STRDN: $STRDN" STRSID=`echo "$STRDN" | cut -d ';' -f2` echo "STRSID[$STRSID]" @@ -200,7 +203,7 @@ echo "STRSID[$STRSID]" SPECIALDNS="$HEXGUID $STRGUID $STRSID" for SPDN in $SPECIALDNS; do echo "Search for $SPDN" - nentries=`bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER -s base -b "$SPDN" '(objectClass=*)' | grep "dn: $BASEDN" | wc -l` + nentries=`$ldbsearch $options $CONFIGURATION -H $p://$SERVER -s base -b "$SPDN" '(objectClass=*)' | grep "dn: $BASEDN" | wc -l` if [ $nentries -lt 1 ]; then echo "Special search returned 0 items" failed=`expr $failed + 1`