Ejemplo n.º 1
0
void setup2(void)
{
	setup1();		/* get a socket in s */
	if (shutdown(s, 1) < 0)
		tst_brkm(TBROK|TERRNO, cleanup, "socket setup failed connect "
			 "test %d", testno);
}
Ejemplo n.º 2
0
int main(int ac, char **av)
{

	int lc, i;
	char *msg;

	if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {

		tst_count = 0;

		for (i = 0; i < TST_TOTAL; ++i) {

			if (i == 1) {
				/* setup Non super-user for second test */
				if (setup1()) {
					/* setup1() failed, skip this test */
					continue;
				}
			}

			/*
			 * Call iopl(2)
			 */
			TEST(iopl(test_cases[i].level));

			if ((TEST_RETURN == EXP_RET_VAL) &&
			    (TEST_ERRNO == test_cases[i].exp_errno)) {
				tst_resm(TPASS, "Expected failure for %s, "
					 "errno: %d", test_cases[i].desc,
					 TEST_ERRNO);
			} else {
				tst_resm(TFAIL, "Unexpected results for %s ; "
					 "returned %ld (expected %d), errno %d "
					 "(expected errno  %d)",
					 test_cases[i].desc,
					 TEST_RETURN, EXP_RET_VAL,
					 TEST_ERRNO, test_cases[i].exp_errno);
			}

			TEST_ERROR_LOG(TEST_ERRNO);

			if (i == 1) {
				/* revert back to super user */
				cleanup1();
			}

		}
	}

	/* cleanup and exit */
	cleanup();

	tst_exit();

}
Ejemplo n.º 3
0
void setup2(void)
{
	setup1();		/* get a socket in s */
	if (connect(s, (const struct sockaddr *)&sin1, sizeof(sin1)) < 0)
		tst_brkm(TBROK | TERRNO, cleanup,
			 "socket setup failed connect test %d", testno);
}
Ejemplo n.º 4
0
void setup2(void)
{
	setup1();
	if (write(s, "R", 1) < 0)
		tst_brkm(TBROK|TERRNO, cleanup, "test setup failed: write:");
	control = (struct cmsghdr *)cbuf;
	controllen = control->cmsg_len = sizeof(cbuf);
}
Ejemplo n.º 5
0
Archivo: ioperm02.c Proyecto: kraj/ltp
int main(int ac, char **av)
{
	int lc, i;

	tst_parse_opts(ac, av, NULL, NULL);

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {

		tst_count = 0;

		for (i = 0; i < TST_TOTAL; ++i) {

			if (i == 1) {
				/* setup Non super-user for second test */
				if (setup1()) {
					/* setup1() failed, skip this test */
					continue;
				}
			}

			/* Test the system call */

			TEST(ioperm(test_cases[i].from,
				    test_cases[i].num, test_cases[i].turn_on));

			if ((TEST_RETURN == EXP_RET_VAL) &&
			    (TEST_ERRNO == test_cases[i].exp_errno)) {
				tst_resm(TPASS, "Expected failure for %s, "
					 "errno: %d", test_cases[i].desc,
					 TEST_ERRNO);
			} else {
				tst_resm(TFAIL, "Unexpected results for %s ; "
					 "returned %ld (expected %d), errno %d "
					 "(expected errno  %d)",
					 test_cases[i].desc,
					 TEST_RETURN, EXP_RET_VAL,
					 TEST_ERRNO, test_cases[i].exp_errno);
			}

			if (i == 1) {
				/* revert back to super user */
				cleanup1();
			} else {
			}
		}

	}

	/* cleanup and exit */
	cleanup();

	tst_exit();

}
Ejemplo n.º 6
0
i2c& i2c::setup(uint16_t bus) 
{
    switch (bus)
    {
    case 0: return setup0();
    case 1: return setup1();
    case 2: return setup2();
    default: return setup0();
    }
}
Ejemplo n.º 7
0
void setup3(void)
{
	int one = 1;

	setup1();
	if (ioctl(s, FIONBIO, &one) < 0) {
		tst_brkm(TBROK, cleanup, "socket ioctl failed for accept "
			 "test %d: %s", testno, strerror(errno));
	}
}
Ejemplo n.º 8
0
void setup2(void)
{
	setup1();
	fromlen = -1;
}
Ejemplo n.º 9
0
int main(int ac, char **av)
{
	int lc, i;		/* loop counter */
	char *msg;		/* message returned from parse_opts */

	/* parse standard options */
	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL))
	     != (char *)NULL) {
		tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
	}

	/* perform global setup for test */
	setup();

	/* check looping state if -i option given */
	for (lc = 0; TEST_LOOPING(lc); lc++) {

		/* reset Tst_count in case we are looping. */
		Tst_count = 0;

		for (i = 0; i < TST_TOTAL; ++i) {

			if (i == 1) {
				/* setup Non super-user for second test */
				if (setup1()) {
					/* setup1() failed, skip this test */
					continue;
				}
			}

			/* Test the system call */

			TEST(ioperm(test_cases[i].from,
			 	test_cases[i].num, test_cases[i].turn_on));

			if ((TEST_RETURN == EXP_RET_VAL) &&
		    		(TEST_ERRNO == test_cases[i].exp_errno)) {
				 tst_resm(TPASS, "Expected failure for %s, "
					"errno: %d", test_cases[i].desc,
					TEST_ERRNO);
			} else {
				tst_resm(TFAIL, "Unexpected results for %s ; "
					"returned %d (expected %d), errno %d "
					"(expected errno  %d)",
					test_cases[i].desc,
					TEST_RETURN, EXP_RET_VAL,
					TEST_ERRNO, test_cases[i].exp_errno);
			}

			TEST_ERROR_LOG(TEST_ERRNO); 

			if (i == 1) {
				/* revert back to super user */
				cleanup1();
			} else {
			}
		} 

	}	/* End for TEST_LOOPING */

	/* cleanup and exit */
	cleanup();

	/*NOTREACHED*/
	return 0;

}	/* End main */
Ejemplo n.º 10
0
void setup2(void)
{
	setup1();		/* get a socket in s */
	sinlen = 1;		/* invalid s */
}