summaryrefslogtreecommitdiffstats
path: root/fluent-bit/tests/internal/data/pack/utf8_gen.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--fluent-bit/tests/internal/data/pack/utf8_gen.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/fluent-bit/tests/internal/data/pack/utf8_gen.py b/fluent-bit/tests/internal/data/pack/utf8_gen.py
new file mode 100644
index 00000000..606e8cc2
--- /dev/null
+++ b/fluent-bit/tests/internal/data/pack/utf8_gen.py
@@ -0,0 +1,32 @@
+# Fluent Bit / Pack utf-8 samples to JSON
+# =======================================
+
+import os
+import json
+import msgpack
+
+def gen_json(f):
+
+ print f
+
+ with io.open(f, 'rb') as raw:
+ data = raw.read()
+
+ out_mp = f[:-4] + ".mp"
+ out_json = f[:-4] + ".json"
+
+ # Write messagepack
+ fmp = open(out_mp, 'w')
+ fmp.write(msgpack.packb(data))
+ fmp.close()
+
+ fjson = open(out_json, 'w')
+ fjson.write(json.dumps(data).encode('utf8'))
+ fjson.close()
+
+for fn in os.listdir('.'):
+ if not os.path.isfile(fn):
+ continue
+
+ if fn.startswith('utf8_') and fn.endswith('.txt'):
+ gen_json(fn)