@@ -32,7 +32,7 @@ static int dm_test_cpu(struct unit_test_state *uts)
ut_asserteq(cpu_is_current(dev), 1);
ut_assertok(cpu_get_desc(dev, text, sizeof(text)));
- ut_assertok(strcmp(text, "LEG Inc. SuperMegaUltraTurbo CPU No. 1"));
+ ut_asserteq_str(text, "LEG Inc. SuperMegaUltraTurbo CPU No. 1");
ut_assertok(cpu_get_info(dev, &info));
ut_asserteq(info.cpu_freq, 42 * 42 * 42 * 42 * 42);
@@ -42,7 +42,7 @@ static int dm_test_cpu(struct unit_test_state *uts)
ut_asserteq(cpu_get_count(dev), 42);
ut_assertok(cpu_get_vendor(dev, text, sizeof(text)));
- ut_assertok(strcmp(text, "Languid Example Garbage Inc."));
+ ut_asserteq_str(text, "Languid Example Garbage Inc.");
return 0;
}
@@ -91,10 +91,10 @@ static int dm_test_soc(struct unit_test_state *uts)
ut_assertok(soc_get(&dev));
ut_assertok(soc_get_machine(dev, text, sizeof(text)));
- ut_assertok(strcmp(text, "SANDBOX123"));
+ ut_asserteq_str(text, "SANDBOX123");
ut_assertok(soc_get_family(dev, text, sizeof(text)));
- ut_assertok(strcmp(text, "SANDBOX1xx"));
+ ut_asserteq_str(text, "SANDBOX1xx");
ut_assertok(soc_get_revision(dev, text, sizeof(text)));
ut_asserteq_str(text, "1.0");
@@ -36,7 +36,7 @@ static int dm_test_sysinfo(struct unit_test_state *uts)
ut_asserteq(6, sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
str));
- ut_assertok(strcmp(str, "R'lyeh"));
+ ut_asserteq_str(str, "R'lyeh");
ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i));
ut_asserteq(0, i);
@@ -46,7 +46,7 @@ static int dm_test_sysinfo(struct unit_test_state *uts)
ut_asserteq(7, sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
str));
- ut_assertok(strcmp(str, "Carcosa"));
+ ut_asserteq_str(str, "Carcosa");
ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i));
ut_asserteq(1, i);
@@ -56,7 +56,7 @@ static int dm_test_sysinfo(struct unit_test_state *uts)
ut_asserteq(7, sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
str));
- ut_assertok(strcmp(str, "Yuggoth"));
+ ut_asserteq_str(str, "Yuggoth");
return 0;
}
@@ -56,7 +56,7 @@ static int dm_test_usb_flash(struct unit_test_state *uts)
ut_asserteq(512, dev_desc->blksz);
memset(cmp, '\0', sizeof(cmp));
ut_asserteq(2, blk_dread(dev_desc, 0, 2, cmp));
- ut_assertok(strcmp(cmp, "this is a test"));
+ ut_asserteq_str(cmp, "this is a test");
ut_assertok(usb_stop());
return 0;
@@ -28,7 +28,7 @@ static int dm_test_virtio_base(struct unit_test_state *uts)
/* check the child virtio-blk device is bound */
ut_assertok(device_find_first_child(bus, &dev));
ut_assertnonnull(dev);
- ut_assertok(strcmp(dev->name, "virtio-blk#0"));
+ ut_asserteq_str(dev->name, "virtio-blk#0");
/* check driver status */
ut_assertok(virtio_get_status(dev, &status));
@@ -32,13 +32,13 @@ static int print_guid(struct unit_test_state *uts)
char str[40];
sprintf(str, "%pUb", guid);
- ut_assertok(strcmp("01020304-0506-0708-090a-0b0c0d0e0f10", str));
+ ut_asserteq_str("01020304-0506-0708-090a-0b0c0d0e0f10", str);
sprintf(str, "%pUB", guid);
- ut_assertok(strcmp("01020304-0506-0708-090A-0B0C0D0E0F10", str));
+ ut_asserteq_str("01020304-0506-0708-090A-0B0C0D0E0F10", str);
sprintf(str, "%pUl", guid);
- ut_assertok(strcmp("04030201-0605-0807-090a-0b0c0d0e0f10", str));
+ ut_asserteq_str("04030201-0605-0807-090a-0b0c0d0e0f10", str);
sprintf(str, "%pUL", guid);
- ut_assertok(strcmp("04030201-0605-0807-090A-0B0C0D0E0F10", str));
+ ut_asserteq_str("04030201-0605-0807-090A-0B0C0D0E0F10", str);
return 0;
}
@@ -70,11 +70,11 @@ static int print_efi_ut(struct unit_test_state *uts)
dp_end->length = sizeof(struct efi_device_path);
snprintf(str, sizeof(str), "_%pD_", buf);
- ut_assertok(strcmp("_/SD(3)_", str));
+ ut_asserteq_str("_/SD(3)_", str);
/* NULL device path */
snprintf(str, sizeof(str), "_%pD_", NULL);
- ut_assertok(strcmp("_<NULL>_", str));
+ ut_asserteq_str("_<NULL>_", str);
return 0;
}
@@ -89,41 +89,41 @@ static int print_printf(struct unit_test_state *uts)
int len;
snprintf(str, sizeof(str), "testing");
- ut_assertok(strcmp("testing", str));
+ ut_asserteq_str("testing", str);
snprintf(str, sizeof(str), "testing but too long");
- ut_assertok(strcmp("testing b", str));
+ ut_asserteq_str("testing b", str);
snprintf(str, 1, "testing none");
- ut_assertok(strcmp("", str));
+ ut_asserteq_str("", str);
*str = 'x';
snprintf(str, 0, "testing none");
ut_asserteq('x', *str);
sprintf(big_str, "_%ls_", L"foo");
- ut_assertok(strcmp("_foo_", big_str));
+ ut_asserteq_str("_foo_", big_str);
/* Test the banner function */
s = display_options_get_banner(true, str, sizeof(str));
ut_asserteq_ptr(str, s);
- ut_assertok(strcmp("\n\nU-Boo\n\n", s));
+ ut_asserteq_str("\n\nU-Boo\n\n", s);
/* Assert that we do not overwrite memory before the buffer */
str[0] = '`';
s = display_options_get_banner(true, str + 1, 1);
ut_asserteq_ptr(str + 1, s);
- ut_assertok(strcmp("`", str));
+ ut_asserteq_str("`", str);
str[0] = '~';
s = display_options_get_banner(true, str + 1, 2);
ut_asserteq_ptr(str + 1, s);
- ut_assertok(strcmp("~\n", str));
+ ut_asserteq_str("~\n", str);
/* The last two characters are set to \n\n for all buffer sizes > 2 */
s = display_options_get_banner(false, str, sizeof(str));
ut_asserteq_ptr(str, s);
- ut_assertok(strcmp("U-Boot \n\n", s));
+ ut_asserteq_str("U-Boot \n\n", s);
/* Give it enough space for some of the version */
big_str_len = strlen(version_string) - 5;
@@ -131,7 +131,7 @@ static int print_printf(struct unit_test_state *uts)
big_str_len);
ut_asserteq_ptr(big_str, s);
ut_assertok(strncmp(version_string, s, big_str_len - 3));
- ut_assertok(strcmp("\n\n", s + big_str_len - 3));
+ ut_asserteq_str("\n\n", s + big_str_len - 3);
/* Give it enough space for the version and some of the build tag */
big_str_len = strlen(version_string) + 9 + 20;
@@ -142,7 +142,7 @@ static int print_printf(struct unit_test_state *uts)
ut_assertok(strncmp(version_string, s, len));
ut_assertok(strncmp(", Build: ", s + len, 9));
ut_assertok(strncmp(FAKE_BUILD_TAG, s + 9 + len, 12));
- ut_assertok(strcmp("\n\n", s + big_str_len - 3));
+ ut_asserteq_str("\n\n", s + big_str_len - 3);
return 0;
}