summaryrefslogtreecommitdiffstats
path: root/src/tests/test-unit/test-unit.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-05-02 10:34:52 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-09-19 15:25:36 +0200
commit6b647feb6483cecbfbf50efde394b5a7d8d0aa56 (patch)
tree13cca6999c0d4530f9445c19afb492021096c4ce /src/tests/test-unit/test-unit.c
parent36b13c48406e977265669f5c99802571b8499cef (diff)
Include json description for callbacks
This tiny modification is mainly for debugging. Change-Id: Ieda90da49d365a7b092a02833227c869bd0397a4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/tests/test-unit/test-unit.c')
-rw-r--r--src/tests/test-unit/test-unit.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tests/test-unit/test-unit.c b/src/tests/test-unit/test-unit.c
index 5912dbc..9a205fc 100644
--- a/src/tests/test-unit/test-unit.c
+++ b/src/tests/test-unit/test-unit.c
@@ -46,7 +46,8 @@ static int processunit(const struct unitdesc *desc)
const char *content = desc->content;
printf("\n##########################################################");
-printf("\n### usr=%d sys=%d soc=%d srv=%d name %s%s", isuser, issystem, issock, isserv, name?:"?", issock?".socket":isserv?".service":"");
+printf("\n### usr=%d sys=%d soc=%d srv=%d name %s%s", isuser, issystem, issock,
+ isserv, name?:"?", issock?".socket":isserv?".service":"");
printf("\n##########################################################");
printf("\n%s\n\n",content);
return 0;
@@ -55,6 +56,10 @@ printf("\n%s\n\n",content);
static int process(void *closure, const struct generatedesc *desc)
{
int i;
+printf("\n##########################################################");
+printf("\n###### J S O N D E S C AFTER #######");
+printf("\n##########################################################");
+puts(json_object_to_json_string_ext(desc->desc, JSON_C_TO_STRING_PRETTY));
for (i = 0 ; i < desc->nunits ; i++)
processunit(&desc->units[i]);
return 0;
@@ -77,7 +82,10 @@ int main(int ac, char **av)
if (!obj)
error("can't read widget config at %s: %m",*av);
- puts(json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY));
+printf("\n##########################################################");
+printf("\n###### J S O N D E S C BEFORE #######");
+printf("\n##########################################################");
+puts(json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY));
rc = unit_generator_process(obj, &conf, process, NULL);
if (rc)
error("can't apply generate units, error %d",rc);