]> sigrok.org Git - libsigrokdecode.git/blobdiff - tests/runtc.c
runtc: PD option value is a GVariant, not string.
[libsigrokdecode.git] / tests / runtc.c
index cd3d44983fe0598d9d609ea4e8dea5683c9c125a..ab5513958606aa35a0d33e720d740c82a589f1ee 100644 (file)
@@ -48,7 +48,7 @@ struct channel {
 
 struct option {
        char *key;
-       char *value;
+       GVariant *value;
 };
 
 struct pd {
@@ -688,8 +688,8 @@ int main(int argc, char **argv)
        struct channel *channel;
        struct option *option;
        struct output *op;
-       int ret;
-       char c, *opt_infile, **kv, **opstr;
+       int ret, c;
+       char *opt_infile, **kv, **opstr;
 
        op = malloc(sizeof(struct output));
        op->pd = NULL;
@@ -736,7 +736,8 @@ int main(int argc, char **argv)
                        } else {
                                option = malloc(sizeof(struct option));
                                option->key = g_strdup(kv[0]);
-                               option->value = g_strdup(kv[1]);
+                               option->value = g_variant_new_string(kv[1]);
+                g_variant_ref_sink(option->value);
                                /* Apply to last PD. */
                                pd->options = g_slist_append(pd->options, option);
                        }
@@ -759,6 +760,9 @@ int main(int argc, char **argv)
                                op->type = SRD_OUTPUT_BINARY;
                        else if (!strcmp(opstr[1], "python"))
                                op->type = SRD_OUTPUT_PYTHON;
+                       else if (!strcmp(opstr[1], "exception"))
+                /* Doesn't matter, we just need it to bomb out. */
+                               op->type = SRD_OUTPUT_PYTHON;
                        else {
                                ERR("Unknown output type '%s'", opstr[1]);
                                g_strfreev(opstr);