Skip to content
Snippets Groups Projects
Commit 8a8dc412 authored by Jakob Olsson's avatar Jakob Olsson
Browse files

ubus_api_validator: refactor pass/fail

would fail unconditionally if response was not successful, regardless of return code
parent 1a89e2da
No related branches found
No related tags found
1 merge request!2ubus_api_validator: refactor pass/fail
...@@ -80,7 +80,7 @@ static int validate_jobj(struct json_object *jobj) { ...@@ -80,7 +80,7 @@ static int validate_jobj(struct json_object *jobj) {
const char *defstr = "no result"; const char *defstr = "no result";
int rv = 0; int rv = 0;
int rv_validation = 0; int rv_validation = 1;
char *format = NULL; char *format = NULL;
tmp = json_object_array_get_idx(ubus_methods, i); tmp = json_object_array_get_idx(ubus_methods, i);
...@@ -119,12 +119,12 @@ static int validate_jobj(struct json_object *jobj) { ...@@ -119,12 +119,12 @@ static int validate_jobj(struct json_object *jobj) {
} }
} }
if (!rv_validation || rc != res->rc) { if (rv_validation && rc == res->rc)
ok(true, format);
else {
ok(false, format); ok(false, format);
failed = 1; failed = 1;
} else }
ok(true, format);
free(res); free(res);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment