@@ -2135,7 +2135,7 @@ int main(int argc, char **argv)
printf("\033[%dB", num_threads + 2);
if (strlen(outfile) != 0)
- rt_write_json(outfile, write_stats, NULL);
+ rt_write_json(outfile, ret, write_stats, NULL);
if (quiet)
quiet = 2;
@@ -84,7 +84,7 @@ void rt_init(int argc, char *argv[]);
void rt_test_start(void);
-void rt_write_json(const char *filename,
+void rt_write_json(const char *filename, int return_code,
void (*cb)(FILE *, void *), void *data);
#endif /* __RT_UTILS.H */
@@ -534,7 +534,7 @@ void rt_test_start(void)
get_timestamp(ts_start);
}
-void rt_write_json(const char *filename,
+void rt_write_json(const char *filename, int return_code,
void (*cb)(FILE *, void *), void *data)
{
unsigned char buf[1];
@@ -571,6 +571,7 @@ void rt_write_json(const char *filename,
fprintf(f, " \"rt_test_version:\": \"%1.2f\",\n", VERSION);
fprintf(f, " \"start_time\": \"%s\",\n", ts_start);
fprintf(f, " \"end_time\": \"%s\",\n", ts_end);
+ fprintf(f, " \"return_code\": %d,\n", return_code);
fprintf(f, " \"sysinfo\": {\n");
fprintf(f, " \"sysname\": \"%s\",\n", uts.sysname);
fprintf(f, " \"nodename\": \"%s\",\n", uts.nodename);
@@ -578,9 +579,13 @@ void rt_write_json(const char *filename,
fprintf(f, " \"version\": \"%s\",\n", uts.version);
fprintf(f, " \"machine\": \"%s\",\n", uts.machine);
fprintf(f, " \"realtime\": %d\n", rt);
- fprintf(f, " },\n");
- (cb)(f, data);
+ if (cb) {
+ fprintf(f, " },\n");
+ (cb)(f, data);
+ } else {
+ fprintf(f, " }\n");
+ }
fprintf(f, "}\n");
@@ -863,7 +863,7 @@ int main(int argc, char *argv[])
write_summary(threads);
if (strlen(g.outfile) != 0)
- rt_write_json(g.outfile, write_summary_json, threads);
+ rt_write_json(g.outfile, 0, write_summary_json, threads);
if (g.cpu_list) {
free(g.cpu_list);
@@ -652,7 +652,7 @@ int main(int argc, char *argv[])
.receiver = receiver,
.sender = sender,
};
- rt_write_json(outfile, write_stats, &ps);
+ rt_write_json(outfile, 0, write_stats, &ps);
}
nomem:
@@ -520,7 +520,7 @@ int main(int argc, char *argv[])
.receiver = receiver,
.sender = sender,
};
- rt_write_json(outfile, write_stats, &ps);
+ rt_write_json(outfile, 0, write_stats, &ps);
}
nomem:
@@ -664,7 +664,7 @@ int main (int argc, char **argv)
print_results();
if (strlen(outfile) != 0)
- rt_write_json(outfile, write_stats, NULL);
+ rt_write_json(outfile, check < 0, write_stats, NULL);
if (stop) {
/*
@@ -1228,7 +1228,7 @@ int main(int argc, char **argv)
}
if (strlen(outfile) != 0)
- rt_write_json(outfile, write_stats, sched_data);
+ rt_write_json(outfile, 0, write_stats, sched_data);
if (setcpu_buf)
free(setcpu_buf);
@@ -559,7 +559,7 @@ int main(int argc, char **argv)
free(stat[i].values);
}
if (strlen(outfile) != 0)
- rt_write_json(outfile, write_stats, par);
+ rt_write_json(outfile, ret, write_stats, par);
free(stat);
outpar:
@@ -707,7 +707,7 @@ int main(int argc, char *argv[])
.receiver = receiver,
.sender = sender,
};
- rt_write_json(outfile, write_stats, &ps);
+ rt_write_json(outfile, 0, write_stats, &ps);
}
nomem:
@@ -779,7 +779,7 @@ int main(int argc, char *argv[])
.receiver = receiver,
.sender = sender,
};
- rt_write_json(outfile, write_stats, &ps);
+ rt_write_json(outfile, 0, write_stats, &ps);
}
nosem:
Many rt-tests return an error code if the test fails. Let's add this information to the common section. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- src/cyclictest/cyclictest.c | 2 +- src/include/rt-utils.h | 2 +- src/lib/rt-utils.c | 11 ++++++++--- src/oslat/oslat.c | 2 +- src/pmqtest/pmqtest.c | 2 +- src/ptsematest/ptsematest.c | 2 +- src/rt-migrate-test/rt-migrate-test.c | 2 +- src/sched_deadline/cyclicdeadline.c | 2 +- src/signaltest/signaltest.c | 2 +- src/sigwaittest/sigwaittest.c | 2 +- src/svsematest/svsematest.c | 2 +- 11 files changed, 18 insertions(+), 13 deletions(-)