tests
This commit is contained in:
165
nwtests.c
165
nwtests.c
@@ -706,6 +706,168 @@ static int tests_nwreq87vlmcase(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
static void tests_set_frag_alt_len_off_seg(uint8 *buf, void *ptr, UI len)
|
||||
{
|
||||
tests_put_word_lh(buf + 0, (uint16)len);
|
||||
tests_put_word_lh(buf + 2, (uint16)FP_OFF(ptr));
|
||||
tests_put_word_lh(buf + 4, (uint16)FP_SEG(ptr));
|
||||
}
|
||||
|
||||
static void tests_nwreq87vlmreg_help(void)
|
||||
{
|
||||
fprintf(stdout, "Usage: TESTS NWREQ87VLMREG n\n");
|
||||
fprintf(stdout, "n=1..20, one VLM register/fragment-layout case\n");
|
||||
fprintf(stdout, "1-10 frag layout off,seg,len\n");
|
||||
fprintf(stdout, "11-20 frag layout len,off,seg\n");
|
||||
fprintf(stdout, "odd=stack 6,20,0 even=stack 0,20,6\n");
|
||||
fprintf(stdout, "reg maps repeat every 2 cases:\n");
|
||||
fprintf(stdout, " A AX=57 BX=reqs CX=conn DX=reps\n");
|
||||
fprintf(stdout, " B AX=57 BX=conn CX=reqs DX=reps\n");
|
||||
fprintf(stdout, " C AX=57 BX=reqs CX=reps DX=conn\n");
|
||||
fprintf(stdout, " D AX=57 BX=conn CX=reps DX=reqs\n");
|
||||
fprintf(stdout, " E AX=57 BX=reps CX=conn DX=reqs\n");
|
||||
}
|
||||
|
||||
static int tests_nwreq87vlmreg(int argc, char *argv[])
|
||||
{
|
||||
int which = 1;
|
||||
int layout_alt;
|
||||
int local_case;
|
||||
int stack_rev;
|
||||
int regmap;
|
||||
|
||||
uint8 connid = 0;
|
||||
uint8 dhandle = 0;
|
||||
uint8 hdr[16];
|
||||
uint8 path[300];
|
||||
uint8 repl[0x180];
|
||||
UI path_len;
|
||||
|
||||
TEST_NWFRAG16 frags_req_std[2];
|
||||
TEST_NWFRAG16 frags_rep_std[2];
|
||||
uint8 frags_req_alt[12];
|
||||
uint8 frags_rep_alt[12];
|
||||
void *reqfragp;
|
||||
void *repfragp;
|
||||
|
||||
UI ax = 0x0057;
|
||||
UI bx = 0;
|
||||
UI cx = 0;
|
||||
UI dx = 0;
|
||||
UI p1 = 6;
|
||||
UI p2 = 0x20;
|
||||
UI p3 = 0;
|
||||
int rc;
|
||||
uint32 dw0;
|
||||
uint32 dw4d;
|
||||
|
||||
if (argc < 3) {
|
||||
tests_nwreq87vlmreg_help();
|
||||
return(1);
|
||||
}
|
||||
|
||||
which = atoi(argv[2]);
|
||||
if (which < 1 || which > 20) {
|
||||
tests_nwreq87vlmreg_help();
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (tests_current_conn_dhandle(&connid, &dhandle))
|
||||
return(1);
|
||||
|
||||
memset(hdr, 0, sizeof(hdr));
|
||||
hdr[0] = 6;
|
||||
hdr[1] = 0;
|
||||
hdr[2] = 0;
|
||||
tests_put_word_lh(hdr + 3, 0x0006);
|
||||
tests_put_dword_lh(hdr + 5, 0x00000004UL);
|
||||
|
||||
path_len = tests_build_nwreq87_path_multi(path, dhandle, 0, 0, 1,
|
||||
"LOGIN.EXE", 0, 0);
|
||||
|
||||
memset(repl, 0, sizeof(repl));
|
||||
memset(frags_req_std, 0, sizeof(frags_req_std));
|
||||
memset(frags_rep_std, 0, sizeof(frags_rep_std));
|
||||
memset(frags_req_alt, 0, sizeof(frags_req_alt));
|
||||
memset(frags_rep_alt, 0, sizeof(frags_rep_alt));
|
||||
|
||||
tests_set_frag(&frags_req_std[0], hdr, 9);
|
||||
tests_set_frag(&frags_req_std[1], path, path_len);
|
||||
tests_set_frag(&frags_rep_std[0], repl, 0x4d);
|
||||
tests_set_frag(&frags_rep_std[1], repl + 0x4d, 0x100);
|
||||
|
||||
tests_set_frag_alt_len_off_seg(frags_req_alt + 0, hdr, 9);
|
||||
tests_set_frag_alt_len_off_seg(frags_req_alt + 6, path, path_len);
|
||||
tests_set_frag_alt_len_off_seg(frags_rep_alt + 0, repl, 0x4d);
|
||||
tests_set_frag_alt_len_off_seg(frags_rep_alt + 6, repl + 0x4d, 0x100);
|
||||
|
||||
layout_alt = (which > 10);
|
||||
local_case = layout_alt ? which - 10 : which;
|
||||
stack_rev = ((local_case & 1) == 0);
|
||||
regmap = (local_case + 1) / 2; /* 1..5 */
|
||||
|
||||
if (layout_alt) {
|
||||
reqfragp = frags_req_alt;
|
||||
repfragp = frags_rep_alt;
|
||||
} else {
|
||||
reqfragp = frags_req_std;
|
||||
repfragp = frags_rep_std;
|
||||
}
|
||||
|
||||
if (stack_rev) {
|
||||
p1 = 0;
|
||||
p2 = 0x20;
|
||||
p3 = 6;
|
||||
}
|
||||
|
||||
switch (regmap) {
|
||||
case 1:
|
||||
bx = 2; cx = connid; dx = 2;
|
||||
break;
|
||||
case 2:
|
||||
bx = connid; cx = 2; dx = 2;
|
||||
break;
|
||||
case 3:
|
||||
bx = 2; cx = 2; dx = connid;
|
||||
break;
|
||||
case 4:
|
||||
bx = connid; cx = 2; dx = 2;
|
||||
break;
|
||||
case 5:
|
||||
bx = 2; cx = connid; dx = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cases 2 and 4 share registers but differ stack order.
|
||||
* Cases 1 and 9 share registers but let us repeat with same stack/table
|
||||
* for sanity. Keep explicit output so we know exactly what was run.
|
||||
*/
|
||||
|
||||
fprintf(stdout, "TEST NWREQ87VLMREG case=%d\n", which);
|
||||
fprintf(stdout, "layout=%s stack=%s regmap=%d\n",
|
||||
layout_alt ? "len,off,seg" : "off,seg,len",
|
||||
stack_rev ? "0,20,6" : "6,20,0",
|
||||
regmap);
|
||||
fprintf(stdout, "connid=%u dhandle=%u path_len=%u\n", connid, dhandle, path_len);
|
||||
fprintf(stdout, "AX=%04X BX=%04X CX=%04X DX=%04X p1=%04X p2=%04X p3=%04X\n",
|
||||
ax, bx, cx, dx, p1, p2, p3);
|
||||
tests_dump_bytes("HDR :", hdr, 9);
|
||||
tests_dump_bytes("PATH:", path, path_len > 48 ? 48 : path_len);
|
||||
|
||||
rc = Net_Call_VLM_Raw(ax, bx, cx, dx, reqfragp, repfragp, p1, p2, p3);
|
||||
|
||||
fprintf(stdout, "RC=%04X\n", rc);
|
||||
tests_dump_bytes("REPL0 :", repl, 32);
|
||||
tests_dump_bytes("REPL4D:", repl + 0x4d, 32);
|
||||
dw0 = tests_get_dword_lh(repl);
|
||||
dw4d = tests_get_dword_lh(repl + 0x4d);
|
||||
fprintf(stdout, "DW0=%08lX DW4D=%08lX\n", dw0, dw4d);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int func_tests(int argc, char *argv[], int mode)
|
||||
{
|
||||
if (argc >= 2) {
|
||||
@@ -727,6 +889,9 @@ int func_tests(int argc, char *argv[], int mode)
|
||||
if (tests_same_arg(argv[1], "NWREQ87VLMCASE"))
|
||||
return tests_nwreq87vlmcase(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "NWREQ87VLMREG"))
|
||||
return tests_nwreq87vlmreg(argc, argv);
|
||||
|
||||
if (tests_same_arg(argv[1], "NCPF2"))
|
||||
return tests_ncpf2(argc, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user