mirror of
https://github.com/intel/isa-l.git
synced 2025-01-06 15:10:02 +01:00
erasure_code: [test] fix memory leak
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
parent
abd80d3c5a
commit
a3e260436a
@ -215,13 +215,14 @@ static int gf_gen_decode_matrix(unsigned char *encode_matrix,
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int re = 0;
|
int re = -1;
|
||||||
int i, j, p, rtest, m, k;
|
int i, j, p, rtest, m, k;
|
||||||
int nerrs, nsrcerrs;
|
int nerrs, nsrcerrs;
|
||||||
void *buf;
|
void *buf;
|
||||||
unsigned int decode_index[MMAX];
|
unsigned int decode_index[MMAX];
|
||||||
unsigned char *temp_buffs[TEST_SOURCES], *buffs[TEST_SOURCES];
|
unsigned char *temp_buffs[TEST_SOURCES] = { NULL }, *buffs[TEST_SOURCES] = { NULL };
|
||||||
unsigned char *encode_matrix, *decode_matrix, *invert_matrix, *g_tbls;
|
unsigned char *encode_matrix = NULL, *decode_matrix = NULL, *invert_matrix =
|
||||||
|
NULL, *g_tbls = NULL;
|
||||||
unsigned char src_in_err[TEST_SOURCES], src_err_list[TEST_SOURCES];
|
unsigned char src_in_err[TEST_SOURCES], src_err_list[TEST_SOURCES];
|
||||||
unsigned char *recov[TEST_SOURCES];
|
unsigned char *recov[TEST_SOURCES];
|
||||||
|
|
||||||
@ -238,7 +239,7 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < TEST_SOURCES; i++) {
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
||||||
printf("alloc error: Fail");
|
printf("alloc error: Fail");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
buffs[i] = buf;
|
buffs[i] = buf;
|
||||||
}
|
}
|
||||||
@ -246,7 +247,7 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < TEST_SOURCES; i++) {
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
||||||
printf("alloc error: Fail");
|
printf("alloc error: Fail");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
temp_buffs[i] = buf;
|
temp_buffs[i] = buf;
|
||||||
}
|
}
|
||||||
@ -260,13 +261,15 @@ int main(int argc, char *argv[])
|
|||||||
if (encode_matrix == NULL || decode_matrix == NULL
|
if (encode_matrix == NULL || decode_matrix == NULL
|
||||||
|| invert_matrix == NULL || g_tbls == NULL) {
|
|| invert_matrix == NULL || g_tbls == NULL) {
|
||||||
printf("Test failure! Error with malloc\n");
|
printf("Test failure! Error with malloc\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pick a first test
|
// Pick a first test
|
||||||
m = 9;
|
m = 9;
|
||||||
k = 5;
|
k = 5;
|
||||||
if (m > MMAX || k > KMAX)
|
if (m > MMAX || k > KMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Make random data
|
// Make random data
|
||||||
for (i = 0; i < k; i++)
|
for (i = 0; i < k; i++)
|
||||||
@ -295,7 +298,7 @@ int main(int argc, char *argv[])
|
|||||||
nerrs, nsrcerrs, k, m);
|
nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -327,15 +330,18 @@ int main(int argc, char *argv[])
|
|||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
printf("orig :");
|
printf("orig :");
|
||||||
dump(buffs[src_err_list[i]], 25);
|
dump(buffs[src_err_list[i]], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a first test
|
// Pick a first test
|
||||||
m = 9;
|
m = 9;
|
||||||
k = 5;
|
k = 5;
|
||||||
if (m > MMAX || k > KMAX)
|
if (m > MMAX || k > KMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Make random data
|
// Make random data
|
||||||
for (i = 0; i < k; i++)
|
for (i = 0; i < k; i++)
|
||||||
@ -363,7 +369,7 @@ int main(int argc, char *argv[])
|
|||||||
nerrs, nsrcerrs, k, m);
|
nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -395,7 +401,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
printf("orig :");
|
printf("orig :");
|
||||||
dump(buffs[src_err_list[i]], 25);
|
dump(buffs[src_err_list[i]], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +440,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -468,7 +475,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(buffs[src_err_list[i]], 25);
|
dump(buffs[src_err_list[i]], 25);
|
||||||
printf("recov %d:", src_err_list[i]);
|
printf("recov %d:", src_err_list[i]);
|
||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
@ -479,13 +487,17 @@ int main(int argc, char *argv[])
|
|||||||
// Run tests at end of buffer for Electric Fence
|
// Run tests at end of buffer for Electric Fence
|
||||||
k = 16;
|
k = 16;
|
||||||
align = (LEN_ALIGN_CHK_B != 0) ? 1 : 16;
|
align = (LEN_ALIGN_CHK_B != 0) ? 1 : 16;
|
||||||
if (k > KMAX)
|
if (k > KMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
for (rows = 1; rows <= 16; rows++) {
|
for (rows = 1; rows <= 16; rows++) {
|
||||||
m = k + rows;
|
m = k + rows;
|
||||||
if (m > MMAX)
|
if (m > MMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Make random data
|
// Make random data
|
||||||
for (i = 0; i < k; i++)
|
for (i = 0; i < k; i++)
|
||||||
@ -518,7 +530,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -558,7 +570,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(temp_buffs[k + i], align);
|
dump(temp_buffs[k + i], align);
|
||||||
printf("orig :");
|
printf("orig :");
|
||||||
dump(efence_buffs[src_err_list[i]], align);
|
dump(efence_buffs[src_err_list[i]], align);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -610,7 +623,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -645,7 +658,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(ubuffs[src_err_list[i]], 25);
|
dump(ubuffs[src_err_list[i]], 25);
|
||||||
printf("recov %d:", src_err_list[i]);
|
printf("recov %d:", src_err_list[i]);
|
||||||
dump(temp_ubuffs[k + i], 25);
|
dump(temp_ubuffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,13 +672,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (memcmp(buffs[i], temp_buffs[0], offset)) {
|
if (memcmp(buffs[i], temp_buffs[0], offset)) {
|
||||||
printf("Fail rand ualign encode pad start\n");
|
printf("Fail rand ualign encode pad start\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
if (memcmp
|
if (memcmp
|
||||||
(buffs[i] + offset + size, temp_buffs[0],
|
(buffs[i] + offset + size, temp_buffs[0],
|
||||||
PTR_ALIGN_CHK_B - offset)) {
|
PTR_ALIGN_CHK_B - offset)) {
|
||||||
printf("Fail rand ualign encode pad end\n");
|
printf("Fail rand ualign encode pad end\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,13 +689,15 @@ int main(int argc, char *argv[])
|
|||||||
offset = temp_ubuffs[k + i] - temp_buffs[k + i];
|
offset = temp_ubuffs[k + i] - temp_buffs[k + i];
|
||||||
if (memcmp(temp_buffs[k + i], temp_buffs[0], offset)) {
|
if (memcmp(temp_buffs[k + i], temp_buffs[0], offset)) {
|
||||||
printf("Fail rand ualign decode pad start\n");
|
printf("Fail rand ualign decode pad start\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
if (memcmp
|
if (memcmp
|
||||||
(temp_buffs[k + i] + offset + size, temp_buffs[0],
|
(temp_buffs[k + i] + offset + size, temp_buffs[0],
|
||||||
PTR_ALIGN_CHK_B - offset)) {
|
PTR_ALIGN_CHK_B - offset)) {
|
||||||
printf("Fail rand ualign decode pad end\n");
|
printf("Fail rand ualign decode pad end\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,7 +741,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -758,11 +776,26 @@ int main(int argc, char *argv[])
|
|||||||
dump(buffs[src_err_list[i]], 25);
|
dump(buffs[src_err_list[i]], 25);
|
||||||
printf("recov %d:", src_err_list[i]);
|
printf("recov %d:", src_err_list[i]);
|
||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("done EC tests: Pass\n");
|
printf("done EC tests: Pass\n");
|
||||||
return 0;
|
re = 0;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
|
if (buffs[i])
|
||||||
|
aligned_free(buffs[i]);
|
||||||
|
if (temp_buffs[i])
|
||||||
|
aligned_free(temp_buffs[i]);
|
||||||
|
}
|
||||||
|
free(encode_matrix);
|
||||||
|
free(decode_matrix);
|
||||||
|
free(invert_matrix);
|
||||||
|
free(g_tbls);
|
||||||
|
|
||||||
|
return re;
|
||||||
}
|
}
|
||||||
|
@ -227,14 +227,15 @@ static int gf_gen_decode_matrix(unsigned char *encode_matrix,
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int re = 0;
|
int re = -1;
|
||||||
int i, j, p, rtest, m, k;
|
int i, j, p, rtest, m, k;
|
||||||
int nerrs, nsrcerrs;
|
int nerrs, nsrcerrs;
|
||||||
void *buf;
|
void *buf;
|
||||||
unsigned int decode_index[MMAX];
|
unsigned int decode_index[MMAX];
|
||||||
unsigned char *temp_buffs[TEST_SOURCES], *buffs[TEST_SOURCES];
|
unsigned char *temp_buffs[TEST_SOURCES] = { NULL }, *buffs[TEST_SOURCES] = { NULL };
|
||||||
unsigned char *update_buffs[TEST_SOURCES];
|
unsigned char *update_buffs[TEST_SOURCES] = { NULL };
|
||||||
unsigned char *encode_matrix, *decode_matrix, *invert_matrix, *g_tbls;
|
unsigned char *encode_matrix = NULL, *decode_matrix = NULL, *invert_matrix =
|
||||||
|
NULL, *g_tbls = NULL;
|
||||||
unsigned char src_in_err[TEST_SOURCES], src_err_list[TEST_SOURCES];
|
unsigned char src_in_err[TEST_SOURCES], src_err_list[TEST_SOURCES];
|
||||||
unsigned char *recov[TEST_SOURCES];
|
unsigned char *recov[TEST_SOURCES];
|
||||||
|
|
||||||
@ -253,7 +254,7 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < TEST_SOURCES; i++) {
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
||||||
printf("alloc error: Fail");
|
printf("alloc error: Fail");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
buffs[i] = buf;
|
buffs[i] = buf;
|
||||||
}
|
}
|
||||||
@ -261,7 +262,7 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < TEST_SOURCES; i++) {
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
||||||
printf("alloc error: Fail");
|
printf("alloc error: Fail");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
temp_buffs[i] = buf;
|
temp_buffs[i] = buf;
|
||||||
memset(temp_buffs[i], 0, TEST_LEN); // initialize the destination buffer to be zero for update function
|
memset(temp_buffs[i], 0, TEST_LEN); // initialize the destination buffer to be zero for update function
|
||||||
@ -270,7 +271,7 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < TEST_SOURCES; i++) {
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
if (posix_memalign(&buf, 64, TEST_LEN)) {
|
||||||
printf("alloc error: Fail");
|
printf("alloc error: Fail");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
update_buffs[i] = buf;
|
update_buffs[i] = buf;
|
||||||
memset(update_buffs[i], 0, TEST_LEN); // initialize the destination buffer to be zero for update function
|
memset(update_buffs[i], 0, TEST_LEN); // initialize the destination buffer to be zero for update function
|
||||||
@ -284,13 +285,13 @@ int main(int argc, char *argv[])
|
|||||||
if (encode_matrix == NULL || decode_matrix == NULL
|
if (encode_matrix == NULL || decode_matrix == NULL
|
||||||
|| invert_matrix == NULL || g_tbls == NULL) {
|
|| invert_matrix == NULL || g_tbls == NULL) {
|
||||||
printf("Test failure! Error with malloc\n");
|
printf("Test failure! Error with malloc\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pick a first test
|
// Pick a first test
|
||||||
m = 14;
|
m = 14;
|
||||||
k = 10;
|
k = 10;
|
||||||
if (m > MMAX || k > KMAX)
|
if (m > MMAX || k > KMAX)
|
||||||
return -1;
|
goto exit;
|
||||||
|
|
||||||
// Make random data
|
// Make random data
|
||||||
for (i = 0; i < k; i++) {
|
for (i = 0; i < k; i++) {
|
||||||
@ -321,7 +322,7 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_buffs[k + i], 25);
|
dump(update_buffs[k + i], 25);
|
||||||
printf("buffs%d :", i);
|
printf("buffs%d :", i);
|
||||||
dump(buffs[k + i], 25);
|
dump(buffs[k + i], 25);
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +336,7 @@ int main(int argc, char *argv[])
|
|||||||
nerrs, nsrcerrs, k, m);
|
nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -367,7 +368,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
printf("orig :");
|
printf("orig :");
|
||||||
dump(update_buffs[src_err_list[i]], 25);
|
dump(update_buffs[src_err_list[i]], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
@ -377,8 +379,10 @@ int main(int argc, char *argv[])
|
|||||||
// Pick a first test
|
// Pick a first test
|
||||||
m = 7;
|
m = 7;
|
||||||
k = 5;
|
k = 5;
|
||||||
if (m > MMAX || k > KMAX)
|
if (m > MMAX || k > KMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Zero the destination buffer for update function
|
// Zero the destination buffer for update function
|
||||||
for (i = k; i < TEST_SOURCES; i++) {
|
for (i = k; i < TEST_SOURCES; i++) {
|
||||||
@ -413,7 +417,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_buffs[k + i], 25);
|
dump(update_buffs[k + i], 25);
|
||||||
printf("buffs%d :", i);
|
printf("buffs%d :", i);
|
||||||
dump(buffs[k + i], 25);
|
dump(buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,7 +432,7 @@ int main(int argc, char *argv[])
|
|||||||
nerrs, nsrcerrs, k, m);
|
nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -464,7 +469,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
printf("orig :");
|
printf("orig :");
|
||||||
dump(update_buffs[src_err_list[i]], 25);
|
dump(update_buffs[src_err_list[i]], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
@ -512,7 +518,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_buffs[k + i], 25);
|
dump(update_buffs[k + i], 25);
|
||||||
printf("buffs%d :", i);
|
printf("buffs%d :", i);
|
||||||
dump(buffs[k + i], 25);
|
dump(buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +533,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -569,7 +576,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_buffs[src_err_list[i]], 25);
|
dump(update_buffs[src_err_list[i]], 25);
|
||||||
printf("recov %d:", src_err_list[i]);
|
printf("recov %d:", src_err_list[i]);
|
||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
@ -580,13 +588,17 @@ int main(int argc, char *argv[])
|
|||||||
// Run tests at end of buffer for Electric Fence
|
// Run tests at end of buffer for Electric Fence
|
||||||
k = 16;
|
k = 16;
|
||||||
align = (LEN_ALIGN_CHK_B != 0) ? 1 : ALIGN_SIZE;
|
align = (LEN_ALIGN_CHK_B != 0) ? 1 : ALIGN_SIZE;
|
||||||
if (k > KMAX)
|
if (k > KMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
for (rows = 1; rows <= 16; rows++) {
|
for (rows = 1; rows <= 16; rows++) {
|
||||||
m = k + rows;
|
m = k + rows;
|
||||||
if (m > MMAX)
|
if (m > MMAX) {
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = k; i < TEST_SOURCES; i++) {
|
for (i = k; i < TEST_SOURCES; i++) {
|
||||||
memset(buffs[i], 0, TEST_LEN);
|
memset(buffs[i], 0, TEST_LEN);
|
||||||
@ -634,7 +646,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(efence_update_buffs[k + i], 25);
|
dump(efence_update_buffs[k + i], 25);
|
||||||
printf("efence_buffs%d :", i);
|
printf("efence_buffs%d :", i);
|
||||||
dump(efence_buffs[k + i], 25);
|
dump(efence_buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,7 +661,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -694,7 +707,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(temp_buffs[k + i], align);
|
dump(temp_buffs[k + i], align);
|
||||||
printf("orig :");
|
printf("orig :");
|
||||||
dump(efence_update_buffs[src_err_list[i]], align);
|
dump(efence_update_buffs[src_err_list[i]], align);
|
||||||
return -1;
|
re = 1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -760,7 +774,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_ubuffs[k + i], 25);
|
dump(update_ubuffs[k + i], 25);
|
||||||
printf("ubuffs%d :", i);
|
printf("ubuffs%d :", i);
|
||||||
dump(ubuffs[k + i], 25);
|
dump(ubuffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -774,7 +789,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -816,7 +831,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_ubuffs[src_err_list[i]], 25);
|
dump(update_ubuffs[src_err_list[i]], 25);
|
||||||
printf("recov %d:", src_err_list[i]);
|
printf("recov %d:", src_err_list[i]);
|
||||||
dump(temp_ubuffs[k + i], 25);
|
dump(temp_ubuffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,13 +845,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (memcmp(update_buffs[i], temp_buffs[0], offset)) {
|
if (memcmp(update_buffs[i], temp_buffs[0], offset)) {
|
||||||
printf("Fail rand ualign encode pad start\n");
|
printf("Fail rand ualign encode pad start\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
if (memcmp
|
if (memcmp
|
||||||
(update_buffs[i] + offset + size, temp_buffs[0],
|
(update_buffs[i] + offset + size, temp_buffs[0],
|
||||||
PTR_ALIGN_CHK_B - offset)) {
|
PTR_ALIGN_CHK_B - offset)) {
|
||||||
printf("Fail rand ualign encode pad end\n");
|
printf("Fail rand ualign encode pad end\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,13 +862,15 @@ int main(int argc, char *argv[])
|
|||||||
offset = temp_ubuffs[k + i] - temp_buffs[k + i];
|
offset = temp_ubuffs[k + i] - temp_buffs[k + i];
|
||||||
if (memcmp(temp_buffs[k + i], temp_buffs[0], offset)) {
|
if (memcmp(temp_buffs[k + i], temp_buffs[0], offset)) {
|
||||||
printf("Fail rand ualign decode pad start\n");
|
printf("Fail rand ualign decode pad start\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
if (memcmp
|
if (memcmp
|
||||||
(temp_buffs[k + i] + offset + size, temp_buffs[0],
|
(temp_buffs[k + i] + offset + size, temp_buffs[0],
|
||||||
PTR_ALIGN_CHK_B - offset)) {
|
PTR_ALIGN_CHK_B - offset)) {
|
||||||
printf("Fail rand ualign decode pad end\n");
|
printf("Fail rand ualign decode pad end\n");
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,7 +923,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_buffs[k + i], 25);
|
dump(update_buffs[k + i], 25);
|
||||||
printf("buffs%d (size=%d) :", i, size);
|
printf("buffs%d (size=%d) :", i, size);
|
||||||
dump(buffs[k + i], 25);
|
dump(buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +937,7 @@ int main(int argc, char *argv[])
|
|||||||
src_in_err, nerrs, nsrcerrs, k, m);
|
src_in_err, nerrs, nsrcerrs, k, m);
|
||||||
if (re != 0) {
|
if (re != 0) {
|
||||||
printf("Fail to gf_gen_decode_matrix\n");
|
printf("Fail to gf_gen_decode_matrix\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Pack recovery array as list of valid sources
|
// Pack recovery array as list of valid sources
|
||||||
// Its order must be the same as the order
|
// Its order must be the same as the order
|
||||||
@ -958,7 +979,8 @@ int main(int argc, char *argv[])
|
|||||||
dump(update_buffs[src_err_list[i]], 25);
|
dump(update_buffs[src_err_list[i]], 25);
|
||||||
printf("recov %d:", src_err_list[i]);
|
printf("recov %d:", src_err_list[i]);
|
||||||
dump(temp_buffs[k + i], 25);
|
dump(temp_buffs[k + i], 25);
|
||||||
return -1;
|
re = -1;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
@ -967,5 +989,20 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("done EC tests: Pass\n");
|
printf("done EC tests: Pass\n");
|
||||||
|
re = 0;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
for (i = 0; i < TEST_SOURCES; i++) {
|
||||||
|
if (buffs[i])
|
||||||
|
aligned_free(buffs[i]);
|
||||||
|
if (temp_buffs[i])
|
||||||
|
aligned_free(temp_buffs[i]);
|
||||||
|
if (update_buffs[i])
|
||||||
|
aligned_free(update_buffs[i]);
|
||||||
|
}
|
||||||
|
free(encode_matrix);
|
||||||
|
free(decode_matrix);
|
||||||
|
free(invert_matrix);
|
||||||
|
free(g_tbls);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,8 @@ int inv_test(u8 * in, u8 * inv, u8 * sav, int n)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, k, t;
|
int i, k, t;
|
||||||
u8 *test_mat, *save_mat, *invr_mat;
|
u8 *test_mat = NULL, *save_mat = NULL, *invr_mat = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
u8 test1[] = { 1, 1, 6,
|
u8 test1[] = { 1, 1, 6,
|
||||||
1, 1, 1,
|
1, 1, 1,
|
||||||
@ -151,25 +152,25 @@ int main(int argc, char *argv[])
|
|||||||
invr_mat = malloc(KMAX * KMAX);
|
invr_mat = malloc(KMAX * KMAX);
|
||||||
|
|
||||||
if (NULL == test_mat || NULL == save_mat || NULL == invr_mat)
|
if (NULL == test_mat || NULL == save_mat || NULL == invr_mat)
|
||||||
return -1;
|
goto exit;
|
||||||
|
|
||||||
// Test with lots of leading 1's
|
// Test with lots of leading 1's
|
||||||
k = 3;
|
k = 3;
|
||||||
memcpy(test_mat, test1, k * k);
|
memcpy(test_mat, test1, k * k);
|
||||||
if (inv_test(test_mat, invr_mat, save_mat, k))
|
if (inv_test(test_mat, invr_mat, save_mat, k))
|
||||||
return -1;
|
goto exit;
|
||||||
|
|
||||||
// Test with leading zeros
|
// Test with leading zeros
|
||||||
k = 3;
|
k = 3;
|
||||||
memcpy(test_mat, test2, k * k);
|
memcpy(test_mat, test2, k * k);
|
||||||
if (inv_test(test_mat, invr_mat, save_mat, k))
|
if (inv_test(test_mat, invr_mat, save_mat, k))
|
||||||
return -1;
|
goto exit;
|
||||||
|
|
||||||
// Test 3
|
// Test 3
|
||||||
k = 3;
|
k = 3;
|
||||||
memcpy(test_mat, test3, k * k);
|
memcpy(test_mat, test3, k * k);
|
||||||
if (inv_test(test_mat, invr_mat, save_mat, k))
|
if (inv_test(test_mat, invr_mat, save_mat, k))
|
||||||
return -1;
|
goto exit;
|
||||||
|
|
||||||
// Test 4 - try a singular matrix
|
// Test 4 - try a singular matrix
|
||||||
k = 4;
|
k = 4;
|
||||||
@ -177,7 +178,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!gf_invert_matrix(test_mat, invr_mat, k)) {
|
if (!gf_invert_matrix(test_mat, invr_mat, k)) {
|
||||||
printf("Fail: didn't catch singular matrix\n");
|
printf("Fail: didn't catch singular matrix\n");
|
||||||
print_matrix(test4, 4);
|
print_matrix(test4, 4);
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Do random test of size KMAX
|
// Do random test of size KMAX
|
||||||
k = KMAX;
|
k = KMAX;
|
||||||
@ -187,7 +188,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (gf_invert_matrix(test_mat, invr_mat, k)) {
|
if (gf_invert_matrix(test_mat, invr_mat, k)) {
|
||||||
printf("rand picked a singular matrix, try again\n");
|
printf("rand picked a singular matrix, try again\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_mult(invr_mat, save_mat, test_mat, k);
|
matrix_mult(invr_mat, save_mat, test_mat, k);
|
||||||
@ -197,7 +198,7 @@ int main(int argc, char *argv[])
|
|||||||
print_matrix(save_mat, k);
|
print_matrix(save_mat, k);
|
||||||
print_matrix(invr_mat, k);
|
print_matrix(invr_mat, k);
|
||||||
print_matrix(test_mat, k);
|
print_matrix(test_mat, k);
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Do Randoms. Random size and coefficients
|
// Do Randoms. Random size and coefficients
|
||||||
for (t = 0; t < RANDOMS; t++) {
|
for (t = 0; t < RANDOMS; t++) {
|
||||||
@ -216,7 +217,7 @@ int main(int argc, char *argv[])
|
|||||||
print_matrix(save_mat, k);
|
print_matrix(save_mat, k);
|
||||||
print_matrix(invr_mat, k);
|
print_matrix(invr_mat, k);
|
||||||
print_matrix(test_mat, k);
|
print_matrix(test_mat, k);
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
if (0 == (t % 8))
|
if (0 == (t % 8))
|
||||||
@ -225,5 +226,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(" Pass\n");
|
printf(" Pass\n");
|
||||||
return 0;
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
free(test_mat);
|
||||||
|
free(save_mat);
|
||||||
|
free(invr_mat);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ typedef unsigned char u8;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i, ret = -1;
|
||||||
u8 *buff1, *buff2, *buff3, gf_const_tbl[64], a = 2;
|
u8 *buff1 = NULL, *buff2 = NULL, *buff3 = NULL, gf_const_tbl[64], a = 2;
|
||||||
int tsize;
|
int tsize;
|
||||||
int align, size;
|
int align, size;
|
||||||
unsigned char *efence_buff1;
|
unsigned char *efence_buff1;
|
||||||
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (NULL == buff1 || NULL == buff2 || NULL == buff3) {
|
if (NULL == buff1 || NULL == buff2 || NULL == buff3) {
|
||||||
printf("buffer alloc error\n");
|
printf("buffer alloc error\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Fill with rand data
|
// Fill with rand data
|
||||||
for (i = 0; i < TEST_SIZE; i++)
|
for (i = 0; i < TEST_SIZE; i++)
|
||||||
@ -63,27 +63,27 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (gf_vect_mul(TEST_SIZE, gf_const_tbl, buff1, buff2) != 0) {
|
if (gf_vect_mul(TEST_SIZE, gf_const_tbl, buff1, buff2) != 0) {
|
||||||
printf("fail creating buff2\n");
|
printf("fail creating buff2\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < TEST_SIZE; i++) {
|
for (i = 0; i < TEST_SIZE; i++) {
|
||||||
if (gf_mul(a, buff1[i]) != buff2[i]) {
|
if (gf_mul(a, buff1[i]) != buff2[i]) {
|
||||||
printf("fail at %d, 0x%x x 2 = 0x%x (0x%x)\n", i,
|
printf("fail at %d, 0x%x x 2 = 0x%x (0x%x)\n", i,
|
||||||
buff1[i], buff2[i], gf_mul(2, buff1[i]));
|
buff1[i], buff2[i], gf_mul(2, buff1[i]));
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gf_vect_mul_base(TEST_SIZE, gf_const_tbl, buff1, buff3) != 0) {
|
if (gf_vect_mul_base(TEST_SIZE, gf_const_tbl, buff1, buff3) != 0) {
|
||||||
printf("fail fill with rand data\n");
|
printf("fail fill with rand data\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Check reference function
|
// Check reference function
|
||||||
for (i = 0; i < TEST_SIZE; i++) {
|
for (i = 0; i < TEST_SIZE; i++) {
|
||||||
if (buff2[i] != buff3[i]) {
|
if (buff2[i] != buff3[i]) {
|
||||||
printf("fail at %d, 0x%x x 0x%d = 0x%x (0x%x)\n",
|
printf("fail at %d, 0x%x x 0x%d = 0x%x (0x%x)\n",
|
||||||
i, a, buff1[i], buff2[i], gf_mul(a, buff1[i]));
|
i, a, buff1[i], buff2[i], gf_mul(a, buff1[i]));
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,14 +95,14 @@ int main(int argc, char *argv[])
|
|||||||
gf_vect_mul_init(a, gf_const_tbl);
|
gf_vect_mul_init(a, gf_const_tbl);
|
||||||
if (gf_vect_mul(TEST_SIZE, gf_const_tbl, buff1, buff2) != 0) {
|
if (gf_vect_mul(TEST_SIZE, gf_const_tbl, buff1, buff2) != 0) {
|
||||||
printf("fail creating buff2\n");
|
printf("fail creating buff2\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < TEST_SIZE; i++)
|
for (i = 0; i < TEST_SIZE; i++)
|
||||||
if (gf_mul(a, buff1[i]) != buff2[i]) {
|
if (gf_mul(a, buff1[i]) != buff2[i]) {
|
||||||
printf("fail at %d, 0x%x x %d = 0x%x (0x%x)\n",
|
printf("fail at %d, 0x%x x %d = 0x%x (0x%x)\n",
|
||||||
i, a, buff1[i], buff2[i], gf_mul(2, buff1[i]));
|
i, a, buff1[i], buff2[i], gf_mul(2, buff1[i]));
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
putchar('.');
|
putchar('.');
|
||||||
@ -115,14 +115,14 @@ int main(int argc, char *argv[])
|
|||||||
gf_vect_mul_init(a, gf_const_tbl);
|
gf_vect_mul_init(a, gf_const_tbl);
|
||||||
if (gf_vect_mul(tsize, gf_const_tbl, buff1, buff2) != 0) {
|
if (gf_vect_mul(tsize, gf_const_tbl, buff1, buff2) != 0) {
|
||||||
printf("fail creating buff2 (len %d)\n", tsize);
|
printf("fail creating buff2 (len %d)\n", tsize);
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < tsize; i++)
|
for (i = 0; i < tsize; i++)
|
||||||
if (gf_mul(a, buff1[i]) != buff2[i]) {
|
if (gf_mul(a, buff1[i]) != buff2[i]) {
|
||||||
printf("fail at %d, 0x%x x %d = 0x%x (0x%x)\n",
|
printf("fail at %d, 0x%x x %d = 0x%x (0x%x)\n",
|
||||||
i, a, buff1[i], buff2[i], gf_mul(2, buff1[i]));
|
i, a, buff1[i], buff2[i], gf_mul(2, buff1[i]));
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
if (0 == tsize % (32 * 8)) {
|
if (0 == tsize % (32 * 8)) {
|
||||||
@ -150,13 +150,13 @@ int main(int argc, char *argv[])
|
|||||||
printf("fail at %d, 0x%x x 2 = 0x%x (0x%x)\n",
|
printf("fail at %d, 0x%x x 2 = 0x%x (0x%x)\n",
|
||||||
i, efence_buff1[i], efence_buff2[i],
|
i, efence_buff1[i], efence_buff2[i],
|
||||||
gf_mul(2, efence_buff1[i]));
|
gf_mul(2, efence_buff1[i]));
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gf_vect_mul_base
|
if (gf_vect_mul_base
|
||||||
(TEST_SIZE - size, gf_const_tbl, efence_buff1, efence_buff3) != 0) {
|
(TEST_SIZE - size, gf_const_tbl, efence_buff1, efence_buff3) != 0) {
|
||||||
printf("fail line up TEST_SIZE from end\n");
|
printf("fail line up TEST_SIZE from end\n");
|
||||||
return -1;
|
goto exit;
|
||||||
}
|
}
|
||||||
// Check reference function
|
// Check reference function
|
||||||
for (i = 0; i < TEST_SIZE - size; i++)
|
for (i = 0; i < TEST_SIZE - size; i++)
|
||||||
@ -164,7 +164,7 @@ int main(int argc, char *argv[])
|
|||||||
printf("fail at %d, 0x%x x 0x%d = 0x%x (0x%x)\n",
|
printf("fail at %d, 0x%x x 0x%d = 0x%x (0x%x)\n",
|
||||||
i, a, efence_buff2[i], efence_buff3[i],
|
i, a, efence_buff2[i], efence_buff3[i],
|
||||||
gf_mul(2, efence_buff1[i]));
|
gf_mul(2, efence_buff1[i]));
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
#ifdef TEST_VERBOSE
|
#ifdef TEST_VERBOSE
|
||||||
putchar('.');
|
putchar('.');
|
||||||
@ -177,11 +177,19 @@ int main(int argc, char *argv[])
|
|||||||
printf
|
printf
|
||||||
("fail expecting nonzero return code for unaligned size param (%d)\n",
|
("fail expecting nonzero return code for unaligned size param (%d)\n",
|
||||||
size);
|
size);
|
||||||
return 1;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" done: Pass\n");
|
printf(" done: Pass\n");
|
||||||
fflush(0);
|
fflush(0);
|
||||||
return 0;
|
|
||||||
|
ret = 0;
|
||||||
|
exit:
|
||||||
|
|
||||||
|
free(buff1);
|
||||||
|
free(buff2);
|
||||||
|
free(buff3);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user