コード例 #1
0
int dm_leak_check_end(struct unit_test_state *uts)
{
	struct mallinfo end;
	int id, diff;

	/* Don't delete the root class, since we started with that */
	for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) {
		struct uclass *uc;

		uc = uclass_find(id);
		if (!uc)
			continue;
		ut_assertok(uclass_destroy(uc));
	}

	end = mallinfo();
	diff = end.uordblks - uts->start.uordblks;
	if (diff > 0)
		printf("Leak: lost %#xd bytes\n", diff);
	else if (diff < 0)
		printf("Leak: gained %#xd bytes\n", -diff);
	ut_asserteq(uts->start.uordblks, end.uordblks);

	return 0;
}
コード例 #2
0
ファイル: core.c プロジェクト: mfkiwl/u-boot
static int dm_test_uclass_before_ready(struct dm_test_state *dms)
{
	struct uclass *uc;

	ut_assertok(uclass_get(UCLASS_TEST, &uc));

	memset(gd, '\0', sizeof(*gd));
	ut_asserteq_ptr(NULL, uclass_find(UCLASS_TEST));

	return 0;
}
コード例 #3
0
ファイル: core.c プロジェクト: LCameron/xilinx-uboot
static int dm_test_uclass_before_ready(struct unit_test_state *uts)
{
	struct uclass *uc;

	ut_assertok(uclass_get(UCLASS_TEST, &uc));

	gd->dm_root = NULL;
	gd->dm_root_f = NULL;
	memset(&gd->uclass_root, '\0', sizeof(gd->uclass_root));

	ut_asserteq_ptr(NULL, uclass_find(UCLASS_TEST));

	return 0;
}
コード例 #4
0
ファイル: test-main.c プロジェクト: Android4SAM/u-boot-at91
static int dm_test_destroy(struct dm_test_state *dms)
{
	int id;

	for (id = 0; id < UCLASS_COUNT; id++) {
		struct uclass *uc;

		/*
		 * If the uclass doesn't exist we don't want to create it. So
		 * check that here before we call uclass_find_device()/
		 */
		uc = uclass_find(id);
		if (!uc)
			continue;
		ut_assertok(uclass_destroy(uc));
	}

	return 0;
}
コード例 #5
0
ファイル: core.c プロジェクト: Android4SAM/u-boot-at91
/* Remove and recreate everything, check for memory leaks */
static int dm_test_leak(struct dm_test_state *dms)
{
	int i;

	for (i = 0; i < 2; i++) {
		struct mallinfo start, end;
		struct udevice *dev;
		int ret;
		int id;

		start = mallinfo();
		if (!start.uordblks)
			puts("Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c\n");

		ut_assertok(dm_scan_platdata());
		ut_assertok(dm_scan_fdt(gd->fdt_blob));

		/* Scanning the uclass is enough to probe all the devices */
		for (id = UCLASS_ROOT; id < UCLASS_COUNT; id++) {
			for (ret = uclass_first_device(UCLASS_TEST, &dev);
			     dev;
			     ret = uclass_next_device(&dev))
				;
			ut_assertok(ret);
		}

		/* Don't delete the root class, since we started with that */
		for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) {
			struct uclass *uc;

			uc = uclass_find(id);
			if (!uc)
				continue;
			ut_assertok(uclass_destroy(uc));
		}

		end = mallinfo();
		ut_asserteq(start.uordblks, end.uordblks);
	}

	return 0;
}
コード例 #6
0
ファイル: core.c プロジェクト: LCameron/xilinx-uboot
int dm_leak_check_end(struct unit_test_state *uts)
{
	struct mallinfo end;
	int id;

	/* Don't delete the root class, since we started with that */
	for (id = UCLASS_ROOT + 1; id < UCLASS_COUNT; id++) {
		struct uclass *uc;

		uc = uclass_find(id);
		if (!uc)
			continue;
		ut_assertok(uclass_destroy(uc));
	}

	end = mallinfo();
	ut_asserteq(uts->start.uordblks, end.uordblks);

	return 0;
}