• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CU_PASS函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CU_PASS函数的典型用法代码示例。如果您正苦于以下问题:C++ CU_PASS函数的具体用法?C++ CU_PASS怎么用?C++ CU_PASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CU_PASS函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_class_db_result_list

void test_class_db_result_list(void) {
    db_result_t* local_result = result;
    db_result_t* local_result2 = result2;

    CU_ASSERT_PTR_NOT_NULL_FATAL((result_list = db_result_list_new()));

    CU_ASSERT_FATAL(!db_result_list_add(result_list, result));
    result = NULL;
    CU_ASSERT_FATAL(!db_result_list_add(result_list, result2));
    result2 = NULL;

    CU_ASSERT(db_result_list_size(result_list) == 2);
    CU_ASSERT(db_result_list_begin(result_list) == local_result);
    CU_ASSERT(db_result_list_next(result_list) == local_result2);

    db_result_list_free(result_list);
    result_list = NULL;
    CU_PASS("db_result_list_free");
    CU_PASS("db_result_free");

    CU_ASSERT_PTR_NOT_NULL_FATAL((result_list = db_result_list_new()));

    CU_ASSERT_FATAL(!db_result_list_set_next(result_list, __db_result_list_next, &fake_pointer, 2));

    CU_ASSERT(db_result_list_size(result_list) == 2);
    CU_ASSERT_PTR_NOT_NULL(db_result_list_begin(result_list));
    CU_ASSERT_PTR_NOT_NULL(db_result_list_next(result_list));

    db_result_list_free(result_list);
    result_list = NULL;
    CU_PASS("db_result_list_free");
    CU_PASS("db_result_free");
}
开发者ID:jelu,项目名称:dbo,代码行数:33,代码来源:test_classes.c


示例2: test_reserve6_target_warm_reset

void
test_reserve6_target_warm_reset(void)
{
	int ret;
	struct scsi_device sd2;

	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test that RESERVE6 is released on target warm reset");

	if (sd->iscsi_ctx == NULL) {
		const char *err = "[SKIPPED] This RESERVE6 test is only "
			"supported for iSCSI backends";
		logging(LOG_NORMAL, "%s", err);
		CU_PASS(err);
		return;
	}

	logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
	ret = reserve6(sd);
	if (ret == -2) {
		logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
		CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
		return;
	}
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Send a Warm Reset to the target");
	ret = iscsi_task_mgmt_target_warm_reset_sync(sd->iscsi_ctx);
	if (ret != 0) {
		logging(LOG_NORMAL, "Warm reset failed. %s", iscsi_get_error(sd->iscsi_ctx));
	}
	CU_ASSERT_EQUAL(ret, 0);

	logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset");
	sleep(3);


	logging(LOG_VERBOSE, "Create a second connection to the target");
	memset(&sd2, 0, sizeof(sd2));
	sd2.iscsi_url = sd->iscsi_url;
	sd2.iscsi_lun = sd->iscsi_lun;
	sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd2.iscsi_url, &sd2.iscsi_lun);
	if (sd2.iscsi_ctx == NULL) {
		logging(LOG_VERBOSE, "Failed to login to target");
		return;
	}


	logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now");
	ret = reserve6(&sd2);
	CU_ASSERT_EQUAL(ret, 0);

	logging(LOG_VERBOSE, "RELEASE6 from the second initiator");
	ret = release6(&sd2);
	CU_ASSERT_EQUAL(ret, 0);

	iscsi_logout_sync(sd2.iscsi_ctx);
	iscsi_destroy_context(sd2.iscsi_ctx);
}
开发者ID:agrare,项目名称:libiscsi,代码行数:60,代码来源:test_reserve6_target_warm_reset.c


示例3: fonction_thread

void * fonction_thread ()
{
    cpt=100;

       while (cpt--) {
            le_sem_Wait(GSemPtr);
            fprintf(stdout, "\n%d : thread '%s' has %s %d\n",
                    cpt,le_thread_GetMyName(),SEM_NAME_1,le_sem_GetValue(GSemPtr));
            CU_PASS("thread GSemPtr get");
            le_sem_Wait(GSem2Ptr);
            fprintf(stdout, "\n%d : thread '%s' has %s %d\n",
                    cpt,le_thread_GetMyName(),SEM_NAME_2,le_sem_GetValue(GSem2Ptr));
            CU_PASS("thread GSem2Ptr get");
            usleep(10000);
            le_sem_Post(GSem2Ptr);
            fprintf(stdout, "\n%d : thread '%s' release %s %d\n",
                    cpt,le_thread_GetMyName(),SEM_NAME_2,le_sem_GetValue(GSem2Ptr));
            CU_PASS("thread GSemPtr2 UnLocked");
            le_sem_Post(GSemPtr);
            fprintf(stdout, "\n%d : thread '%s' release %s %d\n",
                    cpt,le_thread_GetMyName(),SEM_NAME_1,le_sem_GetValue(GSemPtr));
            CU_PASS("thread GSemPtr UnLocked");
    }

    return NULL;
}
开发者ID:tegoo,项目名称:legato-af,代码行数:26,代码来源:test_le_semaphore.c


示例4: test_reserve6_logout

void
test_reserve6_logout(void)
{
	int ret;
	struct scsi_device *sd2;

	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test that RESERVE6 is released on logout");

	if (sd->iscsi_ctx == NULL) {
		const char *err = "[SKIPPED] This RESERVE6 test is only "
			"supported for iSCSI backends";
		logging(LOG_NORMAL, "%s", err);
		CU_PASS(err);
		return;
	}

	logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
	ret = reserve6(sd);
	if (ret == -2) {
		logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
		CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
		return;
	}
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Create a second connection to the target");
	ret = mpath_sd2_get_or_clone(sd, &sd2);
	CU_ASSERT_EQUAL(ret, 0);

	logging(LOG_NORMAL, "Try to take out a RESERVE6 from the second initiator");
	ret = reserve6_conflict(sd2);
	CU_ASSERT_EQUAL(ret, 0);

	logging(LOG_VERBOSE, "Logout from target");
	iscsi_logout_sync(sd->iscsi_ctx);
	iscsi_destroy_context(sd->iscsi_ctx);

	logging(LOG_VERBOSE, "Relogin to target");
	sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun);
	if (sd->iscsi_ctx == NULL) {
		logging(LOG_VERBOSE, "Failed to login to target");
		return;
	}

	logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now");
	ret = reserve6(sd2);
	CU_ASSERT_EQUAL(ret, 0);

	logging(LOG_NORMAL, "RELEASE6 from the second initiator");
	ret = release6(sd2);
	CU_ASSERT_EQUAL(ret, 0);

	mpath_sd2_put(sd2);
}
开发者ID:daodewang,项目名称:libiscsi,代码行数:56,代码来源:test_reserve6_logout.c


示例5: test_read6_simple

void
test_read6_simple(void)
{
	int i, ret;


	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test READ6 of 1-255 blocks at the start of the LUN");
	for (i = 1; i <= 255; i++) {
		ret = read6(iscsic, tgt_lun, 0, i * block_size,
			    block_size, NULL);
		if (ret == -2) {
			logging(LOG_NORMAL, "[SKIPPED] READ6 is not implemented.");
			CU_PASS("READ6 is not implemented.");
			return;
		}	
		CU_ASSERT_EQUAL(ret, 0);
	}


	logging(LOG_VERBOSE, "Test READ6 of 1-255 blocks at the end of the LUN");
	if (num_blocks > 0x200000) {
		CU_PASS("LUN is too big for read-at-eol tests with READ6. Skipping test.\n");
	} else {
		for (i = 1; i <= 255; i++) {
			ret = read6(iscsic, tgt_lun, num_blocks - i,
				i * block_size, block_size, NULL);
			CU_ASSERT_EQUAL(ret, 0);
		}
	}

	logging(LOG_VERBOSE, "Transfer length == 0 means we want to transfer "
		"256 blocks");

	logging(LOG_VERBOSE, "Test sending a READ6 with transfer length == 0 "
		"(meaning 256 blocks)");
	/* 256 is converted to 0 when the CDB is marshalled by the helper */
	task = iscsi_read6_sync(iscsic, tgt_lun, 0,
				256 * block_size, block_size);
	if (task->status != SCSI_STATUS_GOOD) {
		logging(LOG_NORMAL, "[FAILED] READ6 command: "
			"failed with sense. %s", iscsi_get_error(iscsic));
	}
	CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD);

	logging(LOG_VERBOSE, "Verify that we did get 256 blocks of data back");
	if (task->datain.size == (int)(256 * block_size)) {
		logging(LOG_VERBOSE, "[SUCCESS] Target returned 256 blocks of "
			"data");
	} else {
		logging(LOG_NORMAL, "[FAILED] Target did not return 256 "
			"blocks of data");
	}
	CU_ASSERT_EQUAL(task->datain.size, (int)(256 * block_size));
}
开发者ID:gcbirzan,项目名称:libiscsi,代码行数:55,代码来源:test_read6_simple.c


示例6: test_writeatomic16_wrprotect

void
test_writeatomic16_wrprotect(void)
{
    int i, gran, ret;
    unsigned char *buf = alloca(block_size);

    CHECK_FOR_DATALOSS;
    CHECK_FOR_SBC;

    if (!inq_bl) {
        CU_PASS("BlockLimits VPD is not available. Skipping test.\n");
        return;
    }

    logging(LOG_VERBOSE, LOG_BLANK_LINE);

    gran = inq_bl->atomic_gran ? inq_bl->atomic_gran : 1;
    ret = writeatomic16(sd, 0,
                        block_size * gran,
                        block_size, 0, 0, 0, 0, buf,
                        EXPECT_STATUS_GOOD);
    if (ret == -2) {
        logging(LOG_NORMAL, "[SKIPPED] WRITEATOMIC16 is not implemented.");
        CU_PASS("WRITEATOMIC16 is not implemented.");
        return;
    }
    CU_ASSERT_EQUAL(ret, 0);


    logging(LOG_VERBOSE, "Test WRITEATOMIC16 with non-zero WRPROTECT");

    memset(buf, 0xa6, block_size);
    if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
        logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
        for (i = 1; i < 8; i++) {
            ret = writeatomic16(sd, 0,
                                gran * block_size, block_size,
                                i, 0, 0, 0, buf,
                                EXPECT_INVALID_FIELD_IN_CDB);
            if (ret == -2) {
                logging(LOG_NORMAL, "[SKIPPED] WRITEATOMIC16 is not implemented.");
                CU_PASS("WRITEATOMIC16 is not implemented.");
                return;
            }
            CU_ASSERT_EQUAL(ret, 0);
        }
        return;
    }

    logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}
开发者ID:daodewang,项目名称:libiscsi,代码行数:51,代码来源:test_writeatomic16_wrprotect.c


示例7: test_writesame16_0blocks

void
test_writesame16_0blocks(void)
{
	int ret;

	CHECK_FOR_DATALOSS;
	CHECK_FOR_SBC;

	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==0 (WSNZ=%d)",
		inq_bl->wsnz);
	ret = writesame16(iscsic, tgt_lun, 0,
			  block_size, 0,
			  0, 0, 0, 0, NULL);
	if (ret == -2) {
		logging(LOG_NORMAL, "[SKIPPED] WRITESAME16 is not implemented.");
		CU_PASS("[SKIPPED] Target does not support WRITESAME16. Skipping test");
		return;
	} else if (ret == -3) {
		CU_PASS("[SKIPPED] Target does not support WRITESAME16 with NUMBER OF LOGICAL BLOCKS == 0");
	} else if (ret == -4) {
		CU_PASS("[SKIPPED] Number of WRITESAME16 logical blocks to be written exceeds MAXIMUM WRITE SAME LENGTH");
	} else {
		if (inq_bl->wsnz) {
			CU_ASSERT_EQUAL(ret, -1);
		} else {
			CU_ASSERT_EQUAL(ret, 0);
		}
	}

	logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks one block past end-of-LUN");
	ret = writesame16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1,
					block_size, inq_bl->wsnz,
					0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==2^63");
	ret = writesame16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000ULL,
					block_size, inq_bl->wsnz,
					0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==-1");
	ret = writesame16_lbaoutofrange(iscsic, tgt_lun, -1,
					block_size, inq_bl->wsnz,
					0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);
}
开发者ID:gcbirzan,项目名称:libiscsi,代码行数:50,代码来源:test_writesame16_0blocks.c


示例8: testCreateDestroy

void testCreateDestroy(void)
{
    le_sem_Ref_t semPtr=NULL,semPtr2=NULL;

    semPtr     = le_sem_Create( "SEMAPHORE-1", 10);
    CU_ASSERT_PTR_NOT_EQUAL(semPtr, NULL);

    semPtr2    = le_sem_CreateTraceable( "SEMAPHORE-2", 1);
    CU_ASSERT_PTR_NOT_EQUAL(semPtr2, NULL);


    le_sem_Delete(semPtr);
    CU_PASS("Destruct semaphore\n");
    le_sem_Delete(semPtr2);
    CU_PASS("Destruct semaphore\n");
}
开发者ID:tegoo,项目名称:legato-af,代码行数:16,代码来源:test_le_semaphore.c


示例9: test_prin_read_keys_simple

void
test_prin_read_keys_simple(void)
{
	int ret = 0;
	int al;


	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test Persistent Reserve IN READ_KEYS works.");

	ret = prin_read_keys(iscsic, tgt_lun, &task, NULL);
	if (ret == -2) {
		logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE IN is not implemented.");
		CU_PASS("PERSISTENT RESERVE IN is not implemented.");
		return;
	}	
	CU_ASSERT_EQUAL(ret, 0);

	logging(LOG_VERBOSE, "Test DATA-IN is at least 8 bytes.");
	if (task->datain.size < 8) {
		logging(LOG_NORMAL,
		    "[FAILED] DATA-IN returned less than 8 bytes");
		return;
	}

	logging(LOG_VERBOSE, "Test ADDITIONAL_LENGTH matches DATA_IN size.");
	al = scsi_get_uint32(&task->datain.data[4]);
	if (al != task->datain.size - 8) {
		logging(LOG_NORMAL,
		    "[FAILED] ADDITIONAL_LENGTH was %d bytes but %d was expected.",
			al, task->datain.size - 8);
		return;
	}
}
开发者ID:Jiangliuer,项目名称:libiscsi,代码行数:34,代码来源:test_prin_read_keys_simple.c


示例10: test_verify12_flags

void
test_verify12_flags(void)
{
	int ret;
	unsigned char *buf = alloca(block_size);

	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test VERIFY12 flags");

	ret = read10(iscsic, tgt_lun, 0, block_size,
		     block_size, 0, 0, 0, 0, 0, buf);
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Test VERIFY12 with DPO==1");
	ret = verify12(iscsic, tgt_lun, 0, block_size,
		       block_size, 0, 1, 0, buf);
	if (ret == -2) {
		logging(LOG_NORMAL, "[SKIPPED] VERIFY12 is not implemented.");
		CU_PASS("[SKIPPED] Target does not support VERIFY12. Skipping test");
		return;
	}
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Test VERIFY12 with BYTCHK==1");
	ret = verify12(iscsic, tgt_lun, 0, block_size,
		       block_size, 0, 0, 1, buf);
	CU_ASSERT_EQUAL(ret, 0);
}
开发者ID:Swind,项目名称:libiscsi,代码行数:30,代码来源:test_verify12_flags.c


示例11: test_sanitize_exit_failure_mode

void
test_sanitize_exit_failure_mode(void)
{ 
        struct iscsi_data data;
        struct scsi_command_descriptor *cd;

        logging(LOG_VERBOSE, LOG_BLANK_LINE);
        logging(LOG_VERBOSE, "Test SANITIZE EXIT FAILURE MODE");

        CHECK_FOR_SANITIZE;
        CHECK_FOR_DATALOSS;

        logging(LOG_VERBOSE, "Check that SANITIZE EXIT FAILURE MODE is "
                "supported in REPORT_SUPPORTED_OPCODES");
        cd = get_command_descriptor(SCSI_OPCODE_SANITIZE,
                                    SCSI_SANITIZE_EXIT_FAILURE_MODE);
        if (cd == NULL) {
                logging(LOG_NORMAL, "[SKIPPED] SANITIZE EXIT FAILURE MODE is "
                        "not implemented according to "
                        "REPORT_SUPPORTED_OPCODES.");
                CU_PASS("SANITIZE is not implemented.");
                return;
        }

        data.size = 8;
        data.data = alloca(data.size);
        memset(data.data, 0, data.size);

        logging(LOG_VERBOSE, "EXIT_FAILURE_MODE parameter list length must "
                "be 0");
        logging(LOG_VERBOSE, "Test that non-zero param length is an error for "
                "EXIT_FAILURE_MODE");
        SANITIZE(sd, 0, 0, SCSI_SANITIZE_EXIT_FAILURE_MODE, 8, &data,
                 EXPECT_INVALID_FIELD_IN_CDB);
}
开发者ID:bonzini,项目名称:libiscsi,代码行数:35,代码来源:test_sanitize_exit_failure_mode.c


示例12: test_ofp_packet_input_local_UDPv4_hook

static void
test_ofp_packet_input_local_UDPv4_hook(void)
{
    odp_packet_t pkt;
    int res;

    /* Call ofp_packet_input with a pkt with destination ip
     * that matches the local ip on ifnet.
     * The packet is terminated in local UDPv4 hook */
    my_test_val = TEST_LOCAL_UDPv4_HOOK;
    ifnet->ip_addr = dst_ipaddr;
    if (create_odp_packet_ip4(&pkt, test_frame, sizeof(test_frame),
                              dst_ipaddr, 0)) {
        CU_FAIL("Fail to create packet");
        return;
    }

    res = ofp_packet_input(pkt, interface_queue[port],
                           ofp_eth_vlan_processing);
    CU_ASSERT_EQUAL(res, OFP_TEST_LOCAL_UDPv4_HOOK);
#ifdef SP
    CU_ASSERT_EQUAL(odp_queue_deq(ifnet->spq_def), ODP_EVENT_INVALID);
#endif /* SP */
    CU_ASSERT_EQUAL(odp_queue_deq(ifnet->outq_def), ODP_EVENT_INVALID);
    ifnet->ip_addr = 0;
    CU_PASS("ofp_packet_input_local_UDPv4_hook");
}
开发者ID:abhinayramesh,项目名称:ofp,代码行数:27,代码来源:ofp_test_packet_input.c


示例13: test_read10_0blocks

void
test_read10_0blocks(void)
{
	int ret;

	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==0");
	ret = read10(iscsic, tgt_lun, 0, 0, block_size,
		     0, 0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);

	if (num_blocks > 0x80000000) {
		CU_PASS("[SKIPPED] LUN is too big");
		return;
	}

	logging(LOG_VERBOSE, "Test READ10 0-blocks one block past end-of-LUN");
	ret = read10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
				   block_size, 0, 0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==2^31");
	ret = read10_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0, block_size,
				   0, 0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);


	logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==-1");
	ret = read10_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
				   0, 0, 0, 0, 0, NULL);
	CU_ASSERT_EQUAL(ret, 0);
}
开发者ID:Jiangliuer,项目名称:libiscsi,代码行数:33,代码来源:test_read10_0blocks.c


示例14: test_verify16_vrprotect

void
test_verify16_vrprotect(void)
{
	int i, ret;
	unsigned char *buf = alloca(block_size);


	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test VERIFY16 with non-zero VRPROTECT");

	CHECK_FOR_SBC;

	if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
		logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
		for (i = 1; i < 8; i++) {
			ret = read16(iscsic, tgt_lun, 0, block_size,
			    block_size, 0, 0, 0, 0, 0, buf);
	
			ret = verify16_invalidfieldincdb(iscsic, tgt_lun, 0, block_size,
							 block_size, i, 0, 1, buf);
			if (ret == -2) {
				logging(LOG_NORMAL, "[SKIPPED] VERIFY16 is not implemented.");
				CU_PASS("[SKIPPED] Target does not support VERIFY16. Skipping test");
				return;
			}
			CU_ASSERT_EQUAL(ret, 0);
		}
		return;
	}

	logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}
开发者ID:Jiangliuer,项目名称:libiscsi,代码行数:32,代码来源:test_verify16_vrprotect.c


示例15: test_orwrite_wrprotect

void
test_orwrite_wrprotect(void)
{
	int i, ret;
	unsigned char *buf = alloca(block_size);

	/*
	 * Try out different non-zero values for WRPROTECT.
	 */
	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test ORWRITE with non-zero WRPROTECT");

	CHECK_FOR_DATALOSS;
	CHECK_FOR_SBC;

	if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
		logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
		for (i = 1; i < 8; i++) {
			ret = orwrite_invalidfieldincdb(iscsic, tgt_lun, 0,
					       block_size, block_size,
					       i, 0, 0, 0, 0, buf);
			if (ret == -2) {
				logging(LOG_NORMAL, "[SKIPPED] ORWRITE is not implemented.");
				CU_PASS("ORWRITE is not implemented.");
				return;
			}	
			CU_ASSERT_EQUAL(ret, 0);
		}
		return;
	}

	logging(LOG_NORMAL, "No tests for devices that support protection information yet.");
}
开发者ID:Jiangliuer,项目名称:libiscsi,代码行数:33,代码来源:test_orwrite_wrprotect.c


示例16: test_writeverify12_0blocks

void
test_writeverify12_0blocks(void)
{
        CHECK_FOR_DATALOSS;

        if (num_blocks >= 0x80000000) {
                CU_PASS("LUN is too big for read-beyond-eol tests with WRITEVERIFY12. Skipping test.\n");
                return;
        }

        logging(LOG_VERBOSE, LOG_BLANK_LINE);
        logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==0");
        WRITEVERIFY12(sd, 0, 0, block_size, 0, 0, 0, 0, NULL,
                      EXPECT_STATUS_GOOD);

        logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks one block past end-of-LUN");
        WRITEVERIFY12(sd, num_blocks + 1, 0, block_size, 0, 0, 0, 0, NULL,
                      EXPECT_LBA_OOB);

        logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==2^31");
        WRITEVERIFY12(sd, 0x80000000, 0, block_size, 0, 0, 0, 0, NULL,
                      EXPECT_LBA_OOB);

        logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==-1");
        WRITEVERIFY12(sd, -1, 0, block_size, 0, 0, 0, 0, NULL,
                      EXPECT_LBA_OOB);
}
开发者ID:bonzini,项目名称:libiscsi,代码行数:27,代码来源:test_writeverify12_0blocks.c


示例17: test_read12_simple

void
test_read12_simple(void)
{
	int i, ret;


	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test READ12 of 1-256 blocks at the start of the LUN");
	for (i = 1; i <= 256; i++) {
		if (maximum_transfer_length && maximum_transfer_length < i) {
			break;
		}
		ret = read12(sd, NULL, 0, i * block_size,
			     block_size, 0, 0, 0, 0, 0, NULL,
			     EXPECT_STATUS_GOOD);
		if (ret == -2) {
			logging(LOG_NORMAL, "[SKIPPED] READ12 is not implemented.");
			CU_PASS("READ12 is not implemented.");
			return;
		}	
		CU_ASSERT_EQUAL(ret, 0);
	}


	logging(LOG_VERBOSE, "Test READ12 of 1-256 blocks at the end of the LUN");
	for (i = 1; i <= 256; i++) {
		if (maximum_transfer_length && maximum_transfer_length < i) {
			break;
		}
		ret = read12(sd, NULL, num_blocks - i,
			     i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
			     EXPECT_STATUS_GOOD);
		CU_ASSERT_EQUAL(ret, 0);
	}
}
开发者ID:agrare,项目名称:libiscsi,代码行数:35,代码来源:test_read12_simple.c


示例18: test_prefetch16_simple

void
test_prefetch16_simple(void)
{
	int i, ret;

	logging(LOG_VERBOSE, LOG_BLANK_LINE);
	logging(LOG_VERBOSE, "Test PREFETCH16 of 1-256 blocks at the start of the LUN");
	for (i = 1; i <= 256; i++) {
		ret = prefetch16(sd, 0, i, 0, 0,
				 EXPECT_STATUS_GOOD);
		if (ret == -2) {
			logging(LOG_NORMAL, "[SKIPPED] PREFETCH16 is not implemented.");
			CU_PASS("PREFETCH16 is not implemented.");
			return;
		}	
		CU_ASSERT_EQUAL(ret, 0);
	}


	logging(LOG_VERBOSE, "Test PREFETCH16 of 1-256 blocks at the end of the LUN");
	for (i = 1; i <= 256; i++) {
		ret = prefetch16(sd, num_blocks - i, i, 0, 0,
				 EXPECT_STATUS_GOOD);
		CU_ASSERT_EQUAL(ret, 0);
	}
}
开发者ID:agrare,项目名称:libiscsi,代码行数:26,代码来源:test_prefetch16_simple.c


示例19: test_ofp_packet_input_to_sp

static void
test_ofp_packet_input_to_sp(void)
{
    odp_packet_t pkt;
    odp_event_t ev;
    int res;

    my_test_val = TEST_FORWARD_HOOK;
    /* Call ofp_packet_input using a pkt with destination ip
     * that does NOT match the local ip on ifnet and NO route is found.
     * The packet is forwarded to slow path queue. */
    if (create_odp_packet_ip4(&pkt, test_frame, sizeof(test_frame), 0, 0)) {
        CU_FAIL("Fail to create packet");
        return;
    }

    res = ofp_packet_input(pkt, interface_queue[port],
                           ofp_eth_vlan_processing);

    CU_ASSERT_EQUAL(res, OFP_PKT_PROCESSED);

    CU_ASSERT_NOT_EQUAL(ev = odp_queue_deq(ifnet->spq_def),
                        ODP_EVENT_INVALID);
    CU_ASSERT_EQUAL(odp_queue_deq(ifnet->spq_def), ODP_EVENT_INVALID);
    CU_ASSERT_EQUAL(odp_queue_deq(ifnet->outq_def), ODP_EVENT_INVALID);

    if (memcmp(odp_packet_data(odp_packet_from_event(ev)),
               in_pkt_data, sizeof(test_frame)))
        CU_FAIL("corrupt data sent to slow path");
    odp_packet_free(odp_packet_from_event(ev));
    CU_PASS("ofp_packet_input_to_sp");
}
开发者ID:abhinayramesh,项目名称:ofp,代码行数:32,代码来源:ofp_test_packet_input.c


示例20: test_class_db_object

void test_class_db_object(void) {
    db_object_field_list_t* local_object_field_list = object_field_list;
    db_backend_meta_data_list_t* local_backend_meta_data_list = backend_meta_data_list;

    CU_ASSERT_PTR_NOT_NULL_FATAL((object = db_object_new()));

    CU_ASSERT(!db_object_set_connection(object, connection));
    CU_ASSERT(!db_object_set_table(object, "table"));
    CU_ASSERT(!db_object_set_primary_key_name(object, "primary_key"));
    CU_ASSERT(!db_object_set_object_field_list(object, object_field_list));
    object_field_list = NULL;
    CU_ASSERT(!db_object_set_backend_meta_data_list(object, backend_meta_data_list));
    backend_meta_data_list = NULL;

    CU_ASSERT(db_object_connection(object) == connection);
    CU_ASSERT_PTR_NOT_NULL_FATAL(db_object_table(object));
    CU_ASSERT(!strcmp(db_object_table(object), "table"));
    CU_ASSERT_PTR_NOT_NULL_FATAL(db_object_primary_key_name(object));
    CU_ASSERT(!strcmp(db_object_primary_key_name(object), "primary_key"));
    CU_ASSERT(db_object_object_field_list(object) == local_object_field_list);
    CU_ASSERT(db_object_backend_meta_data_list(object) == local_backend_meta_data_list);

    CU_ASSERT(!db_object_create(object, (db_object_field_list_t*)&fake_pointer, (db_value_set_t*)&fake_pointer));
    CU_ASSERT(db_object_read(object, (db_join_list_t*)&fake_pointer, (db_clause_list_t*)&fake_pointer) == (db_result_list_t*)&fake_pointer);
    CU_ASSERT(!db_object_update(object, (db_object_field_list_t*)&fake_pointer, (db_value_set_t*)&fake_pointer, (db_clause_list_t*)&fake_pointer));
    CU_ASSERT(!db_object_delete(object, (db_clause_list_t*)&fake_pointer));
    CU_ASSERT(!db_object_count(object, (db_join_list_t*)&fake_pointer, (db_clause_list_t*)&fake_pointer, (size_t*)&fake_pointer));

    db_object_free(object);
    object = NULL;
    CU_PASS("db_object_free");
}
开发者ID:jelu,项目名称:dbo,代码行数:32,代码来源:test_classes.c



注:本文中的CU_PASS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CU_add_suite函数代码示例发布时间:2022-05-30
下一篇:
C++ CU_FAIL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap