diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-11 00:23:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:19:33 -0500 |
commit | f9ff72cbda6b4e59448fd79ef9e12f264d48015f (patch) | |
tree | d0bff5e1f6ae70bb9ba3ec563c7ed03cf0cc5fa2 /testprogs/ejs | |
parent | b2f132182174d13c8bcb535f62522687675947c2 (diff) | |
download | samba-f9ff72cbda6b4e59448fd79ef9e12f264d48015f.tar.gz samba-f9ff72cbda6b4e59448fd79ef9e12f264d48015f.tar.bz2 samba-f9ff72cbda6b4e59448fd79ef9e12f264d48015f.zip |
r8298: - started building a library of js routines in scripting/libjs/
- switched the existing test programs over to using the library
- added install of js lib
(This used to be commit 2a444dedbe44347268affc6458196f93ca7d372b)
Diffstat (limited to 'testprogs/ejs')
-rwxr-xr-x | testprogs/ejs/echo.js | 43 | ||||
-rwxr-xr-x | testprogs/ejs/samr.js | 122 |
2 files changed, 27 insertions, 138 deletions
diff --git a/testprogs/ejs/echo.js b/testprogs/ejs/echo.js index 4f0fc79f9a..312e599d50 100755 --- a/testprogs/ejs/echo.js +++ b/testprogs/ejs/echo.js @@ -3,16 +3,7 @@ test echo pipe calls from ejs */ - -/* - helper function to setup a rpc io object, ready for input -*/ -function irpcObj() -{ - var o = new Object(); - o.input = new Object(); - return o; -} +libinclude("base.js"); /* generate a ramp as an integer array @@ -28,38 +19,6 @@ function ramp_array(N) /* - check that a status result is OK -*/ -function check_status_ok(status) -{ - if (status.is_ok != true) { - printVars(status); - } - assert(status.is_ok == true); -} - -/* - check that two arrays are equal -*/ -function check_array_equal(a1, a2) -{ - assert(a1.length == a2.length); - for (i=0; i<a1.length; i++) { - assert(a1[i] == a2[i]); - } -} - -/* - check that an array is all zeros -*/ -function check_array_zero(a) -{ - for (i=0; i<a.length; i++) { - assert(a[i] == 0); - } -} - -/* test the echo_AddOne interface */ function test_AddOne(conn) diff --git a/testprogs/ejs/samr.js b/testprogs/ejs/samr.js index ec2096b818..1c613d5619 100755 --- a/testprogs/ejs/samr.js +++ b/testprogs/ejs/samr.js @@ -3,65 +3,28 @@ test samr calls from ejs */ +libinclude("base.js"); +libinclude("samr.js"); +libinclude("samr.js"); -/* - helper function to setup a rpc io object, ready for input -*/ -function irpcObj() -{ - var o = new Object(); - o.input = new Object(); - return o; -} - -/* - check that a status result is OK -*/ -function check_status_ok(status) -{ - if (status.is_ok != true) { - printVars(status); - } - assert(status.is_ok == true); -} /* test the samr_Connect interface */ function test_Connect(conn) { - var io = irpcObj(); print("Testing samr_Connect\n"); - io.input.system_name = NULL; - io.input.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - status = dcerpc_samr_Connect(conn, io); - check_status_ok(status); - return io.output.connect_handle; + return samrConnect(conn); } -/* - test the samr_Close interface -*/ -function test_Close(conn, handle) -{ - var io = irpcObj(); - io.input.handle = handle; - status = dcerpc_samr_Close(conn, io); - check_status_ok(status); -} /* test the samr_LookupDomain interface */ function test_LookupDomain(conn, handle, domain) { - var io = irpcObj(); print("Testing samr_LookupDomain\n"); - io.input.connect_handle = handle; - io.input.domain_name = domain; - status = dcerpc_samr_LookupDomain(conn, io); - check_status_ok(status); - return io.output.sid; + return samrLookupDomain(conn, handle, domain); } /* @@ -69,14 +32,8 @@ function test_LookupDomain(conn, handle, domain) */ function test_OpenDomain(conn, handle, sid) { - var io = irpcObj(); print("Testing samr_OpenDomain\n"); - io.input.connect_handle = handle; - io.input.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - io.input.sid = sid; - status = dcerpc_samr_OpenDomain(conn, io); - check_status_ok(status); - return io.output.domain_handle; + return samrOpenDomain(conn, handle, sid); } /* @@ -84,21 +41,12 @@ function test_OpenDomain(conn, handle, sid) */ function test_EnumDomainUsers(conn, dom_handle) { - var i, io = irpcObj(); + var i, users; print("Testing samr_EnumDomainUsers\n"); - io.input.domain_handle = dom_handle; - io.input.resume_handle = 0; - io.input.acct_flags = 0; - io.input.max_size = -1; - status = dcerpc_samr_EnumDomainUsers(conn, io); - check_status_ok(status); - print("Found " + io.output.num_entries + " users\n"); - if (io.output.sam == NULL) { - return; - } - var entries = io.output.sam.entries; - for (i=0;i<io.output.num_entries;i++) { - print("\t" + entries[i].name + "\n"); + users = samrEnumDomainUsers(conn, dom_handle); + print("Found " + users.length + " users\n"); + for (i=0;i<users.length;i++) { + println("\t" + users[i].name + "\t(" + users[i].idx + ")"); } } @@ -107,21 +55,11 @@ function test_EnumDomainUsers(conn, dom_handle) */ function test_EnumDomainGroups(conn, dom_handle) { - var i, io = irpcObj(); print("Testing samr_EnumDomainGroups\n"); - io.input.domain_handle = dom_handle; - io.input.resume_handle = 0; - io.input.acct_flags = 0; - io.input.max_size = -1; - status = dcerpc_samr_EnumDomainGroups(conn, io); - check_status_ok(status); - print("Found " + io.output.num_entries + " groups\n"); - if (io.output.sam == NULL) { - return; - } - var entries = io.output.sam.entries; - for (i=0;i<io.output.num_entries;i++) { - print("\t" + entries[i].name + "\n"); + var i, groups = samrEnumDomainGroups(conn, dom_handle); + print("Found " + groups.length + " groups\n"); + for (i=0;i<groups.length;i++) { + println("\t" + groups[i].name + "\t(" + groups[i].idx + ")"); } } @@ -141,28 +79,20 @@ function test_domain_ops(conn, dom_handle) */ function test_EnumDomains(conn, handle) { - var i, io = irpcObj(); + var i, domains; print("Testing samr_EnumDomains\n"); - io.input.connect_handle = handle; - io.input.resume_handle = 0; - io.input.buf_size = -1; - status = dcerpc_samr_EnumDomains(conn, io); - check_status_ok(status); - print("Found " + io.output.num_entries + " domains\n"); - if (io.output.sam == NULL) { - return; - } - var entries = io.output.sam.entries; - for (i=0;i<io.output.num_entries;i++) { - print("\t" + entries[i].name + "\n"); + + domains = samrEnumDomains(conn, handle); + print("Found " + domains.length + " domains\n"); + for (i=0;i<domains.length;i++) { + print("\t" + domains[i].name + "\n"); } - for (i=0;i<io.output.num_entries;i++) { - domain = entries[i].name; - print("Testing domain " + domain + "\n"); - sid = test_LookupDomain(conn, handle, domain); + for (i=0;i<domains.length;i++) { + print("Testing domain " + domains[i].name + "\n"); + sid = samrLookupDomain(conn, handle, domains[i].name); dom_handle = test_OpenDomain(conn, handle, sid); test_domain_ops(conn, dom_handle); - test_Close(conn, dom_handle); + samrClose(conn, dom_handle); } } @@ -185,7 +115,7 @@ if (status.is_ok != true) { handle = test_Connect(conn); test_EnumDomains(conn, handle); -test_Close(conn, handle); +samrClose(conn, handle); print("All OK\n"); return 0; |