1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

take the sructure name to run through vluke on the command line

(This used to be commit 03fbe1b151)
This commit is contained in:
Andrew Tridgell 2000-05-16 14:02:31 +00:00
parent 128026c9a2
commit 058ecd89b4
7 changed files with 99 additions and 35 deletions

View File

@ -1,13 +1,22 @@
function produce_harness(f,
LOCAL, v, struct_num)
LOCAL, v, struct_num, i)
{
struct_num=structs[test];
v["MODULE"]=module;
v["TEST"]=test;
v["TEST_FUNC"]=moduletest;
v["STRUCTNAME"] = structs[struct_num, "name"];
v["FUNCNAME"] = "io_" v["STRUCTNAME"];
print_template(f, "harness_start.tpl", v);
for (i=0;i<num_tests;i++) {
v["TEST"] = tests[i];
print_template(f, "harness.tpl", v);
}
print_template(f, "harness_end.tpl", v);
}
function add_test(test)
{
tests[num_tests] = test;
num_tests++;
}

View File

@ -14,7 +14,7 @@
}
/^test/ {
test=$2;
add_test($2);
next;
}

View File

@ -142,7 +142,8 @@ function struct_parser(f, v, struct_num,
# and any trailers
for (i=n1;i<structs[struct_num, "num_elems"];i++) {
parse_buffers(f, v, structs[struct_num, i], "PARSE_SCALARS");
parse_scalars(f, v, structs[struct_num, i], "PARSE_SCALARS");
parse_buffers(f, v, structs[struct_num, i], "PARSE_BUFFERS");
}
print_template(f, "fn_end.tpl", v);

View File

@ -6,6 +6,7 @@ function start_module(name)
num_structs=0;
num_elements=0;
num_unions=0;
num_tests=0;
}
function start_struct(name)

View File

@ -1,5 +1,16 @@
module srvsvc
test SRV_R_NET_SHARE_ENUM
test SRV_R_NET_SERVER_INFO
test SRV_Q_NET_SERVER_INFO
#define SRV_NETCONNENUM 0x08
#define SRV_NETFILEENUM 0x09
#define SRV_NETSESSENUM 0x0c
#define SRV_NETSHAREENUM 0x0f
#define SRV_NET_SHARE_GET_INFO 0x10
#define SRV_NET_SRV_GET_INFO 0x15
#define SRV_NET_SRV_SET_INFO 0x16
#define SRV_NET_REMOTE_TOD 0x1c
struct UNISTR2 {
uint32 max_len;
@ -12,6 +23,40 @@ struct LPWSTR {
UNISTR2 *str;
};
struct ENUM_HND {
uint32 *handle; /* enumeration handle */
};
/* function 8 */
struct CONN_INFO_0 {
uint32 id; /* connection id. */
};
struct CONN_INFO_1 {
uint32 id;
uint32 type;
uint32 num_opens;
uint32 num_users;
uint32 open_time;
LPWSTR usr_name;
LPWSTR net_name;
};
struct SRV_R_NET_CONN_ENUM {
uint32 level;
uint32 level2;
uint32 num_entries;
union *info[level] {
case 0 CONN_INFO_0 info0[num_entries];
case 1 CONN_INFO_1 info1[num_entries];
}
.trailer;
uint32 count;
ENUM_HND handle;
uint32 status1;
uint32 status2;
};
/* function 15 */
struct SRV_SHARE_INFO_1 {
LPWSTR uni_netname;
@ -63,28 +108,35 @@ struct SERVER_INFO_101 {
};
struct SERVER_INFO_102 {
uint32 dwPlatformID;
uint32 dwPlatformID;
LPWSTR pszName;
uint32 dwVerMajor;
uint32 dwVerMinor;
uint32 dwType;
uint32 dwVerMajor;
uint32 dwVerMinor;
uint32 dwType;
LPWSTR pszComment;
uint32 dwUsers;
uint32 lDisc;
uint32 bHidden;
uint32 dwAnnounce;
uint32 dwAnnDelta;
uint32 dwLicenses;
uint32 dwUsers;
uint32 lDisc;
uint32 bHidden;
uint32 dwAnnounce;
uint32 dwAnnDelta;
uint32 dwLicenses;
LPWSTR pszUserPath;
};
struct SRV_R_NET_SERVER_INFO {
uint32 level;
union info[level] {
case 100 SERVER_INFO_100 *sv100;
case 101 SERVER_INFO_101 *sv101;
case 102 SERVER_INFO_102 *sv102;
}
.trailer;
uint32 level;
union *info[level] {
case 100 SERVER_INFO_100 sv100;
case 101 SERVER_INFO_101 sv101;
case 102 SERVER_INFO_102 sv102;
}
uint32 status;
};
struct SRV_Q_NET_SERVER_INFO {
.trailer;
LPWSTR server;
uint32 level;
};

View File

@ -1,7 +1,8 @@
#define TEST_STRUCT @STRUCTNAME@
#define TEST_NAME "@TEST@"
#define TEST_FUNC @FUNCNAME@
#include "prs_@MODULE@.h"
#include "prs_@MODULE@.c"
static BOOL run_test(char *test, prs_struct *ps)
{
BOOL ret;

View File

@ -11,18 +11,19 @@
int main(int argc, char *argv[])
{
BOOL ret;
TEST_STRUCT *il;
char *desc = TEST_NAME;
char *fname = argv[1];
char *fname, *test;
int fd;
struct stat st;
prs_struct ps;
if (argc < 2) {
printf("usage: vluke <file>\n");
if (argc < 3) {
printf("usage: vluke <structure> <file>\n");
exit(1);
}
test = argv[1];
fname = argv[2];
fd = open(fname,O_RDONLY);
fstat(fd, &st);
@ -31,8 +32,7 @@ int main(int argc, char *argv[])
prs_read(&ps, fd, st.st_size, 0);
ps.data_offset = 0;
ps.io = UNMARSHALL;
il = (TEST_STRUCT *)malloc(sizeof(*il));
ret = TEST_FUNC(desc, &ps, 1, il, PARSE_SCALARS|PARSE_BUFFERS);
ret = run_test(test, &ps);
printf("\nret=%s\n", ret?"OK":"Bad");
printf("Trailer is %d bytes\n\n", ps.grow_size - ps.data_offset);
dump_data(0, ps.data_p, ps.grow_size);