diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-05-28 08:11:05 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-05-28 08:11:05 +1000 |
commit | 51ae2302a68033b1b79a4ebc8d4cbab64adcf843 (patch) | |
tree | d8b1af54efe4ec70607ef2bcbd873c2cd667d894 /testprogs | |
parent | 5d0d239d1ab826c91839a603f93d2c0061658888 (diff) | |
parent | 52b230141b5ad9f317f97e7d257703614bab3985 (diff) | |
download | samba-51ae2302a68033b1b79a4ebc8d4cbab64adcf843.tar.gz samba-51ae2302a68033b1b79a4ebc8d4cbab64adcf843.tar.bz2 samba-51ae2302a68033b1b79a4ebc8d4cbab64adcf843.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-abartlet
It seems the format of main.mk changed in my sleep...
Conflicts:
source/main.mk
(This used to be commit 56f2288e4f4f1aa70d11fc5f118458baf5803627)
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/ejs/argv.js | 14 | ||||
-rwxr-xr-x | testprogs/ejs/echo.js | 235 | ||||
-rwxr-xr-x | testprogs/ejs/ejsnet.js | 46 | ||||
-rw-r--r-- | testprogs/ejs/ejsnet/nethost.js | 45 | ||||
-rw-r--r-- | testprogs/ejs/ejsnet/netusr.js | 86 | ||||
-rw-r--r-- | testprogs/ejs/loadparm.js | 25 | ||||
-rwxr-xr-x | testprogs/ejs/nbtstats | 33 | ||||
-rw-r--r-- | testprogs/ejs/resolveName.js | 13 | ||||
-rwxr-xr-x | testprogs/ejs/samr.js | 126 |
9 files changed, 0 insertions, 623 deletions
diff --git a/testprogs/ejs/argv.js b/testprogs/ejs/argv.js deleted file mode 100644 index ffb6e007eb..0000000000 --- a/testprogs/ejs/argv.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - demonstrate use of GetOptions -*/ - -var options = GetOptions(ARGV, - "POPT_AUTOHELP", - "POPT_COMMON_SAMBA", - "myopt=s", - "intopt=i", - "noopt"); - -println("You called this script with arguments:"); - -printVars(options); 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/ejsnet.js b/testprogs/ejs/ejsnet.js deleted file mode 100755 index a5570de34c..0000000000 --- a/testprogs/ejs/ejsnet.js +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env smbscript - -libinclude("base.js"); - -/* note: these require specifying a proper path in "js include" parameter */ -libinclude("ejsnet/netusr.js"); -libinclude("ejsnet/nethost.js"); - -function PrintNetHelp() -{ - println("Usage: ejsnet.js <cmd> [options]"); -} - -/* here we start */ - -var options = GetOptions(ARGV, - "POPT_AUTOHELP", - "POPT_COMMON_SAMBA", - "POPT_COMMON_CREDENTIALS"); -if (options == undefined) { - PrintNetHelp(); - return -1; -} - -if (options.ARGV.length < 1) { - PrintNetHelp(); - return -1; -} - -/* use command line creds if available */ -var creds = options.get_credentials(); -var ctx = NetContext(creds); - -var cmd = options.ARGV[0]; -if (cmd == "user") { - UserManager(ctx, options); - -} else if (cmd == "host") { - HostManager(ctx, options); - -} else { - PrintNetHelp(); - return -1; -} - -return 0; diff --git a/testprogs/ejs/ejsnet/nethost.js b/testprogs/ejs/ejsnet/nethost.js deleted file mode 100644 index 9e11ae89c5..0000000000 --- a/testprogs/ejs/ejsnet/nethost.js +++ /dev/null @@ -1,45 +0,0 @@ -function PrintNetHostHelp() -{ - println("Host management - available commands:"); - println("\t domainlist - list users in specified domain"); -} - - -function ListDomains(hostCtx) -{ - var domain; - - var list = hostCtx.DomainList(); - if (list == undefined) { - println("Error when listing domains"); - return -1; - } - - for (var i = 0; i < list.Count; i++) { - domain = list.Domains[i]; - printf("%s\n", domain.Name); - } - - printf("\nResult: %s\n", list.Status.errstr); -} - - -function HostManager(ctx, options) -{ - var hostCtx; - - if (options.ARGV.length < 2) { - PrintNetHostHelp(); - return -1; - } - - var hostCmd = options.ARGV[1]; - - if (hostCmd == "domainlist") { - hostCtx = ctx.HostMgr(); - ListDomains(hostCtx); - - } else { - println("unknown command"); - } -} diff --git a/testprogs/ejs/ejsnet/netusr.js b/testprogs/ejs/ejsnet/netusr.js deleted file mode 100644 index da6e851ce7..0000000000 --- a/testprogs/ejs/ejsnet/netusr.js +++ /dev/null @@ -1,86 +0,0 @@ -function PrintNetUsrHelp(options) -{ - println("User management - available commands:"); - println("\t list - list users in specified domain"); - println("\t info - display user account information"); -} - - -function ListUsers(usrCtx) -{ - var list, user; - var finished = false; - - for (list = usrCtx.List(list); list.Status.is_ok && !finished; list = usrCtx.List(list)) { - for (i = 0; i < list.Count; i++) { - user = list.Users[i]; - printf("%s\n", user.Username); - } - - finished = list.EndOfList; - } - - printf("\nResult: %s\n", list.Status.errstr); -} - - -function UserInfo(usrCtx, username) -{ - var info; - - info = usrCtx.Info(username); - if (info == null) { - println("Account unknown"); - return -1; - } - - println("User account info:\n"); - printf("AccountName = %s\n", info.AccountName); - printf("Description = %s\n", info.Description); - printf("FullName = %s\n", info.FullName); - printf("AcctExpiry = %s\n", info.AcctExpiry); -} - - -function UserManager(ctx, options) -{ - var usrCtx; - - if (options.ARGV.length < 2) { - PrintNetUsrHelp(options); - return -1; - - } - - var usrCmd = options.ARGV[1]; - - if (usrCmd == "create") { - - } else if (usrCmd == "info") { - var userName; - - if (options.ARGV.length > 2) { - userName = options.ARGV[2]; - } else { - println("No username provided"); - return -1; - } - usrCtx = ctx.UserMgr(); - - UserInfo(usrCtx, userName); - - } else if (usrCmd == "list") { - - if (options.ARGV.length > 2) { - usrCtx = ctx.UserMgr(options.ARGV[2]); - } else { - usrCtx = ctx.UserMgr(); - } - - ListUsers(usrCtx); - - } else { - println("Unknown command specified."); - PrintNetUsrHelp(options); - } -} 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/nbtstats b/testprogs/ejs/nbtstats deleted file mode 100755 index 1c8a6a5e7e..0000000000 --- a/testprogs/ejs/nbtstats +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env smbscript -/* - demonstrate access to irpc calls from ejs -*/ - -var options = GetOptions(ARGV, - "POPT_AUTOHELP", - "POPT_COMMON_SAMBA"); -if (options == undefined) { - println("Failed to parse options"); - return -1; -} - -var conn = new Object(); -var irpc = irpc_init(); - -status = irpc_connect(conn, "nbt_server"); -assert(status.is_ok == true); - -io = new Object(); -io.input = new Object(); -io.input.level = irpc.NBTD_INFO_STATISTICS; -status = irpc.nbtd_information(conn, io); -assert(status.is_ok == true); -assert(io.results.length == 1); - -print("nbt_server statistics:\n"); -stats = io.results[0].info.stats; - -for (r in stats) { - print("\t" + r + ":\t" + stats[r] + "\n"); -} -return 0; 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; |