From 8a9bbec87523b98af1da3ed43ed03436b0ef04b1 Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Tue, 8 Mar 2022 17:22:25 -0900 Subject: tests: replacing our_error() with trutils_error() --- tests/common.c | 27 ----------- tests/common.h | 8 ---- tests/dict-data.c | 10 ++-- tests/test-array-queue.c | 14 +++--- tests/test-array-sorted.c | 60 ++++++++++++------------ tests/test-array-stack.c | 14 +++--- tests/test-dict-attrs.c | 12 ++--- tests/test-dict-values.c | 22 ++++----- tests/test-dict-vendors.c | 8 ++-- tests/test-oid-str.c | 18 ++++---- tests/test-options.c | 108 +++++++++++++++++++++---------------------- tests/test-pckt-byte-order.c | 6 +-- 12 files changed, 136 insertions(+), 171 deletions(-) (limited to 'tests') diff --git a/tests/common.c b/tests/common.c index b028a48..ba1b046 100644 --- a/tests/common.c +++ b/tests/common.c @@ -486,33 +486,6 @@ int our_urldesc_test_good(const char * url, unsigned opts) } -//---------------// -// log functions // -//---------------// -#pragma mark log functions - -int our_error(unsigned opts, char ** errs, const char * fmt, ...) -{ - int pos; - va_list args; - - if ( ((opts & TRUTILS_OPT_QUIET)) && ((opts & TRUTILS_OPT_VERBOSE)) ) - return(1); - - if ((errs)) - for(pos = 0; ((errs[pos])); pos++) - fprintf(stderr, "%s: %s\n", program_name, errs[pos]); - - fprintf(stderr, "%s: ", program_name); - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); - - return(1); -} - - //----------------// // misc functions // //----------------// diff --git a/tests/common.h b/tests/common.h index b792059..de71cf9 100644 --- a/tests/common.h +++ b/tests/common.h @@ -94,14 +94,6 @@ int our_urldesc_test_bad(const char * url, unsigned opts); int our_urldesc_test_good(const char * url, unsigned opts); -//---------------// -// log functions // -//---------------// -#pragma mark log functions - -int our_error(unsigned opts, char ** errs, const char * fmt, ...); - - //----------------// // misc functions // //----------------// diff --git a/tests/dict-data.c b/tests/dict-data.c index f42bdca..e3124c1 100644 --- a/tests/dict-data.c +++ b/tests/dict-data.c @@ -319,7 +319,7 @@ our_dict_initialize( // initialize dictionary if (tinyrad_dict_initialize(dictp, 0) != TRAD_SUCCESS) { - our_error(opts, NULL, "out of virtual memory"); + trutils_error(opts, NULL, "out of virtual memory"); return(1); }; @@ -329,7 +329,7 @@ our_dict_initialize( trutils_verbose(opts, "loading default dictionary ..."); if ((rc = tinyrad_dict_defaults(*dictp, &errs, 0)) != TRAD_SUCCESS) { - our_error(opts, errs, "tinyrad_dict_defaults(): %s", tinyrad_strerror(rc)); + trutils_error(opts, errs, "tinyrad_dict_defaults(): %s", tinyrad_strerror(rc)); tinyrad_strsfree(errs); tinyrad_free(*dictp); return(1); @@ -340,7 +340,7 @@ our_dict_initialize( trutils_verbose(opts, "adding test dictionary vendors ..."); if ((rc = tinyrad_dict_import(*dictp, test_dict_data_vendors, NULL, NULL, &errs, 0)) != TRAD_SUCCESS) { - our_error(opts, errs, "tinyrad_dict_import(vendors): %s", tinyrad_strerror(rc)); + trutils_error(opts, errs, "tinyrad_dict_import(vendors): %s", tinyrad_strerror(rc)); tinyrad_strsfree(errs); tinyrad_free(*dictp); return(1); @@ -350,7 +350,7 @@ our_dict_initialize( trutils_verbose(opts, "adding test dictionary attributes ..."); if ((rc = tinyrad_dict_import(*dictp, NULL, test_dict_data_attrs, NULL, &errs, 0)) != TRAD_SUCCESS) { - our_error(opts, errs, "tinyrad_dict_import(attributes): %s", tinyrad_strerror(rc)); + trutils_error(opts, errs, "tinyrad_dict_import(attributes): %s", tinyrad_strerror(rc)); tinyrad_strsfree(errs); tinyrad_free(*dictp); return(1); @@ -360,7 +360,7 @@ our_dict_initialize( trutils_verbose(opts, "adding test dictionary values ..."); if ((rc = tinyrad_dict_import(*dictp, NULL, NULL, test_dict_data_values, &errs, 0)) != TRAD_SUCCESS) { - our_error(opts, errs, "tinyrad_dict_import(values): %s", tinyrad_strerror(rc)); + trutils_error(opts, errs, "tinyrad_dict_import(values): %s", tinyrad_strerror(rc)); tinyrad_strsfree(errs); tinyrad_free(*dictp); return(1); diff --git a/tests/test-array-queue.c b/tests/test-array-queue.c index e5b979f..25575ea 100644 --- a/tests/test-array-queue.c +++ b/tests/test-array-queue.c @@ -222,7 +222,7 @@ int main( int argc, char * argv[] ) { for(; (pos > 0); pos--) free(data[pos-1].name); - return(our_error(opts, NULL, "out of virtual memory")); + return(trutils_error(opts, NULL, "out of virtual memory")); }; }; @@ -242,26 +242,26 @@ int main( int argc, char * argv[] ) if ((x % 4) == 3) { if ((objp = tinyrad_array_dequeue(list, &list_len, sizeof(MyData *))) == NULL) - return(our_error(opts, NULL, "unable to dequeue from queue")); + return(trutils_error(opts, NULL, "unable to dequeue from queue")); if ((strcasecmp(src[x/4]->name, (*objp)->name))) - return(our_error(opts, NULL, "str of dequeued object is incorrect")); + return(trutils_error(opts, NULL, "str of dequeued object is incorrect")); }; // adds objects to queue if (tinyrad_array_enqueue((void **)&list, &list_len, sizeof(MyData *), &src[x], &realloc) == -1) - return(our_error(opts, NULL, "failed to enqueue object to queue")); + return(trutils_error(opts, NULL, "failed to enqueue object to queue")); }; // loop through queue and verify data trutils_verbose(opts, "verifing queue ..."); if (list_len != ((MY_LIST_LEN / 4) * 3)) - return(our_error(opts, NULL, "queue length is incorrect")); + return(trutils_error(opts, NULL, "queue length is incorrect")); delta = MY_LIST_LEN - list_len; for(x = delta; (x < MY_LIST_LEN); x++) { if ((strcmp(src[x]->name, list[list_len-x+delta-1]->name))) - return(our_error(opts, NULL, "queue data does not match test data")); + return(trutils_error(opts, NULL, "queue data does not match test data")); }; @@ -269,7 +269,7 @@ int main( int argc, char * argv[] ) trutils_verbose(opts, "dequeueing from queue ..."); while (list_len > 0) if (tinyrad_array_dequeue(list, &list_len, sizeof(MyData *)) == NULL) - return(our_error(opts, NULL, "unable to dequeue from queue")); + return(trutils_error(opts, NULL, "unable to dequeue from queue")); return(0); } diff --git a/tests/test-array-sorted.c b/tests/test-array-sorted.c index 8901c8b..4b51eaa 100644 --- a/tests/test-array-sorted.c +++ b/tests/test-array-sorted.c @@ -292,7 +292,7 @@ int main( int argc, char * argv[] ) { for(; (pos > 0); pos--) free(data[pos-1].name); - return(our_error(opts, NULL, "out of virtual memory")); + return(trutils_error(opts, NULL, "out of virtual memory")); }; }; @@ -335,7 +335,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -350,7 +350,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -373,7 +373,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -396,7 +396,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -419,7 +419,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -447,7 +447,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -470,7 +470,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); @@ -493,7 +493,7 @@ int main( int argc, char * argv[] ) if ((my_test_remove(opts, list, &list_len, src, test, MY_LIST_LEN, merge))) return(1); if ((list_len)) - return(our_error(opts, NULL, "list still has elements")); + return(trutils_error(opts, NULL, "list still has elements")); free(list); return(0); @@ -616,7 +616,7 @@ my_test_insert( case TINYRAD_ARRAY_REPLACE: action_name = "REPLACE"; break; case 0: action_name = "DEFAULT"; break; default: - return(our_error(opts, NULL, "unknown insert action")); + return(trutils_error(opts, NULL, "unknown insert action")); }; switch(mergeopt) { @@ -625,19 +625,19 @@ my_test_insert( case TINYRAD_ARRAY_ANYDUP: merge_type = "ANY"; break; case 0: merge_type = "DEFAULT"; break; default: - return(our_error(opts, NULL, "unknown dup action")); + return(trutils_error(opts, NULL, "unknown dup action")); }; trutils_verbose(opts, "testing tinyrad_array_add( %7s, %9s, %s ) [%s] ...", action_name, merge_type, compar_name, (((iteration)) ? "duplicate" : "unique")); for(x = 0; (x < dat_len); x++) { if (tinyrad_array_add((void **)listp, list_lenp, sizeof(MyData *), &src[x], arrayopt, compar, NULL, &realloc) == -1) - return(our_error(opts, NULL, "tinyrad_array_add(%s): returned error", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_add(%s): returned error", action_name)); len = (iteration*dat_len) + x + 1; if ( ((iteration)) && (!(arrayopt & TINYRAD_ARRAY_MERGE)) ) len = dat_len; if (*list_lenp != len) - return(our_error(opts, NULL, "tinyrad_array_add(%s): did not increment length", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_add(%s): did not increment length", action_name)); }; list = *listp; @@ -651,19 +651,19 @@ my_test_insert( { pos = x/iteration; if ((strcasecmp(test[pos]->name, list[x]->name))) - return(our_error(opts, NULL, "tinyrad_array_add(%s): misordered the list", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_add(%s): misordered the list", action_name)); switch(mergeopt) { case TINYRAD_ARRAY_LASTDUP: if ( (x < ((dat_len*iteration)-1)) && ((x % iteration) == (iteration-1)) ) if (!(strcasecmp(list[x]->name, list[x+1]->name))) - return(our_error(opts, NULL, "tinyrad_array_add(%s): first match not returned", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_add(%s): first match not returned", action_name)); break; case TINYRAD_ARRAY_FIRSTDUP: if ( (x > 0) && (!(x % iteration)) ) if (!(strcasecmp(list[x]->name, list[x-1]->name))) - return(our_error(opts, NULL, "tinyrad_array_add(%s): first match not returned", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_add(%s): first match not returned", action_name)); break; case TINYRAD_ARRAY_ANYDUP: @@ -712,7 +712,7 @@ my_test_remove( case TINYRAD_ARRAY_REPLACE: action_name = "REPLACE"; break; case 0: action_name = "DEFAULT"; break; default: - return(our_error(opts, NULL, "unknown insert action")); + return(trutils_error(opts, NULL, "unknown insert action")); }; switch(mergeopt) { @@ -721,19 +721,19 @@ my_test_remove( case TINYRAD_ARRAY_ANYDUP: merge_type = "ANY"; break; case 0: merge_type = "DEFAULT"; break; default: - return(our_error(opts, NULL, "unknown dup action")); + return(trutils_error(opts, NULL, "unknown dup action")); }; trutils_verbose(opts, "testing tinyrad_array_remove( %7s, %9s, %s ) [%s] ...", action_name, merge_type, compar_name, (((iteration)) ? "duplicate" : "unique")); for(x = 0; (x < dat_len); x++) { if (tinyrad_array_remove(list, list_lenp, sizeof(MyData *), &src[x], arrayopt, compar, NULL) == -1) - return(our_error(opts, NULL, "tinyrad_array_remove(%s): returned error", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_remove(%s): returned error", action_name)); len = ((iteration+1)*dat_len) - x - 1; if ( ((iteration)) && (!(arrayopt & TINYRAD_ARRAY_MERGE)) ) len = dat_len; if (*list_lenp != len) - return(our_error(opts, NULL, "tinyrad_array_remove(%s): did not decrement length", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_remove(%s): did not decrement length", action_name)); }; if (!(arrayopt & TINYRAD_ARRAY_MERGE)) @@ -744,19 +744,19 @@ my_test_remove( { pos = x/iteration; if ((strcasecmp(test[pos]->name, list[x]->name))) - return(our_error(opts, NULL, "tinyrad_array_remove(%s): misordered the list", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_remove(%s): misordered the list", action_name)); switch(mergeopt) { case TINYRAD_ARRAY_LASTDUP: if ( (x < ((dat_len*iteration)-1)) && ((x % iteration) == (iteration-1)) ) if (!(strcasecmp(list[x]->name, list[x+1]->name))) - return(our_error(opts, NULL, "tinyrad_array_remove(%s): first match not returned", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_remove(%s): first match not returned", action_name)); break; case TINYRAD_ARRAY_FIRSTDUP: if ( (x > 0) && (!(x % iteration)) ) if (!(strcasecmp(list[x]->name, list[x-1]->name))) - return(our_error(opts, NULL, "tinyrad_array_remove(%s): first match not returned", action_name)); + return(trutils_error(opts, NULL, "tinyrad_array_remove(%s): first match not returned", action_name)); break; case TINYRAD_ARRAY_ANYDUP: @@ -799,12 +799,12 @@ my_test_search( case MY_KEY_NAME: ptr = list[y]->name; break; case MY_KEY_VALUE: ptr = &list[y]->value; break; default: - return(our_error(opts, NULL, "unknown key")); + return(trutils_error(opts, NULL, "unknown key")); }; if ((idx = tinyrad_array_search(list, x, sizeof(MyData *), ptr, TINYRAD_ARRAY_FIRSTDUP, NULL, compar)) == -1) - return(our_error(opts, NULL, "tinyrad_array_search(); size: %zu; func: %s; idx: %zu; search error", x, compar_name, y)); + return(trutils_error(opts, NULL, "tinyrad_array_search(); size: %zu; func: %s; idx: %zu; search error", x, compar_name, y)); if ((size_t)idx != y) - return(our_error(opts, NULL, "tinyrad_array_search(); size: %zu; func: %s; idx: %zu; index mismatch", x, compar_name, y)); + return(trutils_error(opts, NULL, "tinyrad_array_search(); size: %zu; func: %s; idx: %zu; index mismatch", x, compar_name, y)); }; }; @@ -820,14 +820,14 @@ my_test_search( case MY_KEY_NAME: ptr = list[y]->name; break; case MY_KEY_VALUE: ptr = &list[y]->value; break; default: - return(our_error(opts, NULL, "unknown key")); + return(trutils_error(opts, NULL, "unknown key")); }; if ((res = tinyrad_array_get(list, x, sizeof(MyData *), ptr, TINYRAD_ARRAY_FIRSTDUP, compar)) == NULL) - return(our_error(opts, NULL, "tinyrad_array_get(); size: %zu; func: %s; idx: %zu; search error", x, compar_name, y)); + return(trutils_error(opts, NULL, "tinyrad_array_get(); size: %zu; func: %s; idx: %zu; search error", x, compar_name, y)); if ((strcasecmp((*res)->name, list[y]->name))) - return(our_error(opts, NULL, "tinyrad_array_get(); size: %zu; func: %s; idx: %zu; result name does not match", x, compar_name, y)); + return(trutils_error(opts, NULL, "tinyrad_array_get(); size: %zu; func: %s; idx: %zu; result name does not match", x, compar_name, y)); if ((*res)->value != list[y]->value) - return(our_error(opts, NULL, "tinyrad_array_get(); size: %zu; func: %s; idx: %zu; result value does not match", x, compar_name, y)); + return(trutils_error(opts, NULL, "tinyrad_array_get(); size: %zu; func: %s; idx: %zu; result value does not match", x, compar_name, y)); }; }; diff --git a/tests/test-array-stack.c b/tests/test-array-stack.c index de1971e..9bb1929 100644 --- a/tests/test-array-stack.c +++ b/tests/test-array-stack.c @@ -222,7 +222,7 @@ int main( int argc, char * argv[] ) { for(; (pos > 0); pos--) free(data[pos-1].name); - return(our_error(opts, NULL, "out of virtual memory")); + return(trutils_error(opts, NULL, "out of virtual memory")); }; }; @@ -242,27 +242,27 @@ int main( int argc, char * argv[] ) if ((x % 4) == 3) { if ((objp = tinyrad_array_pop(list, &list_len, sizeof(MyData *))) == NULL) - return(our_error(opts, NULL, "unable to pop from stack")); + return(trutils_error(opts, NULL, "unable to pop from stack")); if ((strcasecmp(src[x-1]->name, (*objp)->name))) - return(our_error(opts, NULL, "str of pop object is incorrect")); + return(trutils_error(opts, NULL, "str of pop object is incorrect")); }; // adds objects to stack if (tinyrad_array_push((void **)&list, &list_len, sizeof(MyData *), &src[x], &realloc) == -1) - return(our_error(opts, NULL, "failed to push object to stack")); + return(trutils_error(opts, NULL, "failed to push object to stack")); }; // loop through stack and verify data trutils_verbose(opts, "verifing stack ..."); if (list_len != ((MY_LIST_LEN / 4) * 3)) - return(our_error(opts, NULL, "stack length is incorrect")); + return(trutils_error(opts, NULL, "stack length is incorrect")); for(x = 0, y = 0; (x < MY_LIST_LEN); x++) { if ((x % 4) == 2) continue; if ((strcmp(src[x]->name, list[y]->name))) - return(our_error(opts, NULL, "stack data does not match test data")); + return(trutils_error(opts, NULL, "stack data does not match test data")); y++; }; @@ -271,7 +271,7 @@ int main( int argc, char * argv[] ) trutils_verbose(opts, "popping from stack ..."); while (list_len > 0) if (tinyrad_array_pop(list, &list_len, sizeof(MyData *)) == NULL) - return(our_error(opts, NULL, "unable to pop from stack")); + return(trutils_error(opts, NULL, "unable to pop from stack")); return(0); } diff --git a/tests/test-dict-attrs.c b/tests/test-dict-attrs.c index 41e3280..ebbe44c 100644 --- a/tests/test-dict-attrs.c +++ b/tests/test-dict-attrs.c @@ -283,7 +283,7 @@ my_verify_attr( if (!(attr)) { our_dict_diag_attr(opts, attr_def, attr); - return(our_error(opts, NULL, "attribute was not found")); + return(trutils_error(opts, NULL, "attribute was not found")); }; // compare data types @@ -291,7 +291,7 @@ my_verify_attr( if (attr_def->data_type != u32) { our_dict_diag_attr(opts, attr_def, attr); - return(our_error(opts, NULL, "attribute data types do not match")); + return(trutils_error(opts, NULL, "attribute data types do not match")); }; // compare types @@ -299,7 +299,7 @@ my_verify_attr( if (attr_def->type != u8) { our_dict_diag_attr(opts, attr_def, attr); - return(our_error(opts, NULL, "attribute types do not match")); + return(trutils_error(opts, NULL, "attribute types do not match")); }; // compare vendor ID @@ -307,7 +307,7 @@ my_verify_attr( if (attr_def->vendor_id != u32) { our_dict_diag_attr(opts, attr_def, attr); - return(our_error(opts, NULL, "attribute vendor ID do not match")); + return(trutils_error(opts, NULL, "attribute vendor ID do not match")); }; // compare vendor types @@ -315,7 +315,7 @@ my_verify_attr( if (attr_def->vendor_type != u32) { our_dict_diag_attr(opts, attr_def, attr); - return(our_error(opts, NULL, "attribute vendor types do not match")); + return(trutils_error(opts, NULL, "attribute vendor types do not match")); }; // compare flags @@ -323,7 +323,7 @@ my_verify_attr( if (attr_def->flags != u32) { our_dict_diag_attr(opts, attr_def, attr); - return(our_error(opts, NULL, "attribute flags do not match")); + return(trutils_error(opts, NULL, "attribute flags do not match")); }; return(0); diff --git a/tests/test-dict-values.c b/tests/test-dict-values.c index 8fece04..e324345 100644 --- a/tests/test-dict-values.c +++ b/tests/test-dict-values.c @@ -193,7 +193,7 @@ main( ); if ((attr = tinyrad_dict_attr_get(dict, value_def->attr_name, 0, NULL, 0, 0)) == NULL) { - our_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); + trutils_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); tinyrad_free(attr); tinyrad_free(dict); return(1); @@ -223,7 +223,7 @@ main( ); if ((attr = tinyrad_dict_attr_get(dict, value_def->attr_name, 0, NULL, 0, 0)) == NULL) { - our_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); + trutils_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); tinyrad_free(attr); tinyrad_free(dict); return(1); @@ -253,7 +253,7 @@ main( ); if ((attr = tinyrad_dict_attr_get(dict, value_def->attr_name, 0, NULL, 0, 0)) == NULL) { - our_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); + trutils_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); tinyrad_free(attr); tinyrad_free(dict); return(1); @@ -283,7 +283,7 @@ main( ); if ((attr = tinyrad_dict_attr_get(dict, value_def->attr_name, 0, NULL, 0, 0)) == NULL) { - our_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); + trutils_error(opts, NULL, "%s: %s: unable to retrieve attribute", value_def->attr_name, value_def->value_name); tinyrad_free(attr); tinyrad_free(dict); return(1); @@ -327,7 +327,7 @@ my_verify_value( if (!(value)) { our_dict_diag_value(opts, value_def, value); - return(our_error(opts, NULL, "value was not found")); + return(trutils_error(opts, NULL, "value was not found")); }; //// compare value names @@ -336,7 +336,7 @@ my_verify_value( //{ // tinyrad_free(str); // our_dict_diag_value(opts, def, value); - // return(our_error(opts, NULL, "value names do not match")); + // return(trutils_error(opts, NULL, "value names do not match")); //}; //tinyrad_free(str); @@ -346,7 +346,7 @@ my_verify_value( //{ // tinyrad_free(str); // our_dict_diag_value(opts, def, value); - // return(our_error(opts, NULL, "value names do not match")); + // return(trutils_error(opts, NULL, "value names do not match")); //}; //tinyrad_free(str); @@ -356,7 +356,7 @@ my_verify_value( if (a_u8 != v_u8) { our_dict_diag_value(opts, value_def, value); - return(our_error(opts, NULL, "attribute type does not match")); + return(trutils_error(opts, NULL, "attribute type does not match")); }; // compare attribute vendor ID @@ -365,7 +365,7 @@ my_verify_value( if (a_u32 != v_u32) { our_dict_diag_value(opts, value_def, value); - return(our_error(opts, NULL, "attribute vendor id does not match")); + return(trutils_error(opts, NULL, "attribute vendor id does not match")); }; // compare attribute vendor type @@ -374,7 +374,7 @@ my_verify_value( if (a_u32 != v_u32) { our_dict_diag_value(opts, value_def, value); - return(our_error(opts, NULL, "attribute vendor type does not match")); + return(trutils_error(opts, NULL, "attribute vendor type does not match")); }; // compare value data @@ -382,7 +382,7 @@ my_verify_value( if (value_def->data != u64) { our_dict_diag_value(opts, value_def, value); - return(our_error(opts, NULL, "value data does not match")); + return(trutils_error(opts, NULL, "value data does not match")); }; return(0); diff --git a/tests/test-dict-vendors.c b/tests/test-dict-vendors.c index af7f0e3..fba49f6 100644 --- a/tests/test-dict-vendors.c +++ b/tests/test-dict-vendors.c @@ -254,7 +254,7 @@ my_verify_vendor( if (!(vendor)) { our_dict_diag_vendor(opts, vendor_def, NULL); - return(our_error(opts, NULL, "vendor was not found")); + return(trutils_error(opts, NULL, "vendor was not found")); }; // compare vendor ID @@ -262,7 +262,7 @@ my_verify_vendor( if (vendor_def->vendor_id != u32) { our_dict_diag_vendor(opts, vendor_def, vendor); - return(our_error(opts, NULL, "vendor ID do not match")); + return(trutils_error(opts, NULL, "vendor ID do not match")); }; // compare vendor type octets @@ -270,7 +270,7 @@ my_verify_vendor( if (vendor_def->vendor_type_octs != u8) { our_dict_diag_vendor(opts, vendor_def, vendor); - return(our_error(opts, NULL, "attribute type octets do not match")); + return(trutils_error(opts, NULL, "attribute type octets do not match")); }; // compare vendor len octets @@ -278,7 +278,7 @@ my_verify_vendor( if (vendor_def->vendor_len_octs != u8) { our_dict_diag_vendor(opts, vendor_def, vendor); - return(our_error(opts, NULL, "attribute len octets do not match")); + return(trutils_error(opts, NULL, "attribute len octets do not match")); }; return(0); diff --git a/tests/test-oid-str.c b/tests/test-oid-str.c index 76b93d3..9e79ebb 100644 --- a/tests/test-oid-str.c +++ b/tests/test-oid-str.c @@ -215,7 +215,7 @@ int main(int argc, char * argv[]) trutils_verbose(opts, " Initializing OID from values ..."); if ((oid = tinyrad_oid_init(test_vals[x].vals, y)) == NULL) { - our_error(opts, NULL, "out of virtual memory"); + trutils_error(opts, NULL, "out of virtual memory"); errs++; continue; }; @@ -223,14 +223,14 @@ int main(int argc, char * argv[]) trutils_verbose(opts, " Testing values of OID ..."); if ((rc = tinyrad_oid_values(oid, &vals, &len)) != TRAD_SUCCESS) { - our_error(opts, NULL, "tinyrad_oid_values(): %s", tinyrad_strerror(rc)); + trutils_error(opts, NULL, "tinyrad_oid_values(): %s", tinyrad_strerror(rc)); errs++; tinyrad_free(oid); continue; }; if (len != y) { - our_error(opts, NULL, "OID length does not match reference"); + trutils_error(opts, NULL, "OID length does not match reference"); errs++; tinyrad_free(oid); continue; @@ -239,7 +239,7 @@ int main(int argc, char * argv[]) { if (test_vals[x].vals[pos] != vals[pos]) { - our_error(opts, NULL, "OID values do not match reference"); + trutils_error(opts, NULL, "OID values do not match reference"); errs++; pos = y; }; @@ -311,7 +311,7 @@ my_oid_test( trutils_verbose(opts, " Generating %s ...", title); if ((str = tinyrad_oid2str(oldoid, type)) == NULL) { - our_error(opts, NULL, "out of virtual memory"); + trutils_error(opts, NULL, "out of virtual memory"); return(1); }; trutils_verbose(opts, " %s: %s", title, str); @@ -319,7 +319,7 @@ my_oid_test( trutils_verbose(opts, " Generating OID from %s ...", title); if ((newoid = tinyrad_str2oid(str)) == NULL) { - our_error(opts, NULL, "error generating OID from %s", title); + trutils_error(opts, NULL, "error generating OID from %s", title); tinyrad_free(str); return(1); }; @@ -331,7 +331,7 @@ my_oid_test( trutils_verbose(opts, " Generated OID: %s", my_oidstr(newvals, newlen)); if (newlen != oldlen) { - our_error(opts, NULL, "old and new OID lengths do not match"); + trutils_error(opts, NULL, "old and new OID lengths do not match"); tinyrad_free(newoid); tinyrad_free(newvals); tinyrad_free(oldvals); @@ -341,7 +341,7 @@ my_oid_test( { if (newvals[pos] != oldvals[pos]) { - our_error(opts, NULL, "old and new OID values do not match"); + trutils_error(opts, NULL, "old and new OID values do not match"); tinyrad_free(newoid); tinyrad_free(newvals); tinyrad_free(oldvals); @@ -353,7 +353,7 @@ my_oid_test( if ((tinyrad_oid_cmp(&oldoid, &newoid))) { tinyrad_free(newoid); - our_error(opts, NULL, "old OID does not match new OID"); + trutils_error(opts, NULL, "old OID does not match new OID"); return(1); }; diff --git a/tests/test-options.c b/tests/test-options.c index 5545905..8ad7cfc 100644 --- a/tests/test-options.c +++ b/tests/test-options.c @@ -160,50 +160,50 @@ int main( int argc, char * argv[] ) // TRAD_OPT_DEBUG_SYSLOG opt = TRAD_ON; if ((rc = tinyrad_set_option(NULL, TRAD_OPT_DEBUG_SYSLOG, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_SYSLOG, TRAD_ON): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_SYSLOG, TRAD_ON): %s", tinyrad_strerror(rc))); opt = ~TRAD_ON; if ((rc = tinyrad_get_option(NULL, TRAD_OPT_DEBUG_SYSLOG, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_SYSLOG, &opt): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_SYSLOG, &opt): %s", tinyrad_strerror(rc))); if (opt != TRAD_ON) - return(our_error(opts, NULL, "value for TRAD_OPT_DEBUG_SYSLOG does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_DEBUG_SYSLOG does not match")); opt = TRAD_OFF; if ((rc = tinyrad_set_option(NULL, TRAD_OPT_DEBUG_SYSLOG, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_SYSLOG, TRAD_ON): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_SYSLOG, TRAD_ON): %s", tinyrad_strerror(rc))); opt = ~TRAD_OFF; if ((rc = tinyrad_get_option(NULL, TRAD_OPT_DEBUG_SYSLOG, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_SYSLOG, &opt): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_SYSLOG, &opt): %s", tinyrad_strerror(rc))); if (opt != TRAD_OFF) - return(our_error(opts, NULL, "value for TRAD_OPT_DEBUG_SYSLOG does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_DEBUG_SYSLOG does not match")); // TRAD_OPT_DEBUG_IDENT if ((rc = tinyrad_set_option(NULL, TRAD_OPT_DEBUG_IDENT, PROGRAM_NAME)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_IDENT, PROGRAM_NAME): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_IDENT, PROGRAM_NAME): %s", tinyrad_strerror(rc))); str = NULL; if ((rc = tinyrad_get_option(NULL, TRAD_OPT_DEBUG_IDENT, &str)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_IDENT, &str): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_IDENT, &str): %s", tinyrad_strerror(rc))); if (!(str)) - return(our_error(opts, NULL, "value for TRAD_OPT_DEBUG_IDENT is NULL")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_DEBUG_IDENT is NULL")); if ((strcmp(PROGRAM_NAME, str))) - return(our_error(opts, NULL, "value for TRAD_OPT_DEBUG_IDENT does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_DEBUG_IDENT does not match")); free(str); // TRAD_OPT_DEBUG_LEVEL opt = TRAD_DEBUG_PACKETS; if ((rc = tinyrad_set_option(NULL, TRAD_OPT_DEBUG_LEVEL, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_LEVEL, TRAD_DEBUG_PACKETS): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_LEVEL, TRAD_DEBUG_PACKETS): %s", tinyrad_strerror(rc))); opt = ~TRAD_DEBUG_PACKETS; if ((rc = tinyrad_get_option(NULL, TRAD_OPT_DEBUG_LEVEL, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_LEVEL, &opt): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_LEVEL, &opt): %s", tinyrad_strerror(rc))); if (opt != TRAD_DEBUG_PACKETS) - return(our_error(opts, NULL, "value for TRAD_OPT_DEBUG_LEVEL does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_DEBUG_LEVEL does not match")); opt = TRAD_DEBUG_NONE; if ((rc = tinyrad_set_option(NULL, TRAD_OPT_DEBUG_LEVEL, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_LEVEL, TRAD_DEBUG_NONE): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DEBUG_LEVEL, TRAD_DEBUG_NONE): %s", tinyrad_strerror(rc))); opt = ~TRAD_DEBUG_NONE; if ((rc = tinyrad_get_option(NULL, TRAD_OPT_DEBUG_LEVEL, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_LEVEL, &opt): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DEBUG_LEVEL, &opt): %s", tinyrad_strerror(rc))); if (opt != TRAD_DEBUG_NONE) - return(our_error(opts, NULL, "value for TRAD_OPT_DEBUG_LEVEL does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_DEBUG_LEVEL does not match")); // enable debug if ((debug)) @@ -211,118 +211,118 @@ int main( int argc, char * argv[] ) // initialize tinyrad if ((rc = tinyrad_initialize(&tr, NULL, "radius://localhost/secret", 0)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_initialize(tr, \"radius://localhost/secret\", 0): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_initialize(tr, \"radius://localhost/secret\", 0): %s", tinyrad_strerror(rc))); // TRAD_OPT_DESC opt = 53; if ((rc = tinyrad_set_option(tr, TRAD_OPT_DESC, &opt)) == TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DESC, 53): was able to set file descriptor", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_DESC, 53): was able to set file descriptor", tinyrad_strerror(rc))); opt = ~0x00; if ((rc = tinyrad_get_option(tr, TRAD_OPT_DESC, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DESC, &opt): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_DESC, &opt): %s", tinyrad_strerror(rc))); // TRAD_OPT_IPV4 //opt = TRAD_ON; //if ((rc = tinyrad_set_option(tr, TRAD_OPT_IPV4, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV4, TRAD_ON): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV4, TRAD_ON): %s", tinyrad_strerror(rc))); //opt = (int)~0x00; //if ((rc = tinyrad_get_option(tr, TRAD_OPT_IPV4, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV4, &opt): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV4, &opt): %s", tinyrad_strerror(rc))); //if (opt != TRAD_ON) - // return(our_error(opts, NULL, "value for TRAD_OPT_IPV4 does not match")); + // return(trutils_error(opts, NULL, "value for TRAD_OPT_IPV4 does not match")); //opt = TRAD_OFF; //if ((rc = tinyrad_set_option(tr, TRAD_OPT_IPV4, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV4, TRAD_ON): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV4, TRAD_ON): %s", tinyrad_strerror(rc))); //opt = ~TRAD_OFF; //if ((rc = tinyrad_get_option(tr, TRAD_OPT_IPV4, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV4, &opt): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV4, &opt): %s", tinyrad_strerror(rc))); //if (opt != TRAD_OFF) - // return(our_error(opts, NULL, "value for TRAD_OPT_IPV4 does not match")); + // return(trutils_error(opts, NULL, "value for TRAD_OPT_IPV4 does not match")); // TRAD_OPT_IPV6 //opt = TRAD_ON; //if ((rc = tinyrad_set_option(tr, TRAD_OPT_IPV6, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV6, TRAD_ON): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV6, TRAD_ON): %s", tinyrad_strerror(rc))); //opt = (int)~0x00; //if ((rc = tinyrad_get_option(tr, TRAD_OPT_IPV6, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV6, &opt): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV6, &opt): %s", tinyrad_strerror(rc))); //if (opt != TRAD_ON) - // return(our_error(opts, NULL, "value for TRAD_OPT_IPV6 does not match")); + // return(trutils_error(opts, NULL, "value for TRAD_OPT_IPV6 does not match")); //opt = TRAD_OFF; //if ((rc = tinyrad_set_option(tr, TRAD_OPT_IPV6, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV6, TRAD_ON): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_IPV6, TRAD_ON): %s", tinyrad_strerror(rc))); //opt = ~TRAD_OFF; //if ((rc = tinyrad_get_option(tr, TRAD_OPT_IPV6, &opt)) != TRAD_SUCCESS) - // return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV6, &opt): %s", tinyrad_strerror(rc))); + // return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_IPV6, &opt): %s", tinyrad_strerror(rc))); //if (opt != TRAD_OFF) - // return(our_error(opts, NULL, "value for TRAD_OPT_IPV6 does not match")); + // return(trutils_error(opts, NULL, "value for TRAD_OPT_IPV6 does not match")); // TRAD_OPT_NETWORK_TIMEOUT tv.tv_sec = 200; tv.tv_usec = 111; if ((rc = tinyrad_set_option(tr, TRAD_OPT_NETWORK_TIMEOUT, &tv)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_NETWORK_TIMEOUT, &tv): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_NETWORK_TIMEOUT, &tv): %s", tinyrad_strerror(rc))); tv.tv_sec = ~0x00; tv.tv_usec = ~0x00; if ((rc = tinyrad_get_option(tr, TRAD_OPT_NETWORK_TIMEOUT, &tv)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_NETWORK_TIMEOUT, &tv): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_NETWORK_TIMEOUT, &tv): %s", tinyrad_strerror(rc))); if (tv.tv_sec != 200) - return(our_error(opts, NULL, "tv_sec for TRAD_OPT_NETWORK_TIMEOUT does not match")); + return(trutils_error(opts, NULL, "tv_sec for TRAD_OPT_NETWORK_TIMEOUT does not match")); if (tv.tv_usec != 111) - return(our_error(opts, NULL, "tv_usec for TRAD_OPT_NETWORK_TIMEOUT does not match")); + return(trutils_error(opts, NULL, "tv_usec for TRAD_OPT_NETWORK_TIMEOUT does not match")); // TRAD_OPT_TIMEOUT opt = 53; if ((rc = tinyrad_set_option(tr, TRAD_OPT_TIMEOUT, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_TIMEOUT, TRAD_ON): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_TIMEOUT, TRAD_ON): %s", tinyrad_strerror(rc))); opt = ~0x00; if ((rc = tinyrad_get_option(tr, TRAD_OPT_TIMEOUT, &opt)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_TIMEOUT, &opt): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_TIMEOUT, &opt): %s", tinyrad_strerror(rc))); if (opt != 53) - return(our_error(opts, NULL, "value for TRAD_OPT_TIMEOUT does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_TIMEOUT does not match")); // TRAD_OPT_SOCKET_BIND_ADDRESSES if ((rc = tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, "127.0.0.1")) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, \"127.0.0.1\"): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, \"127.0.0.1\"): %s", tinyrad_strerror(rc))); str = NULL; if ((rc = tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str): %s", tinyrad_strerror(rc))); if (!(str)) - return(our_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES is NULL")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES is NULL")); if ((strcmp(str, "127.0.0.1 ::"))) - return(our_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES does not match")); free(str); if ((rc = tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, "::1")) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, \"127.0.0.1\"): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, \"127.0.0.1\"): %s", tinyrad_strerror(rc))); str = NULL; if ((rc = tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str): %s", tinyrad_strerror(rc))); if (!(str)) - return(our_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES is NULL")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES is NULL")); if ((strcmp(str, "0.0.0.0 ::1"))) - return(our_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES does not match")); free(str); if ((rc = tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, "::1 127.0.0.1")) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, \"127.0.0.1\"): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, \"127.0.0.1\"): %s", tinyrad_strerror(rc))); str = NULL; if ((rc = tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_SOCKET_BIND_ADDRESSES, &str): %s", tinyrad_strerror(rc))); if (!(str)) - return(our_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES is NULL")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES is NULL")); if ((strcmp(str, "127.0.0.1 ::1"))) - return(our_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_SOCKET_BIND_ADDRESSES does not match")); free(str); // TRAD_OPT_URI if ((rc = tinyrad_set_option(tr, TRAD_OPT_URI, "radius://localhost/radiussecret")) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_URI, \"radius://localhost/radiussecret\"): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_set_option(tr, TRAD_OPT_URI, \"radius://localhost/radiussecret\"): %s", tinyrad_strerror(rc))); str = NULL; if ((rc = tinyrad_get_option(tr, TRAD_OPT_URI, &str)) != TRAD_SUCCESS) - return(our_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_URI, &str): %s", tinyrad_strerror(rc))); + return(trutils_error(opts, NULL, "tinyrad_get_option(tr, TRAD_OPT_URI, &str): %s", tinyrad_strerror(rc))); if (!(str)) - return(our_error(opts, NULL, "value for TRAD_OPT_URI is NULL")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_URI is NULL")); if ((strcmp(str, "radius://localhost/radiussecret"))) - return(our_error(opts, NULL, "value for TRAD_OPT_URI does not match")); + return(trutils_error(opts, NULL, "value for TRAD_OPT_URI does not match")); free(str); return(0); diff --git a/tests/test-pckt-byte-order.c b/tests/test-pckt-byte-order.c index edef3b6..85b3ad5 100644 --- a/tests/test-pckt-byte-order.c +++ b/tests/test-pckt-byte-order.c @@ -302,7 +302,7 @@ my_test_value( if ( value != ptoh) { - our_error(opts, NULL, "value parsed from buffer does not match original"); + trutils_error(opts, NULL, "value parsed from buffer does not match original"); return(1); }; @@ -313,13 +313,13 @@ my_test_value( byte = ((offset+width-pos) << 4) | ((offset+width-pos) << 0); if (buff[pos] != byte) { - our_error(opts, NULL, "unexpected byte in buffer at offset %zu", pos); + trutils_error(opts, NULL, "unexpected byte in buffer at offset %zu", pos); return(1); }; } else { if (buff[pos] != 0xff) { - our_error(opts, NULL, "unexpected byte in buffer at offset %zu", pos); + trutils_error(opts, NULL, "unexpected byte in buffer at offset %zu", pos); return(1); }; }; -- cgit v1.2.3