diff options
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/blackbox/ndrdump/samr-CreateUser-in.dat | bin | 0 -> 60 bytes | |||
-rw-r--r-- | testprogs/blackbox/ndrdump/samr-CreateUser-out.dat | bin | 0 -> 32 bytes | |||
-rwxr-xr-x | testprogs/blackbox/subunit.sh | 67 | ||||
-rwxr-xr-x | testprogs/blackbox/test_cifsdd.sh | 24 | ||||
-rwxr-xr-x | testprogs/blackbox/test_gentest.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_kinit.sh | 26 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ldb.sh | 2 | ||||
-rwxr-xr-x | testprogs/blackbox/test_locktest.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_masktest.sh | 15 | ||||
-rwxr-xr-x | testprogs/blackbox/test_ndrdump.sh | 20 | ||||
-rwxr-xr-x | testprogs/blackbox/test_smbclient.sh | 43 | ||||
-rwxr-xr-x | testprogs/blackbox/test_wbinfo.sh | 187 | ||||
-rwxr-xr-x | testprogs/ejs/echo.js | 235 | ||||
-rw-r--r-- | testprogs/ejs/loadparm.js | 25 | ||||
-rw-r--r-- | testprogs/ejs/resolveName.js | 13 | ||||
-rwxr-xr-x | testprogs/ejs/samr.js | 126 |
16 files changed, 320 insertions, 493 deletions
diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat Binary files differnew file mode 100644 index 0000000000..a5840e1f7f --- /dev/null +++ b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat Binary files differnew file mode 100644 index 0000000000..cf9131dba9 --- /dev/null +++ b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh new file mode 100755 index 0000000000..100dfd1a46 --- /dev/null +++ b/testprogs/blackbox/subunit.sh @@ -0,0 +1,67 @@ +# +# subunit.sh: shell functions to report test status via the subunit protocol. +# Copyright (C) 2006 Robert Collins <robertc@robertcollins.net> +# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +subunit_start_test () { + # emit the current protocol start-marker for test $1 + echo "test: $1" +} + + +subunit_pass_test () { + # emit the current protocol test passed marker for test $1 + echo "success: $1" +} + + +subunit_fail_test () { + # emit the current protocol fail-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using <<END syntax. + echo "failure: $1 [" + cat - + echo "]" +} + + +subunit_error_test () { + # emit the current protocol error-marker for test $1, and emit stdin as + # the error text. + # we use stdin because the failure message can be arbitrarily long, and this + # makes it convenient to write in scripts (using <<END syntax. + echo "error: $1 [" + cat - + echo "]" +} + +testit () { + name="$1" + shift + cmdline="$*" + subunit_start_test "$name" + output=`$cmdline 2>&1` + status=$? + if [ x$status = x0 ]; then + subunit_pass_test "$name" + else + echo $output | subunit_fail_test "$name" + fi + return $status +} diff --git a/testprogs/blackbox/test_cifsdd.sh b/testprogs/blackbox/test_cifsdd.sh index 23df04c84c..43564a0c77 100755 --- a/testprogs/blackbox/test_cifsdd.sh +++ b/testprogs/blackbox/test_cifsdd.sh @@ -14,40 +14,24 @@ USERNAME=$2 PASSWORD=$3 DOMAIN=$4 +. `dirname $0`/subunit.sh + samba4bindir=`dirname $0`/../../source/bin DD=$samba4bindir/cifsdd SHARE=tmp DEBUGLEVEL=1 -failed=0 - -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - failed=`expr $failed + 1` - fi - return $status -} - runcopy() { message="$1" shift testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \ - "$@" + "$@" || failed=`expr $failed + 1` } compare() { - testit "$1" cmp "$2" "$3" + testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1` } sourcepath=tempfile.src.$$ diff --git a/testprogs/blackbox/test_gentest.sh b/testprogs/blackbox/test_gentest.sh index 89cc8c2795..ec6f0e422b 100755 --- a/testprogs/blackbox/test_gentest.sh +++ b/testprogs/blackbox/test_gentest.sh @@ -20,20 +20,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin gentest=$samba4bindir/gentest -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh cat <<EOF > st/gentest.ignore all_info.out.fname diff --git a/testprogs/blackbox/test_kinit.sh b/testprogs/blackbox/test_kinit.sh index dbcdcf1112..d3cece0af7 100755 --- a/testprogs/blackbox/test_kinit.sh +++ b/testprogs/blackbox/test_kinit.sh @@ -23,23 +23,9 @@ samba4bindir=`dirname $0`/../../source/bin smbclient=$samba4bindir/smbclient samba4kinit=$samba4bindir/samba4kinit net=$samba4bindir/net -enableaccount="$samba4bindir/smbpython `dirname $0`/../../source/setup/enableaccount" - -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +enableaccount="$PYTHON `dirname $0`/../../source/setup/enableaccount" +. `dirname $0`/subunit.sh test_smbclient() { name="$1" @@ -86,6 +72,14 @@ testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tm test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` +NEWUSERPASS=testPaSS@34% +testit "change user password" $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` + +test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1` + KRB5CCNAME="$PREFIX/tmpccache" export KRB5CCNAME diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh index 4067a7fc43..8e1af99719 100755 --- a/testprogs/blackbox/test_ldb.sh +++ b/testprogs/blackbox/test_ldb.sh @@ -14,6 +14,8 @@ PREFIX=$3 shift 2 options="$*" +. `dirname $0`/subunit.sh + check() { name="$1" shift diff --git a/testprogs/blackbox/test_locktest.sh b/testprogs/blackbox/test_locktest.sh index c08b408107..88fa0ef892 100755 --- a/testprogs/blackbox/test_locktest.sh +++ b/testprogs/blackbox/test_locktest.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin locktest=$samba4bindir/locktest -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh testit "locktest" $VALGRIND $locktest //$SERVER/test1 //$SERVER/test2 --num-ops=100 -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_masktest.sh b/testprogs/blackbox/test_masktest.sh index ef429a1fb0..c1f765c1dd 100755 --- a/testprogs/blackbox/test_masktest.sh +++ b/testprogs/blackbox/test_masktest.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin masktest=$samba4bindir/masktest -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh testit "masktest" $VALGRIND $masktest //$SERVER/tmp --num-ops=200 --dieonerror -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh new file mode 100755 index 0000000000..089a7c3a2b --- /dev/null +++ b/testprogs/blackbox/test_ndrdump.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Blackbox tests for masktest +# Copyright (C) 2008 Andrew Tridgell +# Copyright (C) 2008 Andrew Bartlett +# based on test_smbclient.sh + +. `dirname $0`/subunit.sh + +failed=0 + +samba4bindir=`dirname $0`/../../source/bin +ndrdump=$samba4bindir/ndrdump +files=`dirname $0`/ndrdump + +testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with out" $VALGRIND $ndrdump samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with --context-file" $VALGRIND $ndrdump --context-file $files/samr-CreateUser-in.dat samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1` +testit "ndrdump with validate" $VALGRIND $ndrdump --validate samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1` + +exit $failed diff --git a/testprogs/blackbox/test_smbclient.sh b/testprogs/blackbox/test_smbclient.sh index a803d83363..d2c5c675e2 100755 --- a/testprogs/blackbox/test_smbclient.sh +++ b/testprogs/blackbox/test_smbclient.sh @@ -21,20 +21,7 @@ failed=0 samba4bindir=`dirname $0`/../../source/bin smbclient=$samba4bindir/smbclient -testit() { - name="$1" - shift - cmdline="$*" - echo "test: $name" - $cmdline - status=$? - if [ x$status = x0 ]; then - echo "success: $name" - else - echo "failure: $name" - fi - return $status -} +. `dirname $0`/subunit.sh runcmd() { name="$1" @@ -86,11 +73,29 @@ testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1` runcmd "Creating directory, Changing directory, Going back" 'mkdir bla; cd bla; cd ..; rmdir bla' || failed=`expr $failed + 1` # enable recurse, create nested directory runcmd "Creating nested directory" 'mkdir bla/bloe' || failed=`expr $failed + 1` -# remove parent directory -runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1` # remove child directory +runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1` +# remove parent directory runcmd "Removing directory" 'rmdir bla'|| failed=`expr $failed + 1` +# enable recurse, create nested directory +runcmd "Creating nested directory" 'mkdir bla' || failed=`expr $failed + 1` +# rename bla to bla2 +runcmd "rename of nested directory" 'rename bla bla2' || failed=`expr $failed + 1` +# deltree +runcmd "deltree of nested directory" 'deltree bla2' || failed=`expr $failed + 1` # run fsinfo +runcmd "Getting file system info" 'fsinfo allocation'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo volume'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo volumeinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo sizeinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo deviceinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo attributeinfo'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo volume-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo size-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo device-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo attribute-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo quota-information'|| failed=`expr $failed + 1` +runcmd "Getting file system info" 'fsinfo fullsize-information'|| failed=`expr $failed + 1` runcmd "Getting file system info" 'fsinfo objectid'|| failed=`expr $failed + 1` # put that file @@ -98,6 +103,7 @@ runcmd "Putting file" 'put tmpfile'|| failed=`expr $failed + 1` # get that file mv tmpfile tmpfile-old runcmd "Getting file" 'get tmpfile'|| failed=`expr $failed + 1` +runcmd "Getting file EA info" 'eainfo tmpfile'|| failed=`expr $failed + 1` # remove that file runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1` # compare locally @@ -111,6 +117,11 @@ testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1` # remove that file runcmd "Removing file" 'rm tmpfilex'|| failed=`expr $failed + 1` +runcmd "Lookup name" "lookup $DOMAIN\\$USERNAME" || failed=`expr $failed + 1` + +#Fails unless there are privilages +#runcmd "Lookup privs of name" "privileges $DOMAIN\\$USERNAME" || failed=`expr $failed + 1` + # do some simple operations using old protocol versions runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 || failed=`expr $failed + 1` runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 || failed=`expr $failed + 1` diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh new file mode 100755 index 0000000000..ec8b9ebd44 --- /dev/null +++ b/testprogs/blackbox/test_wbinfo.sh @@ -0,0 +1,187 @@ +#!/bin/sh +# Blackbox test for wbinfo +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET +EOF +exit 1; +fi + +DOMAIN=$1 +USERNAME=$2 +PASSWORD=$3 +TARGET=$4 +shift 4 + +failed=0 +samba4bindir=`dirname $0`/../../source/bin +wbinfo=$samba4bindir/wbinfo + +. `dirname $0`/subunit.sh + +testfail() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "failure: $name" + else + echo "success: $name" + fi + return $status +} + +knownfail() { + name="$1" + shift + cmdline="$*" + echo "test: $name" + $cmdline + status=$? + if [ x$status = x0 ]; then + echo "failure: $name [unexpected success]" + status=1 + else + echo "knownfail: $name" + status=0 + fi + return $status +} + + +testit "wbinfo -u against $TARGET" $wbinfo -u || failed=`expr $failed + 1` +# Does not work yet +knownfail "wbinfo -g against $TARGET" $wbinfo -g || failed=`expr $failed + 1` +knownfail "wbinfo -N against $TARGET" $wbinfo -N || failed=`expr $failed + 1` +knownfail "wbinfo -I against $TARGET" $wbinfo -I || failed=`expr $failed + 1` +testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` +admin_sid=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1` +echo "$DOMAIN/$USERNAME resolved to $admin_sid" + +testit "wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed=`expr $failed + 1` +admin_name=`wbinfo -s $admin_sid | cut -d " " -f1| tr a-z A-Z` +echo "$admin_sid resolved to $admin_name" + +tested_name=`echo $DOMAIN/$USERNAME | tr a-z A-Z` + +echo "test: wbinfo -s check for sane mapping" +if test x$admin_name != x$tested_name; then + echo "$admin_name does not match $tested_name" + echo "failure: wbinfo -s check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -s check for sane mapping" +fi + +testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed=`expr $failed + 1` +test_sid=`$wbinfo -n $tested_name | cut -d " " -f1` + +echo "test: wbinfo -n check for sane mapping" +if test x$admin_sid != x$test_sid; then + echo "$admin_sid does not match $test_sid" + echo "failure: wbinfo -n check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -n check for sane mapping" +fi + +testit "wbinfo -U against $TARGET" $wbinfo -U 30000 || failed=`expr $failed + 1` + +echo "test: wbinfo -U check for sane mapping" +sid_for_30000=`$wbinfo -U 30000` +if test x$sid_for_30000 != "xS-1-22-1-30000"; then + echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000" + echo "failure: wbinfo -U check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -U check for sane mapping" +fi + +admin_uid=`wbinfo -U $admin_sid` + +testit "wbinfo -G against $TARGET" $wbinfo -G 30000 || failed=`expr $failed + 1` + +echo "test: wbinfo -G check for sane mapping" +sid_for_30000=`$wbinfo -G 30000` +if test x$sid_for_30000 != "xS-1-22-2-30000"; then + echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000" + echo "failure: wbinfo -G check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -G check for sane mapping" +fi + +testit "wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed=`expr $failed + 1` + +echo "test: wbinfo -S check for sane mapping" +uid_for_sid=`$wbinfo -S S-1-22-1-30000` +if test 0$uid_for_sid -ne 30000; then + echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000" + echo "failure: wbinfo -S check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -S check for sane mapping" +fi + +testfail "wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed=`expr $failed + 1` + +testit "wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed=`expr $failed + 1` + +echo "test: wbinfo -Y check for sane mapping" +gid_for_sid=`$wbinfo -Y S-1-22-2-30000` +if test 0$gid_for_sid -ne 30000; then + echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000" + echo "failure: wbinfo -Y check for sane mapping" + failed=`expr $failed + 1` +else + echo "success: wbinfo -Y check for sane mapping" +fi + +testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed=`expr $failed + 1` + +testit "wbinfo -t against $TARGET" $wbinfo -t || failed=`expr $failed + 1` + +testit "wbinfo --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed=`expr $failed + 1` +testit "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1` +testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=`expr $failed + 1` + +echo "test: wbinfo --own-domain against $TARGET check output" +own_domain=`wbinfo --own-domain` +if test x$own_domain = x$DOMAIN; then + echo "success: wbinfo --own-domain against $TARGET check output" +else + echo "Own domain reported as $own_domain instead of $DOMAIN" + echo "failure: wbinfo --own-domain against $TARGET check output" +fi + +# this does not work +knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence +knownfail "wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed=`expr $failed + 1` + +testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=`expr $failed + 1` + +# this does not work +knownfail "wbinfo --uid-info against $TARGET" $wbinfo --uid-info $admin_sid +knownfail "wbinfo --group-info against $TARGET" $wbinfo --group-info "S-1-22-2-0" +knownfail "wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME" + +testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=`expr $failed + 1` + +testit "wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed=`expr $failed + 1` + +testit "wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1` + +# this does not work +knwonfail "wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN + +testit "wbinfo -p against $TARGET" $wbinfo -p || failed=`expr $failed + 1` + +testit "wbinfo -K against $TARGET with domain creds" $wbinfo -K "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1` + +testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=`expr $failed + 1` + +exit $failed + diff --git a/testprogs/ejs/echo.js b/testprogs/ejs/echo.js deleted file mode 100755 index 3750baf0fb..0000000000 --- a/testprogs/ejs/echo.js +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env smbscript -/* - test echo pipe calls from ejs -*/ - -var options = GetOptions(ARGV, - "POPT_AUTOHELP", - "POPT_COMMON_SAMBA", - "POPT_COMMON_CREDENTIALS"); -if (options == undefined) { - println("Failed to parse options"); - return -1; -} - -libinclude("base.js"); - -/* - generate a ramp as an integer array - */ -function ramp_array(N) -{ - var a = new Array(N); - var data = datablob_init(); - for (i=0;i<N;i++) { - a[i] = i; - } - return data.blobFromArray(a); -} - - -/* - test the echo_AddOne interface -*/ -function test_AddOne(echo) -{ - var io = irpcObj(); - - print("Testing echo_AddOne\n"); - - for (i=0;i<10;i++) { - io.input.in_data = i; - status = echo.echo_AddOne(io); - check_status_ok(status); - assert(io.output.out_data == i + 1); - } -} - -/* - test the echo_EchoData interface -*/ -function test_EchoData(echo) -{ - var io = irpcObj(); - - print("Testing echo_EchoData\n"); - - for (i=0; i<30; i=i+5) { - io.input.len = i; - io.input.in_data = ramp_array(i); - status = echo.echo_EchoData(io); - check_status_ok(status); - assert(true == echo.blobCompare(io.input.in_data, io.output.out_data)); - } -} - - -/* - test the echo_SinkData interface -*/ -function test_SinkData(echo) -{ - var io = irpcObj(); - - print("Testing echo_SinkData\n"); - - for (i=0; i<30; i=i+5) { - io.input.len = i; - io.input.data = ramp_array(i); - status = echo.echo_SinkData(io); - check_status_ok(status); - } -} - - -/* - test the echo_SourceData interface -*/ -function test_SourceData(echo) -{ - var io = irpcObj(); - - print("Testing echo_SourceData\n"); - - for (i=0; i<30; i=i+5) { - io.input.len = i; - status = echo.echo_SourceData(io); - check_status_ok(status); - correct = ramp_array(i); - assert(true == echo.blobCompare(correct, io.output.data)); - } -} - - -/* - test the echo_TestCall interface -*/ -function test_TestCall(echo) -{ - var io = irpcObj(); - - print("Testing echo_TestCall\n"); - - io.input.s1 = "my test string"; - status = echo.echo_TestCall(io); - check_status_ok(status); - assert("this is a test string" == io.output.s2); -} - -/* - test the echo_TestCall2 interface -*/ -function test_TestCall2(echo) -{ - var io = irpcObj(); - - print("Testing echo_TestCall2\n"); - - for (i=1;i<=7;i++) { - io.input.level = i; - status = echo.echo_TestCall2(io); - check_status_ok(status); - } -} - -/* - test the echo_TestSleep interface -*/ -function test_TestSleep(echo) -{ - var io = irpcObj(); - - print("Testing echo_TestSleep\n"); - - io.input.seconds = 1; - status = echo.echo_TestSleep(io); - check_status_ok(status); -} - -/* - test the echo_TestEnum interface -*/ -function test_TestEnum(echo) -{ - var io = irpcObj(); - - print("Testing echo_TestEnum\n"); - - io.input.foo1 = echo.ECHO_ENUM1; - io.input.foo2 = new Object(); - io.input.foo2.e1 = echo.ECHO_ENUM1; - io.input.foo2.e2 = echo.ECHO_ENUM1_32; - io.input.foo3 = new Object(); - io.input.foo3.e1 = echo.ECHO_ENUM2; - status = echo.echo_TestEnum(io); - check_status_ok(status); - assert(io.output.foo1 == echo.ECHO_ENUM1); - assert(io.output.foo2.e1 == echo.ECHO_ENUM2); - assert(io.output.foo2.e2 == echo.ECHO_ENUM1_32); - assert(io.output.foo3.e1 == echo.ECHO_ENUM2); -} - -/* - test the echo_TestSurrounding interface -*/ -function test_TestSurrounding(echo) -{ - var io = irpcObj(); - - print("Testing echo_TestSurrounding\n"); - - io.input.data = new Object(); - io.input.data.x = 10; - io.input.data.surrounding = new Array(10); - status = echo.echo_TestSurrounding(io); - check_status_ok(status); - assert(io.output.data.surrounding.length == 20); - check_array_zero(io.output.data.surrounding); -} - -/* - test the echo_TestDoublePointer interface -*/ -function test_TestDoublePointer(echo) -{ - var io = irpcObj(); - - print("Testing echo_TestDoublePointer\n"); - - io.input.data = 7; - status = echo.echo_TestDoublePointer(io); - check_status_ok(status); - assert(io.input.data == io.input.data); -} - - -if (options.ARGV.length != 1) { - println("Usage: echo.js <BINDING>"); - return -1; -} -var binding = options.ARGV[0]; -var echo = rpcecho_init(); -datablob_init(echo); - -print("Connecting to " + binding + "\n"); -status = echo.connect(binding); -if (status.is_ok != true) { - printf("Failed to connect to %s - %s\n", binding, status.errstr); - return; -} - -test_AddOne(echo); -test_EchoData(echo); -test_SinkData(echo); -test_SourceData(echo); - -print("SKIPPING test_TestCall as pidl cannot generate code for it\n"); -/* test_TestCall(echo); */ -test_TestCall2(echo); -test_TestSleep(echo); -test_TestEnum(echo); -test_TestSurrounding(echo); -test_TestDoublePointer(echo); - -println("All OK\n"); -return 0; diff --git a/testprogs/ejs/loadparm.js b/testprogs/ejs/loadparm.js deleted file mode 100644 index f56ca9f7fc..0000000000 --- a/testprogs/ejs/loadparm.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - demonstrate access to loadparm functions from ejs -*/ - -loadparm_init(local); - -function showParameter(name) { - print(name + ": "); - printVars(get(name)); -} - -for (v in ARGV) { - showParameter(ARGV[v]); -} - -print("defined services: "); -printVars(services()); - -showParameter("server services"); -showParameter("netbios name"); -showParameter("security"); -showParameter("workgroup"); -showParameter("log level"); -showParameter("server signing"); -showParameter("interfaces"); diff --git a/testprogs/ejs/resolveName.js b/testprogs/ejs/resolveName.js deleted file mode 100644 index 1619b69d69..0000000000 --- a/testprogs/ejs/resolveName.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Demonstrate use of resolveName() js function -*/ - -var result = new Object(); - -res = resolveName(result, ARGV[0]); - -if (res.is_ok) { - println(result.value); -} else { - println(res.errstr); -} diff --git a/testprogs/ejs/samr.js b/testprogs/ejs/samr.js deleted file mode 100755 index fbdae974be..0000000000 --- a/testprogs/ejs/samr.js +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env smbscript -/* - test samr calls from ejs -*/ - -var options = GetOptions(ARGV, - "POPT_AUTOHELP", - "POPT_COMMON_SAMBA", - "POPT_COMMON_CREDENTIALS"); -if (options == undefined) { - println("Failed to parse options"); - return -1; -} - -libinclude("base.js"); -libinclude("samr.js"); - - -/* - test the samr_Connect interface -*/ -function test_Connect(samr) -{ - print("Testing samr_Connect\n"); - return samrConnect(samr); -} - - -/* - test the samr_LookupDomain interface -*/ -function test_LookupDomain(samr, handle, domain) -{ - print("Testing samr_LookupDomain\n"); - return samrLookupDomain(samr, handle, domain); -} - -/* - test the samr_OpenDomain interface -*/ -function test_OpenDomain(samr, handle, sid) -{ - print("Testing samr_OpenDomain\n"); - return samrOpenDomain(samr, handle, sid); -} - -/* - test the samr_EnumDomainUsers interface -*/ -function test_EnumDomainUsers(samr, dom_handle) -{ - var i, users; - print("Testing samr_EnumDomainUsers\n"); - users = samrEnumDomainUsers(samr, dom_handle); - print("Found " + users.length + " users\n"); - for (i=0;i<users.length;i++) { - println("\t" + users[i].name + "\t(" + users[i].idx + ")"); - } -} - -/* - test the samr_EnumDomainGroups interface -*/ -function test_EnumDomainGroups(samr, dom_handle) -{ - print("Testing samr_EnumDomainGroups\n"); - var i, groups = samrEnumDomainGroups(samr, dom_handle); - print("Found " + groups.length + " groups\n"); - for (i=0;i<groups.length;i++) { - println("\t" + groups[i].name + "\t(" + groups[i].idx + ")"); - } -} - -/* - test domain specific ops -*/ -function test_domain_ops(samr, dom_handle) -{ - test_EnumDomainUsers(samr, dom_handle); - test_EnumDomainGroups(samr, dom_handle); -} - - - -/* - test the samr_EnumDomains interface -*/ -function test_EnumDomains(samr, handle) -{ - var i, domains; - print("Testing samr_EnumDomains\n"); - - domains = samrEnumDomains(samr, handle); - print("Found " + domains.length + " domains\n"); - for (i=0;i<domains.length;i++) { - print("\t" + domains[i].name + "\n"); - } - for (i=0;i<domains.length;i++) { - print("Testing domain " + domains[i].name + "\n"); - sid = samrLookupDomain(samr, handle, domains[i].name); - dom_handle = test_OpenDomain(samr, handle, sid); - test_domain_ops(samr, dom_handle); - samrClose(samr, dom_handle); - } -} - -if (options.ARGV.length != 1) { - println("Usage: samr.js <BINDING>"); - return -1; -} -var binding = options.ARGV[0]; -var samr = samr_init(); - -print("Connecting to " + binding + "\n"); -status = samr.connect(binding); -if (status.is_ok != true) { - print("Failed to connect to " + binding + " - " + status.errstr + "\n"); - return -1; -} - -handle = test_Connect(samr); -test_EnumDomains(samr, handle); -samrClose(samr, handle); - -print("All OK\n"); -return 0; |