Commit a1fe2296 authored by Christian Kellner's avatar Christian Kellner
Browse files

Add an id (UUID) to each test run

That will make it easy to globally identify runs, which might come
in handy especially if we synchronize runs into a central database.
parent 34e0664c
...@@ -14,6 +14,7 @@ struct _GbbTestRun { ...@@ -14,6 +14,7 @@ struct _GbbTestRun {
GObject parent; GObject parent;
GbbBatteryTest *test; GbbBatteryTest *test;
char *id;
char *filename; char *filename;
char *name; char *name;
char *description; char *description;
...@@ -63,6 +64,7 @@ gbb_test_run_finalize(GObject *object) ...@@ -63,6 +64,7 @@ gbb_test_run_finalize(GObject *object)
static void static void
gbb_test_run_init(GbbTestRun *run) gbb_test_run_init(GbbTestRun *run)
{ {
run->id = uuid_gen_new();
run->history = g_queue_new(); run->history = g_queue_new();
} }
...@@ -310,6 +312,8 @@ gbb_test_run_write_to_file(GbbTestRun *run, ...@@ -310,6 +312,8 @@ gbb_test_run_write_to_file(GbbTestRun *run,
JsonBuilder *builder = json_builder_new(); JsonBuilder *builder = json_builder_new();
json_builder_begin_object(builder); json_builder_begin_object(builder);
json_builder_set_member_name(builder, "id");
json_builder_add_string_value(builder, run->id);
json_builder_set_member_name(builder, "test-id"); json_builder_set_member_name(builder, "test-id");
json_builder_add_string_value(builder, run->test->id); json_builder_add_string_value(builder, run->test->id);
json_builder_set_member_name(builder, "test-name"); json_builder_set_member_name(builder, "test-name");
......
Supports Markdown
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