Commit 45190d60 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Code style polish mostly around vtc_fatal

parent 412961ab
......@@ -379,10 +379,9 @@ parse_string(const char *spec, const struct cmds *cmd, void *priv,
for (cp = cmd; cp->name != NULL; cp++)
if (!strcmp(token_s[0], cp->name))
break;
if (cp->name == NULL) {
if (cp->name == NULL)
vtc_fatal(vl, "Unknown command: \"%s\"", token_s[0]);
NEEDLESS(return);
}
assert(cp->cmd != NULL);
cp->cmd(token_s, priv, cmd, vl);
......@@ -506,11 +505,10 @@ cmd_shell_engine(struct vtclog *vl, int ok, const char *cmd,
if (ok < 0 && !WEXITSTATUS(r) && !WIFSIGNALED(r))
vtc_fatal(vl, "shell did not fail as expected");
else if (ok >= 0 && WEXITSTATUS(r) != ok) {
vtc_fatal(vl,
"shell_exit not as expected: got 0x%04x wanted 0x%04x",
WEXITSTATUS(r), ok);
}
else if (ok >= 0 && WEXITSTATUS(r) != ok)
vtc_fatal(vl, "shell_exit not as expected: "
"got 0x%04x wanted 0x%04x", WEXITSTATUS(r), ok);
if (expect != NULL) {
if (strstr(VSB_data(vsb), expect) == NULL)
vtc_fatal(vl,
......@@ -709,9 +707,8 @@ cmd_feature(CMD_ARGS)
#endif
} else if (!strcmp(*av, "cmd")) {
av++;
if (*av == NULL) {
if (*av == NULL)
vtc_fatal(vl, "Missing the command-line");
}
r = system(*av);
if (WEXITSTATUS(r) == 0)
good = 1;
......@@ -721,13 +718,11 @@ cmd_feature(CMD_ARGS)
if (good)
continue;
if (!vtc_stop) {
vtc_fatal(vl,
"FAIL test, unknown feature: %s", *av);
} else {
if (!vtc_stop)
vtc_fatal(vl, "FAIL test, unknown feature: %s", *av);
else
vtc_log(vl, 1,
"SKIPPING test, lacking feature: %s", *av);
}
return;
}
}
......
......@@ -1114,8 +1114,7 @@ cmd_http_rxreq(CMD_ARGS)
http_rxhdr(hp);
http_splitheader(hp, 1);
if (http_count_header(hp->req, "Content-Length") > 1)
vtc_fatal(vl,
"Multiple Content-Length headers.\n");
vtc_fatal(vl, "Multiple Content-Length headers.\n");
http_swallow_body(hp, hp->req, 0);
vtc_log(vl, 4, "bodylen = %s", hp->bodylen);
}
......@@ -1142,8 +1141,7 @@ cmd_http_rxreqhdrs(CMD_ARGS)
http_rxhdr(hp);
http_splitheader(hp, 1);
if (http_count_header(hp->req, "Content-Length") > 1)
vtc_fatal(hp->vl,
"Multiple Content-Length headers.\n");
vtc_fatal(hp->vl, "Multiple Content-Length headers.\n");
}
/* SECTION: client-server.spec.rxreqbody
......@@ -1666,9 +1664,8 @@ cmd_http_fatal(CMD_ARGS)
hp->fatal = 0;
else if (!strcmp(av[0], "non_fatal"))
hp->fatal = -1;
else {
else
vtc_fatal(vl, "XXX: fatal %s", cmd->name);
}
}
#define cmd_http_non_fatal cmd_http_fatal
......@@ -1764,8 +1761,8 @@ cmd_http_settings(CMD_ARGS)
if (!strcmp(*av, "-dectbl")) {
n = strtoul(av[1], &p, 0);
if (*p != '\0')
vtc_fatal(hp->vl, "-dectbl takes an integer as"
" argument (found %s)", av[1]);
vtc_fatal(hp->vl, "-dectbl takes an integer as "
"argument (found %s)", av[1]);
HPK_ResizeTbl(hp->decctx, n);
av++;
} else
......
This diff is collapsed.
......@@ -281,10 +281,9 @@ vtc_log_VAS_Fail(const char *func, const char *file, int line,
"Assert error in %s(), %s line %d:\n"
" Condition(%s) not true.\n",
func, file, line, cond);
} else {
} else
vtc_fatal(vl, "Assert error in %s(), %s line %d:"
" Condition(%s) not true.\n", func, file, line, cond);
}
abort();
}
......
......@@ -744,9 +744,8 @@ varnish_vcl(struct varnish *v, const char *vcl, int fail, char **resp)
} else if (u != CLIS_OK && !fail) {
VSB_destroy(&vsb);
vtc_fatal(v->vl, "VCL compilation failed expected success");
} else if (fail) {
} else if (fail)
vtc_log(v->vl, 2, "VCL compilation failed (as expected)");
}
VSB_destroy(&vsb);
}
......@@ -957,9 +956,8 @@ varnish_expect(const struct varnish *v, char * const *av)
else if (!strcmp(av[1], "<")) { if (sp.val < ref) good = 1; }
else if (!strcmp(av[1], ">=")) { if (sp.val >= ref) good = 1; }
else if (!strcmp(av[1], "<=")) { if (sp.val <= ref) good = 1; }
else {
else
vtc_fatal(v->vl, "comparison %s unknown", av[1]);
}
if (good)
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment