Esempio n. 1
0
int main(int argc, char **argv)
{
	(void) argc;
	(void) argv;

	TRACE_LEVEL_SET(TRACE_ALL);
	TEST_INITIALIZE();

	eventq = eventQCreate("/eventq", 8, sizeof(bcm_gas_event_t));

#ifdef PRO_GAS_INCOMING
	testProGasIncoming();
#else
	/* run test multiple times */
	testProGasMaxInstance();
	testProGasMaxInstance();
	testProGasMaxInstance();

	testProGas();
#endif

	eventQDelete(eventq);

	/* disable wlan */
	wlFree();

	/* terminate dispatcher */
	dspFree();

	TEST_FINALIZE();
	return 0;
}
Esempio n. 2
0
int main(int argc, char **argv)
{
	(void) argc;
	(void) argv;

	TRACE_LEVEL_SET(TRACE_ALL);
	TEST_INITIALIZE();

	testEncode();
	testDecode();
	testDecodeCorruptLength();

	TEST_FINALIZE();
	return 0;
}
int main(int argc, char **argv)
{
	WLM_DUT_INTERFACE dutInterface = WLM_DUT_LOCAL;
	char *interfaceName = 0;
	WLM_DUT_SERVER_PORT dutServerPort = WLM_DEFAULT_DUT_SERVER_PORT;
	WLM_DUT_OS dutOs = WLM_DUT_OS_WIN32;

	(void)argc;

	while (*++argv) {

		if (strncmp(*argv, "--help", strlen(*argv)) == 0) {
			printUsage();
			exit(0);
		}

		if (strncmp(*argv, "--socket", strlen(*argv)) == 0) {
			int port;

			dutInterface = WLM_DUT_SOCKET;
			if (!*++argv) {
				printf("IP address required\n");
				printUsage();
				exit(-1);
			}
			interfaceName = *argv;
			if (*++argv && (sscanf(*argv, "%d", &port) == 1)) {
				dutServerPort = (WLM_DUT_SERVER_PORT)port;
			}
			else {
				/* optional parameter */
				--argv;
			}
		}

		if (strncmp(*argv, "--serial", strlen(*argv)) == 0) {
			dutInterface = WLM_DUT_SERIAL;
			if (!*++argv) {
				printf("serial port required\n");
				printUsage();
				exit(-1);
			}
			interfaceName = *argv;
		}

		if (strncmp(*argv, "--wifi", strlen(*argv)) == 0) {
			dutInterface = WLM_DUT_WIFI;
			if (!*++argv) {
				printf("MAC address required\n");
				printUsage();
				exit(-1);
			}
			interfaceName = *argv;
		}

		if (strncmp(*argv, "--dongle", strlen(*argv)) == 0) {
			unsigned int i;
			char buffer[256];

			dutInterface = WLM_DUT_DONGLE;
			if (!*++argv) {
				printf("COM port required\n");
				printUsage();
				exit(-1);
			}
			if (!(sscanf(*argv, "COM%u", &i) == 1 ||
				sscanf(*argv, "/dev/tty%s", buffer) == 1)) {
				printf("serial port invalid\n");
				printUsage();
				exit(-1);
			}
			interfaceName = *argv;
		}

		if ((strncmp(*argv, "--linux", strlen(*argv)) == 0) ||
			strncmp(*argv, "--linuxdut", strlen(*argv)) == 0) {
			dutOs = WLM_DUT_OS_LINUX;
		}
	}

	TEST_INITIALIZE();

	TEST_FATAL(wlmApiInit(), "wlmApiInit failed");

	TEST_FATAL(wlmSelectInterface(dutInterface, interfaceName,
		dutServerPort, dutOs), "wlmSelectInterface failed");

	printf("\n");
	switch (dutInterface) {
		case WLM_DUT_LOCAL:
			printf("Test running against local DUT.\n");
			break;
		case WLM_DUT_SOCKET:
			printf("Test running over Ethernet to remote DUT IP=%s.\n", interfaceName);
			break;
		case WLM_DUT_SERIAL:
			printf("Test running over serial from port %s\n", interfaceName);
			break;
		case WLM_DUT_WIFI:
			printf("Test running over 802.11 to remote DUT MAC=%s.\n", interfaceName);
			break;
		case WLM_DUT_DONGLE:
			printf("Test running over serial from %s to remote dongle UART\n",
				interfaceName);
			break;
		default:
			printf("Invalid interface\n");
			exit(-1);
			break;
	}
	switch (dutOs) {
		case WLM_DUT_OS_LINUX:
			printf("Test running against Linux DUT.\n");
			break;
		case WLM_DUT_OS_WIN32:
			printf("Test running against Win32 DUT.\n");
			break;
		default:
			printf("Invalid DUT OS\n");
			exit(-1);
			break;
	}
	printf("\n");

	/* packet engine requires MPC to be disabled and WLAN interface up */
	TEST(wlmMinPowerConsumption(FALSE), "wlmMinPowerConsuption failed");
	TEST(wlmEnableAdapterUp(TRUE), "wlmEnableAdapterUp failed");
	/* invoke test cases */
	testDutInit();
	testVersion();
	testTransmit();
	testClientBatchingTransmit();
	testServerBatchingTransmit();
	testReceive();
	testJoinNetworkNone();
	testJoinNetworkWep();
	testJoinNetworkWpaTkip();
	testJoinNetworkWpaAes();
	testJoinNetworkWpa2Tkip();
	testJoinNetworkWpa2Aes();

	TEST_FATAL(wlmApiCleanup(), "wlmApiCleanup failed");

	TEST_FINALIZE();
	return 0;
}