コード例 #1
0
ファイル: faccessat01.c プロジェクト: Nudiv/ltp
int main(int ac, char **av)
{
	int lc;
	const char *msg;
	int i;

	/* Disable test if the version of the kernel is less than 2.6.16 */
	if (((tst_kvercmp(2, 6, 16)) < 0)) {
		tst_resm(TWARN, "This test can only run on kernels that are ");
		tst_resm(TWARN, "2.6.16 and higher");
		exit(0);
	}

	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++) {
		setup_every_copy();

		tst_count = 0;

		/*
		 * Call faccessat
		 */
		for (i = 0; i < TST_TOTAL; i++) {
			TEST(myfaccessat(fds[i], filenames[i], R_OK));

			/* check return code */
			if (TEST_ERRNO == expected_errno[i]) {
				tst_resm(TPASS,
					 "faccessat() returned the expected  errno %d: %s",
					 TEST_ERRNO,
					 strerror(TEST_ERRNO));
			} else {
				TEST_ERROR_LOG(TEST_ERRNO);
				tst_resm(TFAIL,
					 "faccessdat() Failed, errno=%d : %s",
					 TEST_ERRNO, strerror(TEST_ERRNO));
			}
		}

	}

	cleanup();
	tst_exit();
}
コード例 #2
0
ファイル: faccessat01.c プロジェクト: 1587/ltp
int main(int ac, char **av)
{
	int lc;
	int i;

	/* Disable test if the version of the kernel is less than 2.6.16 */
	if ((tst_kvercmp(2, 6, 16)) < 0)
		tst_brkm(TCONF, NULL, "Test must be run with kernel 2.6.16+");

	tst_parse_opts(ac, av, NULL, NULL);

	setup();

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

		/*
		 * Call faccessat
		 */
		for (i = 0; i < TST_TOTAL; i++) {
			TEST(myfaccessat(fds[i], filenames[i], R_OK));

			/* check return code */
			if (TEST_ERRNO == expected_errno[i]) {
				tst_resm(TPASS,
					 "faccessat() returned the expected  errno %d: %s",
					 TEST_ERRNO,
					 strerror(TEST_ERRNO));
			} else {
				tst_resm(TFAIL,
					 "faccessdat() Failed, errno=%d : %s",
					 TEST_ERRNO, strerror(TEST_ERRNO));
			}
		}
	}

	cleanup();
	tst_exit();
}
コード例 #3
0
int main(int ac, char **av)
{
	int lc;
	char *msg;
	int i;

	/* Disable test if the version of the kernel is less than 2.6.16 */
	if (((tst_kvercmp(2, 6, 16)) < 0)) {
		tst_resm(TWARN, "This test can only run on kernels that are ");
		tst_resm(TWARN, "2.6.16 and higher");
		exit(0);
	}

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

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

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

		tst_count = 0;

		/*
		 * Call faccessat
		 */
		for (i = 0; i < TST_TOTAL; i++) {
			s2e_enable_forking();
			s2e_make_symbolic(&fds[i], sizeof(int), "fds[i]");
			s2e_make_symbolic(filenames[i], 10, "filename");
			TEST(myfaccessat(fds[i], filenames[i], R_OK));
			s2e_disable_forking();
			s2e_kill_state(0, "program done");

			/* check return code */
			if (TEST_ERRNO == expected_errno[i]) {

				/***************************************************************
				 * only perform functional verification if flag set (-f not given)
				 ***************************************************************/
				if (STD_FUNCTIONAL_TEST) {
					/* No Verification test, yet... */
					tst_resm(TPASS,
						 "faccessat() returned the expected  errno %d: %s",
						 TEST_ERRNO,
						 strerror(TEST_ERRNO));
				}
			} else {
				TEST_ERROR_LOG(TEST_ERRNO);
				tst_resm(TFAIL,
					 "faccessdat() Failed, errno=%d : %s",
					 TEST_ERRNO, strerror(TEST_ERRNO));
			}
		}

	}

	/***************************************************************
	 * cleanup and exit
	 ***************************************************************/
	cleanup();

	return (0);
}