示例#1
0
int main()
{
	int rc;

	/* open the bioule */
	rc = tbioopen();
	if (rc) {
		printf("Test bio Driver may not be loaded\n");
		exit(1);
	}

	if (ki_generic(tbio_fd , LTP_TBIO_ALLOC))
		printf("Failed on LTP_TBIO_ALLOC test\n");
	else
		printf("Success on LTP_TBIO_ALLOC test\n");

	if (ki_generic(tbio_fd , LTP_TBIO_CLONE))
		printf("Failed on LTP_TBIO_CLONE test\n");
	else
		printf("Success on LTP_TBIO_CLONE test\n");

	if (ki_generic(tbio_fd , LTP_TBIO_GET_NR_VECS))
		printf("Failed on LTP_TBIO_GET_NR_VECS test\n");
	else
		printf("Success on LTP_TBIO_GET_NR_VECS test\n");

	if (ki_generic(tbio_fd , LTP_TBIO_ADD_PAGE))
		printf("Failed on LTP_TBIO_ADD_PAGE test\n");
	else
		printf("Success on LTP_TBIO_ADD_PAGE test\n");

	if (tbio_split_to_dev(tbio_fd , LTP_TBIO_SPLIT))
		printf("Failed on LTP_TBIO_SPLIT:write to dev\n");
	else
		printf("Success on LTP_TBIO_SPLIT:write to dev\n");

	if (tbio_to_dev(tbio_fd , LTP_TBIO_DO_IO))
		printf("Failed on LTP_TBIO_DO_IO:write to dev\n");
	else
		printf("Success on LTP_TBIO_DO_IO:write to dev\n");

	if (tbio_from_dev(tbio_fd , LTP_TBIO_DO_IO))
		printf("Failed on LTP_TBIO_DO_IO:read from dev\n");
	else
		printf("Success on LTP_TBIO_DO_IO:read from dev\n");

	if (ki_generic(tbio_fd , LTP_TBIO_PUT))
		printf("Failed on LTP_TBIO_PUT test\n");
	else
		printf("Success on LTP_TBIO_PUT test\n");

	/* close the bioule */
	rc = tbioclose();
	if (rc) {
                printf("Test bio Driver may not be closed\n");
                exit(1);
        }

      return 0;
}
示例#2
0
文件: tbio.c 项目: CSRedRat/ltp
int main(void)
{
	setup();

	if (ki_generic(tbio_fd, LTP_TBIO_ALLOC))
		tst_resm(TFAIL, "failed on LTP_TBIO_ALLOC test");
	else
		tst_resm(TPASS, "success on LTP_TBIO_ALLOC test");

	if (ki_generic(tbio_fd, LTP_TBIO_CLONE))
		tst_resm(TFAIL, "failed on LTP_TBIO_CLONE test");
	else
		tst_resm(TPASS, "success on LTP_TBIO_CLONE test");

	if (ki_generic(tbio_fd, LTP_TBIO_GET_NR_VECS))
		tst_resm(TFAIL, "failed on LTP_TBIO_GET_NR_VECS test");
	else
		tst_resm(TPASS, "success on LTP_TBIO_GET_NR_VECS test");

	if (ki_generic(tbio_fd, LTP_TBIO_ADD_PAGE))
		tst_resm(TFAIL, "failed on LTP_TBIO_ADD_PAGE test");
	else
		tst_resm(TPASS, "success on LTP_TBIO_ADD_PAGE test");

	if (tbio_split_to_dev(tbio_fd, LTP_TBIO_SPLIT))
		tst_resm(TFAIL, "failed on LTP_TBIO_SPLIT:write to dev");
	else
		tst_resm(TPASS, "success on LTP_TBIO_SPLIT:write to dev");

	if (tbio_to_dev(tbio_fd, LTP_TBIO_DO_IO))
		tst_resm(TFAIL, "failed on LTP_TBIO_DO_IO:write to dev");
	else
		tst_resm(TPASS, "success on LTP_TBIO_DO_IO:write to dev");

	if (tbio_from_dev(tbio_fd, LTP_TBIO_DO_IO))
		tst_resm(TFAIL, "failed on LTP_TBIO_DO_IO:read from dev");
	else
		tst_resm(TPASS, "success on LTP_TBIO_DO_IO:read from dev");

	if (ki_generic(tbio_fd, LTP_TBIO_PUT))
		tst_resm(TFAIL, "failed on LTP_TBIO_PUT test");
	else
		tst_resm(TPASS, "success on LTP_TBIO_PUT test");

	cleanup();

	tst_exit();
}