version 1.31, 2005/02/25 06:47:29
|
version 1.32, 2005/02/25 07:07:32
|
|
|
#define NUM_CLIENTS 64 | #define NUM_CLIENTS 64 |
| |
/* amount of data to transfer from each client to server */ | /* amount of data to transfer from each client to server */ |
#define TEST_DATA_SIZE 145243 |
#define TEST_DATA_SIZE 145244 |
| |
/* max time (seconds) to run test. | /* max time (seconds) to run test. |
On a 650 Mhz Linux system with tcpdump running, it takes 8 seconds. */ | On a 650 Mhz Linux system with tcpdump running, it takes 8 seconds. */ |
|
|
| |
static void test_Startup(void) | static void test_Startup(void) |
{ | { |
/* initialize application */ |
/* generate test data and initialize application */ |
WSADATA wsaData; | WSADATA wsaData; |
int wsastartup_result; | int wsastartup_result; |
int versionOK; | int versionOK; |
|
int i; |
|
|
|
srand(1); |
|
|
|
/* fill out test data */ |
|
gTestData = malloc(TEST_DATA_SIZE); |
|
for(i = 0; i < (TEST_DATA_SIZE/sizeof(int)); i++) { |
|
*(((int *) gTestData) + i) = rand(); |
|
} |
| |
/* check for compatible winsock version */ | /* check for compatible winsock version */ |
wsastartup_result = WSAStartup(MAKEWORD(1,1), &wsaData); | wsastartup_result = WSAStartup(MAKEWORD(1,1), &wsaData); |
versionOK = (LOBYTE(wsaData.wVersion) == 1) && (HIBYTE(wsaData.wVersion) == 1); |
ok((wsastartup_result == NO_ERROR), "Error in WSAStartup()\n"); |
| |
|
versionOK = (LOBYTE(wsaData.wVersion) == 1) && (HIBYTE(wsaData.wVersion) == 1); |
ok( versionOK , "WSAStartup returns an incompatible sockets version\n"); | ok( versionOK , "WSAStartup returns an incompatible sockets version\n"); |
if ( !versionOK ) { | if ( !versionOK ) { |
WSACleanup(); | WSACleanup(); |
exit(0); | exit(0); |
} | } |
| |
ok((wsastartup_result == NO_ERROR), "Error in WSAStartup()\n"); |
|
trace("startup ok\n"); | trace("startup ok\n"); |
} | } |
| |
|
|
int cleanupOK; | int cleanupOK; |
| |
cleanupOK = ! WSACleanup(); | cleanupOK = ! WSACleanup(); |
|
|
ok( cleanupOK , "error in WSACleanup()\n"); | ok( cleanupOK , "error in WSACleanup()\n"); |
|
|
|
free(gTestData); |
|
|
trace("cleanup ok\n"); | trace("cleanup ok\n"); |
} | } |
| |
START_TEST(wsock32_main) | START_TEST(wsock32_main) |
{ | { |
const int numTests = 3; | const int numTests = 3; |
gTestData = malloc(TEST_DATA_SIZE); |
|
| |
trace("test 1 of %d:\n", numTests); | trace("test 1 of %d:\n", numTests); |
test_Startup(); | test_Startup(); |
|
|
test_Cleanup(); | test_Cleanup(); |
| |
trace("all " __FILE__ " tests done\n"); | trace("all " __FILE__ " tests done\n"); |
|
|
free(gTestData); |
|
} | } |