[settings] Add "hexraw" setting type

Originally-implemented-by: Jeppe Toustrup <ipxe@tenzer.dk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-07-12 14:58:19 +02:00
parent 7774ceed2f
commit 9f3bbaca07
3 changed files with 50 additions and 0 deletions

View File

@@ -170,6 +170,12 @@ static struct setting test_hexhyp_setting = {
.type = &setting_type_hexhyp,
};
/** Test raw hex string setting type */
static struct setting test_hexraw_setting = {
.name = "test_hexraw",
.type = &setting_type_hexraw,
};
/** Test UUID setting type */
static struct setting test_uuid_setting = {
.name = "test_uuid",
@@ -262,6 +268,14 @@ static void settings_test_exec ( void ) {
0x09, 0x6c, 0x66, 0x13, 0xc1, 0xa8, 0xec, 0x27 ),
"9f-e5-6d-fb-24-3a-4c-bb-a9-09-6c-66-13-c1-a8-ec-27" );
/* "hexraw" setting type */
storef_ok ( &test_settings, &test_hexraw_setting,
"012345abcdef", RAW ( 0x01, 0x23, 0x45, 0xab, 0xcd, 0xef ));
fetchf_ok ( &test_settings, &test_hexraw_setting,
RAW ( 0x9e, 0x4b, 0x6e, 0xef, 0x36, 0xb6, 0x46, 0xfe, 0x8f,
0x17, 0x06, 0x39, 0x6b, 0xf4, 0x48, 0x4e ),
"9e4b6eef36b646fe8f1706396bf4484e" );
/* "uuid" setting type (no store capability) */
fetchf_ok ( &test_settings, &test_uuid_setting,
RAW ( 0x1a, 0x6a, 0x74, 0x9d, 0x0e, 0xda, 0x46, 0x1a,0xa8,