diff options
Diffstat (limited to 'testprogs/ejs')
-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 |
4 files changed, 0 insertions, 399 deletions
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; |