tests
This commit is contained in:
104
nwtests.c
104
nwtests.c
@@ -1,44 +1,82 @@
|
||||
/* nwtests.c 20-May-96 */
|
||||
|
||||
/****************************************************************
|
||||
* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany *
|
||||
****************************************************************/
|
||||
/*
|
||||
* nwtests.c - developer-only tests
|
||||
*
|
||||
* Run by copying net.exe to tests.exe:
|
||||
* cp build/dosutils/net.exe SYS/public/tests.exe
|
||||
*
|
||||
* Then in DOS:
|
||||
* TESTS
|
||||
* TESTS NETCALL
|
||||
*/
|
||||
|
||||
#include "net.h"
|
||||
|
||||
static int usage(void)
|
||||
static void tests_usage(void)
|
||||
{
|
||||
return(-1);
|
||||
fprintf(stdout, "Usage: TESTS [NETCALL]\n");
|
||||
}
|
||||
|
||||
static int same_arg(char *a, char *b)
|
||||
{
|
||||
while (*a || *b) {
|
||||
int ca = *a++;
|
||||
int cb = *b++;
|
||||
if (ca >= 'a' && ca <= 'z') ca -= 32;
|
||||
if (cb >= 'a' && cb <= 'z') cb -= 32;
|
||||
if (ca != cb) return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int test_netcall(void)
|
||||
{
|
||||
unsigned char req[4];
|
||||
unsigned char repl[4];
|
||||
int asm_rc;
|
||||
int c_rc;
|
||||
|
||||
memset(req, 0, sizeof(req));
|
||||
memset(repl, 0, sizeof(repl));
|
||||
|
||||
fprintf(stdout, "TEST Net_Call ASM vs C\n");
|
||||
fprintf(stdout, "Call: INT 21h AH=19h get current drive\n");
|
||||
fprintf(stdout, "Expected: AL=0 for A:, 1 for B:, 2 for C:, ...\n\n");
|
||||
|
||||
/*
|
||||
* Safe DOS call. It ignores DS:SI and ES:DI, so it is ideal for testing
|
||||
* register setup without touching NetWare/NCP.
|
||||
*/
|
||||
asm_rc = Net_Call(0x1900, req, repl);
|
||||
fprintf(stdout, "ASM Net_Call(1900h) rc=%04X drive=%c:\n",
|
||||
asm_rc, 'A' + (asm_rc & 0xff));
|
||||
|
||||
c_rc = Net_Call_C(0x1900, req, repl);
|
||||
fprintf(stdout, "C Net_Call_C(1900h) rc=%04X drive=%c:\n",
|
||||
c_rc, 'A' + (c_rc & 0xff));
|
||||
|
||||
Net_Call_C_Dump();
|
||||
|
||||
if ((asm_rc & 0xff) == (c_rc & 0xff))
|
||||
fprintf(stdout, "\nNETCALL C basic register test OK\n");
|
||||
else
|
||||
fprintf(stdout, "\nNETCALL C basic register test FAILED\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int func_tests(int argc, char *argv[], int mode)
|
||||
{
|
||||
int level = ncp_17_02(NWCONN, 6);
|
||||
int dirhandle = alloc_temp_dir_handle(0, "SYS:", 'd', NULL);
|
||||
int result = -1;
|
||||
uint8 *path = (argc < 2) ? "SYS:\\TMP" : argv[1];
|
||||
if (dirhandle > -1) {
|
||||
result = ncp_16_02(dirhandle, "SYSTEM/", NULL, NULL, NULL, NULL);
|
||||
result = ncp_16_02(dirhandle, "SYSTEM", NULL, NULL, NULL, NULL);
|
||||
}
|
||||
fprintf(stdout, "dirhandle=%d, result=%d\n", dirhandle, result);
|
||||
result = redir_device_drive(0x4, "u:", path);
|
||||
fprintf(stdout, "redir path=%s, result=%d\n", path, result);
|
||||
(void)mode;
|
||||
|
||||
path="Q1";
|
||||
result = redir_device_drive(0x3, "LPT1", path);
|
||||
fprintf(stdout, "redir path=%s, result=%d\n", path, result);
|
||||
|
||||
{
|
||||
int k =-1;
|
||||
uint8 devname[20];
|
||||
uint8 remotename[130];
|
||||
int devicetyp;
|
||||
while ((result = list_redir(++k, &devicetyp, devname, remotename)) > -1){
|
||||
fprintf(stdout, "index=%d, dev=%s(%d), %s result=%d\n",
|
||||
k, devname, devicetyp, remotename, result);
|
||||
}
|
||||
if (argc < 2) {
|
||||
tests_usage();
|
||||
return(0);
|
||||
}
|
||||
if (level > -1) (void) ncp_17_02(NWCONN, level);
|
||||
return(0);
|
||||
|
||||
if (same_arg(argv[1], "NETCALL")) {
|
||||
return(test_netcall());
|
||||
}
|
||||
|
||||
tests_usage();
|
||||
return(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user