mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
change NAN markup to make tests work on mac
For some unknown reason mac osx does not change NAN to negative in printout when asking to do so. To get rid of false positive test results change the sign of NAN to positive, that may break something for someone if there are people expecting -NAN when devision with zero happens. But that sort of breakage is pretty unlikely because it requires broken dhcpd.conf. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
01aa13cf43
commit
1a7d982495
2 changed files with 18 additions and 18 deletions
34
src/output.c
34
src/output.c
|
|
@ -148,10 +148,10 @@ int output_txt(void)
|
|||
shared_p->name, shared_p->available,
|
||||
shared_p->used,
|
||||
shared_p->available ==
|
||||
0 ? -NAN : (float)(100 * shared_p->used) / shared_p->available,
|
||||
0 ? NAN : (float)(100 * shared_p->used) / shared_p->available,
|
||||
shared_p->touched, shared_p->touched + shared_p->used,
|
||||
shared_p->available ==
|
||||
0 ? -NAN : ((float)(100 * (shared_p->touched + shared_p->used)) /
|
||||
0 ? NAN : ((float)(100 * (shared_p->touched + shared_p->used)) /
|
||||
shared_p->available));
|
||||
if (config.backups_found == 1) {
|
||||
fprintf(outfile, "%7g %8.3f",
|
||||
|
|
@ -181,17 +181,17 @@ int output_txt(void)
|
|||
shared_networks->available,
|
||||
shared_networks->used,
|
||||
shared_networks->available ==
|
||||
0 ? -NAN : (float)(100 * shared_networks->used) /
|
||||
0 ? NAN : (float)(100 * shared_networks->used) /
|
||||
shared_networks->available, shared_networks->touched,
|
||||
shared_networks->touched + shared_networks->used,
|
||||
shared_networks->available ==
|
||||
0 ? -NAN : (float)(100 *
|
||||
0 ? NAN : (float)(100 *
|
||||
(shared_networks->touched +
|
||||
shared_networks->used)) / shared_networks->available);
|
||||
|
||||
if (config.backups_found == 1) {
|
||||
fprintf(outfile, "%7g %8.3f",
|
||||
shared_networks->available == 0 ? -NAN : shared_networks->backups,
|
||||
shared_networks->available == 0 ? NAN : shared_networks->backups,
|
||||
(float)(100 * shared_networks->backups) /
|
||||
shared_networks->available);
|
||||
}
|
||||
|
|
@ -642,12 +642,12 @@ int output_html(void)
|
|||
output_double(outfile, "td", shared_networks->used);
|
||||
output_float(outfile, "td",
|
||||
shared_networks->available ==
|
||||
0 ? -NAN : (float)(100 * shared_networks->used) /
|
||||
0 ? NAN : (float)(100 * shared_networks->used) /
|
||||
shared_networks->available);
|
||||
output_double(outfile, "td", shared_networks->touched);
|
||||
output_double(outfile, "td", shared_networks->touched + shared_networks->used);
|
||||
output_float(outfile, "td",
|
||||
shared_networks->available == 0 ? -NAN : (float)(100 *
|
||||
shared_networks->available == 0 ? NAN : (float)(100 *
|
||||
(shared_networks->touched
|
||||
+
|
||||
shared_networks->used))
|
||||
|
|
@ -655,7 +655,7 @@ int output_html(void)
|
|||
if (config.backups_found == 1) {
|
||||
output_double(outfile, "td", shared_networks->backups);
|
||||
output_float(outfile, "td",
|
||||
shared_networks->available == 0 ? -NAN : (float)(100 *
|
||||
shared_networks->available == 0 ? NAN : (float)(100 *
|
||||
shared_networks->backups)
|
||||
/ shared_networks->available);
|
||||
}
|
||||
|
|
@ -692,19 +692,19 @@ int output_html(void)
|
|||
output_double(outfile, "td", shared_p->used);
|
||||
output_float(outfile, "td",
|
||||
shared_p->available ==
|
||||
0 ? -NAN : (float)(100 * shared_p->used) /
|
||||
0 ? NAN : (float)(100 * shared_p->used) /
|
||||
shared_p->available);
|
||||
output_double(outfile, "td", shared_p->touched);
|
||||
output_double(outfile, "td", shared_p->touched + shared_p->used);
|
||||
output_float(outfile, "td",
|
||||
shared_p->available == 0 ? -NAN : (float)(100 *
|
||||
shared_p->available == 0 ? NAN : (float)(100 *
|
||||
(shared_p->touched +
|
||||
shared_p->used)) /
|
||||
shared_p->available);
|
||||
if (config.backups_found == 1) {
|
||||
output_double(outfile, "td", shared_p->backups);
|
||||
output_float(outfile, "td",
|
||||
shared_p->available == 0 ? -NAN : (float)(100 *
|
||||
shared_p->available == 0 ? NAN : (float)(100 *
|
||||
shared_p->backups)
|
||||
/ shared_p->available);
|
||||
}
|
||||
|
|
@ -857,10 +857,10 @@ int output_csv(void)
|
|||
"\"%s\",\"%g\",\"%g\",\"%.3f\",\"%g\",\"%g\",\"%.3f\"",
|
||||
shared_p->name, shared_p->available,
|
||||
shared_p->used,
|
||||
shared_p->available == 0 ? -NAN : (float)(100 * shared_p->used) /
|
||||
shared_p->available == 0 ? NAN : (float)(100 * shared_p->used) /
|
||||
shared_p->available, shared_p->touched,
|
||||
shared_p->touched + shared_p->used,
|
||||
shared_p->available == 0 ? -NAN : (float)(100 *
|
||||
shared_p->available == 0 ? NAN : (float)(100 *
|
||||
(shared_p->touched +
|
||||
shared_p->used)) /
|
||||
shared_p->available);
|
||||
|
|
@ -868,7 +868,7 @@ int output_csv(void)
|
|||
fprintf(outfile, ",\"%g\",\"%.3f\"",
|
||||
shared_p->backups,
|
||||
shared_p->available ==
|
||||
0 ? -NAN : (float)(100 * shared_p->backups) /
|
||||
0 ? NAN : (float)(100 * shared_p->backups) /
|
||||
shared_p->available);
|
||||
}
|
||||
|
||||
|
|
@ -892,18 +892,18 @@ int output_csv(void)
|
|||
shared_networks->name, shared_networks->available,
|
||||
shared_networks->used,
|
||||
shared_networks->available ==
|
||||
0 ? -NAN : (float)(100 * shared_networks->used) /
|
||||
0 ? NAN : (float)(100 * shared_networks->used) /
|
||||
shared_networks->available, shared_networks->touched,
|
||||
shared_networks->touched + shared_networks->used,
|
||||
shared_networks->available ==
|
||||
0 ? -NAN : (float)(100 *
|
||||
0 ? NAN : (float)(100 *
|
||||
(shared_networks->touched +
|
||||
shared_networks->used)) / shared_networks->available);
|
||||
if (config.backups_found == 1) {
|
||||
fprintf(outfile, "%7g %8.3f",
|
||||
shared_networks->backups,
|
||||
shared_networks->available ==
|
||||
0 ? -NAN : (float)(100 * shared_networks->backups) /
|
||||
0 ? NAN : (float)(100 * shared_networks->backups) /
|
||||
shared_networks->available);
|
||||
}
|
||||
fprintf(outfile, "\n");
|
||||
|
|
|
|||
|
|
@ -6,4 +6,4 @@ name max cur percent touch t+c t+c perc
|
|||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 0 0 -nan 0 0 -nan
|
||||
All networks 0 0 nan 0 0 nan
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue