Small tweak to self-test routine.
This commit is contained in:
parent
fde0906f98
commit
3cdfc9d9ab
@ -490,7 +490,7 @@ static int decrypt(const char* const passphrase, const CHR* const input_path, co
|
|||||||
}
|
}
|
||||||
else if ((file_size % sizeof(uint64_t)) != 0)
|
else if ((file_size % sizeof(uint64_t)) != 0)
|
||||||
{
|
{
|
||||||
FPRINTF(stderr, T("Warning: File size is *not* an integer multiple of %u, ignoring excess bytes!\n\n"), (unsigned int)sizeof(uint64_t));
|
FPRINTF(stderr, T("Warning: File size is *not* an integer multiple of %u, ignoring excess bytes!\n\n"), (unsigned)sizeof(uint64_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
FPUTS(T("Decrypting file contents, please be patient... "), stderr);
|
FPUTS(T("Decrypting file contents, please be patient... "), stderr);
|
||||||
@ -761,28 +761,25 @@ clean_up:
|
|||||||
|
|
||||||
static int run_self_test(void)
|
static int run_self_test(void)
|
||||||
{
|
{
|
||||||
static const size_t total = 32U;
|
const char *const TEST_DATA[] = { TEST_DATA_0, TEST_DATA_1, TEST_DATA_2, TEST_DATA_3 };
|
||||||
const char* const test_data[] = { TEST_DATA_0, TEST_DATA_1, TEST_DATA_2, TEST_DATA_3, NULL };
|
const uint64_t TEST_CHCK[] = { TEST_CHCK_0, TEST_CHCK_1, TEST_CHCK_2, TEST_CHCK_3 };
|
||||||
const uint64_t test_chck[] = { TEST_CHCK_0, TEST_CHCK_1, TEST_CHCK_2, TEST_CHCK_3, 0x00 };
|
|
||||||
|
|
||||||
size_t completed = 0U;
|
const size_t total = sizeof(TEST_DATA) / sizeof(TEST_DATA[0]);
|
||||||
FPRINTF(stderr, T("Self-test is in progress, please be patient... %2u/%2u "), (unsigned int)completed, (unsigned int)total);
|
|
||||||
|
FPRINTF(stderr, T("Self-test is in progress, please be patient... stage %u/%u "), 0U, (unsigned)total);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
for (size_t i = 0U; i < 8U; ++i)
|
for (size_t i = 0U; i < total; ++i)
|
||||||
{
|
{
|
||||||
for (size_t j = 0U; test_data[j]; ++j)
|
FPRINTF(stderr, T("\b\b\b\b%u/%u "), (unsigned)(i + 1U), (unsigned)total);
|
||||||
|
fflush(stderr);
|
||||||
|
if (run_test_case(TEST_DATA[i], TEST_CHCK[i]) != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
FPRINTF(stderr, T("\b\b\b\b\b\b%2u/%2u "), (unsigned int)++completed, (unsigned int)total);
|
return EXIT_FAILURE;
|
||||||
fflush(stderr);
|
|
||||||
if (run_test_case(test_data[j], test_chck[j]) != EXIT_SUCCESS)
|
|
||||||
{
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FPRINTF(stderr, T("\b\b\b\b\b\b%2u/%2u\n\nCompleted successfully.\n\n"), (unsigned int)total, (unsigned int)total);
|
FPRINTF(stderr, T("\b\b\b\b%u/%u\n\nCompleted successfully.\n\n"), (unsigned)total, (unsigned)total);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user