summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2014-06-24 16:16:32 -0700
committerVincent Guittot <vincent.guittot@linaro.org>2014-06-25 09:16:12 +0200
commit5912769433327ab76da644269bedcb3f587db031 (patch)
treeed8feb9883d8d970a98e0b73681c606b19d5ce83
parentb48567d5f18918e225c0b8700a5354b217c4022e (diff)
KJH: test JSON merge toolinclude_json
Example of how to combine JSON tests: ./merge.py -o combined.json global.json resources.json thread0.json thread1.json thread2.json thread3.json
-rw-r--r--doc/global.json12
-rwxr-xr-xdoc/merge.py42
-rw-r--r--doc/resources.json11
-rw-r--r--doc/thread0.json15
-rw-r--r--doc/thread1.json14
-rw-r--r--doc/thread2.json13
-rw-r--r--doc/thread3.json13
7 files changed, 120 insertions, 0 deletions
diff --git a/doc/global.json b/doc/global.json
new file mode 100644
index 0000000..58dbfb3
--- /dev/null
+++ b/doc/global.json
@@ -0,0 +1,12 @@
+{
+ "global" : {
+ "default_policy" : "SCHED_OTHER",
+ "duration" : 5,
+ "ftrace" : true,
+ "gnuplot" : true,
+ "logdir" : "/tmp/",
+ "log_basename" : "rt-app",
+ "lock_pages" : true,
+ "frag" : 1
+ }
+}
diff --git a/doc/merge.py b/doc/merge.py
new file mode 100755
index 0000000..a95c7a2
--- /dev/null
+++ b/doc/merge.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import getopt
+import json
+
+outfile = "merged.json"
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "o:")
+
+except getopt.GetoptError as err:
+ print str(err) # will print something like "option -a not recognized"
+ sys.exit(2)
+for o, a in opts:
+ if o == "-o":
+ outfile = a
+
+merged = dict()
+for f in args:
+ if not os.path.exists(f):
+ print "WARN: %s does not exist", f
+
+ fp = open(f, "r")
+ d = json.load(fp)
+ fp.close()
+
+ for key in d:
+ print key,
+ if merged.has_key(key):
+ print "WARNING: merged already has key", key
+ merged[key].update(d[key])
+ else:
+ merged[key] = d[key]
+
+ print merged
+ print
+
+fp = open(outfile, "w")
+json.dump(merged, fp, indent=4, sort_keys=True)
+fp.close()
diff --git a/doc/resources.json b/doc/resources.json
new file mode 100644
index 0000000..11142c9
--- /dev/null
+++ b/doc/resources.json
@@ -0,0 +1,11 @@
+{
+ "resources" : {
+ "m0" : { "type" : "mutex" },
+ "sync_mutex" : { "type" : "mutex" },
+ "wait" : { "type" : "wait" },
+ "trig" : { "type" : "signal", "target" : "wait" },
+ "m1" : { "type" : "mutex" },
+ "wake" : { "type" : "wait" },
+ "broad" : { "type" : "broadcast", "target" : "wake" }
+ }
+}
diff --git a/doc/thread0.json b/doc/thread0.json
new file mode 100644
index 0000000..e845e18
--- /dev/null
+++ b/doc/thread0.json
@@ -0,0 +1,15 @@
+{
+ "tasks" : {
+ "thread0" : {
+ "exec" : 5000,
+ "period" : 5000,
+ "deadline" : 5000,
+ "lock_order" : ["wait", "m0", "broad"],
+ "resources" : {
+ "m0" : { "duration" : 1000 },
+ "wait" : { "duration" : 0, "access": ["sync_mutex"] },
+ "broad" : { "duration" : 0, "access": ["m1"] }
+ }
+ }
+ }
+}
diff --git a/doc/thread1.json b/doc/thread1.json
new file mode 100644
index 0000000..37fea77
--- /dev/null
+++ b/doc/thread1.json
@@ -0,0 +1,14 @@
+{
+ "tasks" : {
+ "thread1" : {
+ "exec" : 1000,
+ "period" : 10000,
+ "deadline" : 8000,
+ "lock_order" : ["m0", "trig"],
+ "resources" : {
+ "m0" : { "duration" : 500 },
+ "trig" : { "duration" : 0, "access": ["sync_mutex"] }
+ }
+ }
+ }
+}
diff --git a/doc/thread2.json b/doc/thread2.json
new file mode 100644
index 0000000..024cefa
--- /dev/null
+++ b/doc/thread2.json
@@ -0,0 +1,13 @@
+{
+ "tasks" : {
+ "thread2" : {
+ "exec" : 1000,
+ "period" : 1000,
+ "deadline" : 1000,
+ "lock_order" : ["wake"],
+ "resources" : {
+ "wake" : { "duration" : 0, "access": ["m1"] }
+ }
+ }
+ }
+}
diff --git a/doc/thread3.json b/doc/thread3.json
new file mode 100644
index 0000000..98a07eb
--- /dev/null
+++ b/doc/thread3.json
@@ -0,0 +1,13 @@
+{
+ "tasks" : {
+ "thread3" : {
+ "exec" : 1000,
+ "period" : 1000,
+ "deadline" : 1000,
+ "lock_order" : ["wake"],
+ "resources" : {
+ "wake" : { "duration" : 0, "access": ["m1"] }
+ }
+ }
+ }
+}