tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
Extension
.c
Size
7089 bytes
Lines
353
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct vpd_test {
	int (*function)(void);
	const char *description;
};

static const struct vpd_test vpd_tests[] = {
	{
		.function = dev_papr_vpd_open_close,
		.description = "open/close " DEVPATH,
	},
	{
		.function = dev_papr_vpd_unterm_loc_code,
		.description = "ensure EINVAL on unterminated location code",
	},
	{
		.function = dev_papr_vpd_null_handle,
		.description = "ensure EFAULT on bad handle addr",
	},
	{
		.function = dev_papr_vpd_get_handle_all,
		.description = "get handle for all VPD"
	},
	{
		.function = papr_vpd_close_handle_without_reading,
		.description = "close handle without consuming VPD"
	},
	{
		.function = dev_papr_vpd_get_handle_byte_at_a_time,
		.description = "read all VPD one byte at a time"
	},
	{
		.function = papr_vpd_reread,
		.description = "ensure re-read yields same results"
	},
	{
		.function = papr_vpd_system_loc_code,
		.description = "get handle for system VPD"
	},
};

int main(void)
{
	size_t fails = 0;

	for (size_t i = 0; i < ARRAY_SIZE(vpd_tests); ++i) {
		const struct vpd_test *t = &vpd_tests[i];

		if (test_harness(t->function, t->description))
			++fails;
	}

	return fails == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}

Annotation

Implementation Notes