Change the log and output handling

Now the log file contains all the errors messages,
and all the tag lines.
This commit is contained in:
Andrea Mazzoleni 2015-02-02 23:39:46 +01:00
parent ce20be0ded
commit b5ce575981
32 changed files with 1127 additions and 1036 deletions

View file

@ -26,6 +26,7 @@
#include "raid/test.h"
#include "elem.h"
#include "state.h"
#include "support.h"
#include "tommyds/tommyhash.h"
#include "tommyds/tommyarray.h"
#include "tommyds/tommyarrayblk.h"
@ -159,7 +160,7 @@ static void test_hash(void)
digest = tommy_hash_u32(seed32, buffer_aligned, TEST_MURMUR3[i].len);
if (digest != TEST_HASH32[i].digest) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed hash32 test\n");
ferr("Failed hash32 test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -171,7 +172,7 @@ static void test_hash(void)
digest = tommy_hash_u64(seed64, buffer_aligned, TEST_MURMUR3[i].len);
if (digest != TEST_HASH64[i].digest) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed hash64 test\n");
ferr("Failed hash64 test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -184,7 +185,7 @@ static void test_hash(void)
memhash(HASH_MURMUR3, seed_aligned, digest, buffer_aligned, TEST_MURMUR3[i].len);
if (memcmp(digest, TEST_MURMUR3[i].digest, HASH_SIZE) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed Murmur3 test\n");
ferr("Failed Murmur3 test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -196,7 +197,7 @@ static void test_hash(void)
memhash(HASH_SPOOKY2, seed_aligned, digest, buffer_aligned, TEST_SPOOKY2[i].len);
if (memcmp(digest, TEST_SPOOKY2[i].digest, HASH_SIZE) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed Spooky2 test\n");
ferr("Failed Spooky2 test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -245,7 +246,7 @@ static void test_crc32c(void)
digest = crc32c(0, (const unsigned char*)TEST_CRC32C[i].data, TEST_CRC32C[i].len);
if (digest != TEST_CRC32C[i].digest) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed CRC32C test\n");
ferr("Failed CRC32C test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -372,14 +373,14 @@ static void test_tommy(void)
return;
bail:
/* LCOV_EXCL_START */
fprintf(stderr, "Failed tommy test\n");
ferr("Failed tommy test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
void selftest(void)
{
fprintf(stdlog, "selftest:\n");
ftag("selftest:\n");
fflush(stdlog);
printf("Self test...\n");
@ -387,7 +388,7 @@ void selftest(void)
/* large file check */
if (sizeof(off_t) < sizeof(uint64_t)) {
/* LCOV_EXCL_START */
fprintf(stderr, "Missing support for large files\n");
ferr("Missing support for large files\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
@ -397,55 +398,55 @@ void selftest(void)
test_tommy();
if (raid_selftest() != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed SELF test\n");
ferr("Failed SELF test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_sort() != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed SORT test\n");
ferr("Failed SORT test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_insert() != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed INSERT test\n");
ferr("Failed INSERT test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_combo() != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed COMBO test\n");
ferr("Failed COMBO test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_par(RAID_MODE_VANDERMONDE, 32, 256) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed GEN Vandermonde test\n");
ferr("Failed GEN Vandermonde test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_rec(RAID_MODE_VANDERMONDE, 12, 256) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed REC Vandermonde test\n");
ferr("Failed REC Vandermonde test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_par(RAID_MODE_CAUCHY, 32, 256) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed GEN Cauchy test\n");
ferr("Failed GEN Cauchy test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_rec(RAID_MODE_CAUCHY, 12, 256) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed REC Cauchy test\n");
ferr("Failed REC Cauchy test\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (raid_test_par(RAID_MODE_CAUCHY, 1, 256) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Failed GEN Cauchy test sigle data disk\n");
ferr("Failed GEN Cauchy test sigle data disk\n");
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}