All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] runner: Ensure generated json is properly UTF8-encoded
@ 2019-12-05 13:02 Petri Latvala
  2019-12-05 13:02 ` [igt-dev] [PATCH i-g-t 2/2] runner/json_tests: Test handling of unprintable output from tests Petri Latvala
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Petri Latvala @ 2019-12-05 13:02 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Sometimes tests output garbage (e.g. due to extreme occurrences of
https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/55) but we
need to present the garbage as results.

We already ignore any test output after the first \0, and for the rest
of the bytes that are not directly UTF-8 as-is, we can quite easily
represent them with two-byte UTF-8 encoding.

libjson-c already expects the string you feed it through
json_object_new_string* functions to be UTF-8.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 53 ++++++++++++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index aa438000..92030431 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -365,6 +365,33 @@ static void free_matches(struct matches *matches)
 	free(matches->items);
 }
 
+static struct json_object *new_escaped_json_string(const char *buf, size_t len)
+{
+	struct json_object *obj;
+	char *str = NULL;
+	size_t strsize = 0;
+	size_t i;
+
+	for (i = 0; i < len; i++) {
+		if (buf[i] > 0 && buf[i] < 128) {
+			str = realloc(str, strsize + 1);
+			str[strsize] = buf[i];
+			++strsize;
+		} else {
+			/* Encode > 128 character to UTF-8. */
+			str = realloc(str, strsize + 2);
+			str[strsize] = ((unsigned char)buf[i] >> 6) | 0xC0;
+			str[strsize + 1] = ((unsigned char)buf[i] & 0x3F) | 0x80;
+			strsize += 2;
+		}
+	}
+
+	obj = json_object_new_string_len(str, strsize);
+	free(str);
+
+	return obj;
+}
+
 static bool fill_from_output(int fd, const char *binary, const char *key,
 			     struct subtest_list *subtests,
 			     struct json_object *tests)
@@ -419,11 +446,11 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 		current_test = get_or_create_json_object(tests, piglit_name);
 
 		json_object_object_add(current_test, key,
-				       json_object_new_string_len(buf, statbuf.st_size));
+				       new_escaped_json_string(buf, statbuf.st_size));
 		if (igt_version)
 			json_object_object_add(current_test, "igt-version",
-					       json_object_new_string_len(igt_version,
-									  igt_version_len));
+					       new_escaped_json_string(igt_version,
+								       igt_version_len));
 
 		return true;
 	}
@@ -520,12 +547,12 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 		}
 
 		json_object_object_add(current_test, key,
-				       json_object_new_string_len(beg, end - beg));
+				       new_escaped_json_string(beg, end - beg));
 
 		if (igt_version) {
 			json_object_object_add(current_test, "igt-version",
-					       json_object_new_string_len(igt_version,
-									  igt_version_len));
+					       new_escaped_json_string(igt_version,
+								       igt_version_len));
 		}
 
 		if (!json_object_object_get_ex(current_test, "result", NULL)) {
@@ -607,11 +634,11 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 				current_dynamic_test = get_or_create_json_object(tests, dynamic_piglit_name);
 
 				json_object_object_add(current_dynamic_test, key,
-						       json_object_new_string_len(dynbeg, dynend - dynbeg));
+						       new_escaped_json_string(dynbeg, dynend - dynbeg));
 				if (igt_version)
 					json_object_object_add(current_dynamic_test, "igt-version",
-							       json_object_new_string_len(igt_version,
-											  igt_version_len));
+							       new_escaped_json_string(igt_version,
+										       igt_version_len));
 
 				if (!json_object_object_get_ex(current_dynamic_test, "result", NULL)) {
 					const char *dynresulttext;
@@ -764,11 +791,11 @@ static void add_dmesg(struct json_object *obj,
 		      const char *warnings, size_t warningslen)
 {
 	json_object_object_add(obj, "dmesg",
-			       json_object_new_string_len(dmesg, dmesglen));
+			       new_escaped_json_string(dmesg, dmesglen));
 
 	if (warnings) {
 		json_object_object_add(obj, "dmesg-warnings",
-				       json_object_new_string_len(warnings, warningslen));
+				       new_escaped_json_string(warnings, warningslen));
 	}
 }
 
@@ -1361,7 +1388,7 @@ struct json_object *generate_results_json(int dirfd)
 			r--;
 
 		json_object_object_add(obj, "uname",
-				       json_object_new_string_len(buf, r));
+				       new_escaped_json_string(buf, r));
 		close(fd);
 	}
 
@@ -1424,7 +1451,7 @@ struct json_object *generate_results_json(int dirfd)
 		s = read(fd, buf, sizeof(buf));
 
 		json_object_object_add(aborttest, "out",
-				       json_object_new_string_len(buf, s));
+				       new_escaped_json_string(buf, s));
 		json_object_object_add(aborttest, "err",
 				       json_object_new_string(""));
 		json_object_object_add(aborttest, "dmesg",
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [igt-dev] [PATCH i-g-t 2/2] runner/json_tests: Test handling of unprintable output from tests
  2019-12-05 13:02 [igt-dev] [PATCH i-g-t 1/2] runner: Ensure generated json is properly UTF8-encoded Petri Latvala
@ 2019-12-05 13:02 ` Petri Latvala
  2019-12-11  8:10 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded Patchwork
  2020-01-10 11:18 ` [igt-dev] [PATCH i-g-t 1/2] " Arkadiusz Hiler
  2 siblings, 0 replies; 5+ messages in thread
From: Petri Latvala @ 2019-12-05 13:02 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 16639 bytes --]

A simple test output with numbers from 1 to 255, both in plain text
form and as a single byte with that particular value.

Note that the json spec doesn't require \u-encoding for characters
other than '"', '\' and the range U+0000 to U+001F, the raw
non-\u-encoded UTF-8 in the reference.json file for bytes 128 and up
is what libjson-c outputs for those codepoints and is valid.

The validity of the json file can be verified with iconv, i.e.

 $ iconv -f UTF-8 reference.json -o /dev/null && echo it is utf-8

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 .../unprintable-characters/0/dmesg.txt        |   5 +
 .../unprintable-characters/0/err.txt          | 258 +++++++++++++++++
 .../unprintable-characters/0/journal.txt      |   2 +
 .../unprintable-characters/0/out.txt          | 259 ++++++++++++++++++
 .../unprintable-characters/README.txt         |   2 +
 .../unprintable-characters/endtime.txt        |   1 +
 .../unprintable-characters/joblist.txt        |   1 +
 .../unprintable-characters/metadata.txt       |  12 +
 .../unprintable-characters/reference.json     |  72 +++++
 .../unprintable-characters/starttime.txt      |   1 +
 .../unprintable-characters/uname.txt          |   1 +
 runner/runner_json_tests.c                    |   1 +
 12 files changed, 615 insertions(+)
 create mode 100644 runner/json_tests_data/unprintable-characters/0/dmesg.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/0/err.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/0/journal.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/0/out.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/README.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/endtime.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/joblist.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/metadata.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/reference.json
 create mode 100644 runner/json_tests_data/unprintable-characters/starttime.txt
 create mode 100644 runner/json_tests_data/unprintable-characters/uname.txt

diff --git a/runner/json_tests_data/unprintable-characters/0/dmesg.txt b/runner/json_tests_data/unprintable-characters/0/dmesg.txt
new file mode 100644
index 00000000..6aac2735
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/0/dmesg.txt
@@ -0,0 +1,5 @@
+6,951,3216186095083,-;Console: switching to colour dummy device 80x25
+14,952,3216186095097,-;[IGT] successtest: executing
+14,953,3216186101115,-;[IGT] successtest: starting subtest first-subtest
+14,955,3216186101160,-;[IGT] successtest: exiting, ret=0
+6,956,3216186101299,-;Console: switching to colour frame buffer device 240x75
diff --git a/runner/json_tests_data/unprintable-characters/0/err.txt b/runner/json_tests_data/unprintable-characters/0/err.txt
new file mode 100644
index 00000000..34d19985
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/0/err.txt
@@ -0,0 +1,258 @@
+Starting subtest: first-subtest
+1:\x01
+2:\x02
+3:\x03
+4:\x04
+5:\x05
+6:\x06
+7:\a
+8:\b
+9:	
+10:
+
+11:\v
+12:\f
+13:
+14:\x0e
+15:\x0f
+16:\x10
+17:\x11
+18:\x12
+19:\x13
+20:\x14
+21:\x15
+22:\x16
+23:\x17
+24:\x18
+25:\x19
+26:\x1a
+27:^[
+28:\x1c
+29:\x1d
+30:\x1e
+31:\x1f
+32: 
+33:!
+34:"
+35:#
+36:$
+37:%
+38:&
+39:'
+40:(
+41:)
+42:*
+43:+
+44:,
+45:-
+46:.
+47:/
+48:0
+49:1
+50:2
+51:3
+52:4
+53:5
+54:6
+55:7
+56:8
+57:9
+58::
+59:;
+60:<
+61:=
+62:>
+63:?
+64:@
+65:A
+66:B
+67:C
+68:D
+69:E
+70:F
+71:G
+72:H
+73:I
+74:J
+75:K
+76:L
+77:M
+78:N
+79:O
+80:P
+81:Q
+82:R
+83:S
+84:T
+85:U
+86:V
+87:W
+88:X
+89:Y
+90:Z
+91:[
+92:\
+93:]
+94:^
+95:_
+96:`
+97:a
+98:b
+99:c
+100:d
+101:e
+102:f
+103:g
+104:h
+105:i
+106:j
+107:k
+108:l
+109:m
+110:n
+111:o
+112:p
+113:q
+114:r
+115:s
+116:t
+117:u
+118:v
+119:w
+120:x
+121:y
+122:z
+123:{
+124:|
+125:}
+126:~
+127:\x7f
+128:€
+129:
+130:‚
+131:ƒ
+132:„
+133:…
+134:†
+135:‡
+136:ˆ
+137:‰
+138:Š
+139:‹
+140:Œ
+141:
+142:Ž
+143:
+144:
+145:‘
+146:’
+147:“
+148:”
+149:•
+150:–
+151:—
+152:˜
+153:™
+154:š
+155:›
+156:œ
+157:
+158:ž
+159:Ÿ
+160: 
+161:¡
+162:¢
+163:£
+164:¤
+165:¥
+166:¦
+167:§
+168:¨
+169:©
+170:ª
+171:«
+172:¬
+173:­
+174:®
+175:¯
+176:°
+177:±
+178:²
+179:³
+180:´
+181:µ
+182:¶
+183:·
+184:¸
+185:¹
+186:º
+187:»
+188:¼
+189:½
+190:¾
+191:¿
+192:À
+193:Á
+194:Â
+195:Ã
+196:Ä
+197:Å
+198:Æ
+199:Ç
+200:È
+201:É
+202:Ê
+203:Ë
+204:Ì
+205:Í
+206:Î
+207:Ï
+208:Ð
+209:Ñ
+210:Ò
+211:Ó
+212:Ô
+213:Õ
+214:Ö
+215:×
+216:Ø
+217:Ù
+218:Ú
+219:Û
+220:Ü
+221:Ý
+222:Þ
+223:ß
+224:à
+225:á
+226:â
+227:ã
+228:ä
+229:å
+230:æ
+231:ç
+232:è
+233:é
+234:ê
+235:ë
+236:ì
+237:í
+238:î
+239:ï
+240:ð
+241:ñ
+242:ò
+243:ó
+244:ô
+245:õ
+246:ö
+247:÷
+248:ø
+249:ù
+250:ú
+251:û
+252:ü
+253:ý
+254:þ
+255:ÿ
+Subtest first-subtest: SUCCESS (0.000s)
diff --git a/runner/json_tests_data/unprintable-characters/0/journal.txt b/runner/json_tests_data/unprintable-characters/0/journal.txt
new file mode 100644
index 00000000..86a30e07
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/0/journal.txt
@@ -0,0 +1,2 @@
+first-subtest
+exit:0 (0.014s)
diff --git a/runner/json_tests_data/unprintable-characters/0/out.txt b/runner/json_tests_data/unprintable-characters/0/out.txt
new file mode 100644
index 00000000..c597674a
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/0/out.txt
@@ -0,0 +1,259 @@
+IGT-Version: 1.23-g0c763bfd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)
+Starting subtest: first-subtest
+1:\x01
+2:\x02
+3:\x03
+4:\x04
+5:\x05
+6:\x06
+7:\a
+8:\b
+9:	
+10:
+
+11:\v
+12:\f
+13:
+14:\x0e
+15:\x0f
+16:\x10
+17:\x11
+18:\x12
+19:\x13
+20:\x14
+21:\x15
+22:\x16
+23:\x17
+24:\x18
+25:\x19
+26:\x1a
+27:^[
+28:\x1c
+29:\x1d
+30:\x1e
+31:\x1f
+32: 
+33:!
+34:"
+35:#
+36:$
+37:%
+38:&
+39:'
+40:(
+41:)
+42:*
+43:+
+44:,
+45:-
+46:.
+47:/
+48:0
+49:1
+50:2
+51:3
+52:4
+53:5
+54:6
+55:7
+56:8
+57:9
+58::
+59:;
+60:<
+61:=
+62:>
+63:?
+64:@
+65:A
+66:B
+67:C
+68:D
+69:E
+70:F
+71:G
+72:H
+73:I
+74:J
+75:K
+76:L
+77:M
+78:N
+79:O
+80:P
+81:Q
+82:R
+83:S
+84:T
+85:U
+86:V
+87:W
+88:X
+89:Y
+90:Z
+91:[
+92:\
+93:]
+94:^
+95:_
+96:`
+97:a
+98:b
+99:c
+100:d
+101:e
+102:f
+103:g
+104:h
+105:i
+106:j
+107:k
+108:l
+109:m
+110:n
+111:o
+112:p
+113:q
+114:r
+115:s
+116:t
+117:u
+118:v
+119:w
+120:x
+121:y
+122:z
+123:{
+124:|
+125:}
+126:~
+127:\x7f
+128:€
+129:
+130:‚
+131:ƒ
+132:„
+133:…
+134:†
+135:‡
+136:ˆ
+137:‰
+138:Š
+139:‹
+140:Œ
+141:
+142:Ž
+143:
+144:
+145:‘
+146:’
+147:“
+148:”
+149:•
+150:–
+151:—
+152:˜
+153:™
+154:š
+155:›
+156:œ
+157:
+158:ž
+159:Ÿ
+160: 
+161:¡
+162:¢
+163:£
+164:¤
+165:¥
+166:¦
+167:§
+168:¨
+169:©
+170:ª
+171:«
+172:¬
+173:­
+174:®
+175:¯
+176:°
+177:±
+178:²
+179:³
+180:´
+181:µ
+182:¶
+183:·
+184:¸
+185:¹
+186:º
+187:»
+188:¼
+189:½
+190:¾
+191:¿
+192:À
+193:Á
+194:Â
+195:Ã
+196:Ä
+197:Å
+198:Æ
+199:Ç
+200:È
+201:É
+202:Ê
+203:Ë
+204:Ì
+205:Í
+206:Î
+207:Ï
+208:Ð
+209:Ñ
+210:Ò
+211:Ó
+212:Ô
+213:Õ
+214:Ö
+215:×
+216:Ø
+217:Ù
+218:Ú
+219:Û
+220:Ü
+221:Ý
+222:Þ
+223:ß
+224:à
+225:á
+226:â
+227:ã
+228:ä
+229:å
+230:æ
+231:ç
+232:è
+233:é
+234:ê
+235:ë
+236:ì
+237:í
+238:î
+239:ï
+240:ð
+241:ñ
+242:ò
+243:ó
+244:ô
+245:õ
+246:ö
+247:÷
+248:ø
+249:ù
+250:ú
+251:û
+252:ü
+253:ý
+254:þ
+255:ÿ
+Subtest first-subtest: SUCCESS (0.000s)
diff --git a/runner/json_tests_data/unprintable-characters/README.txt b/runner/json_tests_data/unprintable-characters/README.txt
new file mode 100644
index 00000000..046605ea
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/README.txt
@@ -0,0 +1,2 @@
+Any nonprintable output in stdout and stderr should yield a json file
+that is still valid UTF-8.
diff --git a/runner/json_tests_data/unprintable-characters/endtime.txt b/runner/json_tests_data/unprintable-characters/endtime.txt
new file mode 100644
index 00000000..635f6ae9
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/endtime.txt
@@ -0,0 +1 @@
+1539953735.172373
diff --git a/runner/json_tests_data/unprintable-characters/joblist.txt b/runner/json_tests_data/unprintable-characters/joblist.txt
new file mode 100644
index 00000000..81f914a7
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/joblist.txt
@@ -0,0 +1 @@
+successtest first-subtest
diff --git a/runner/json_tests_data/unprintable-characters/metadata.txt b/runner/json_tests_data/unprintable-characters/metadata.txt
new file mode 100644
index 00000000..c501ae0e
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/metadata.txt
@@ -0,0 +1,12 @@
+abort_mask : 0
+name : normal-run
+dry_run : 0
+sync : 0
+log_level : 0
+overwrite : 0
+multiple_mode : 0
+inactivity_timeout : 0
+use_watchdog : 0
+piglit_style_dmesg : 0
+test_root : /path/does/not/exist
+results_path : /path/does/not/exist
diff --git a/runner/json_tests_data/unprintable-characters/reference.json b/runner/json_tests_data/unprintable-characters/reference.json
new file mode 100644
index 00000000..d3add1eb
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/reference.json
@@ -0,0 +1,72 @@
+{
+  "__type__":"TestrunResult",
+  "results_version":10,
+  "name":"normal-run",
+  "uname":"Linux hostname 4.18.0-1-amd64 #1 SMP Debian 4.18.6-1 (2018-09-06) x86_64",
+  "time_elapsed":{
+    "__type__":"TimeAttribute",
+    "start":1539953735.1110389,
+    "end":1539953735.1723731
+  },
+  "tests":{
+    "igt@successtest@first-subtest":{
+      "out":"IGT-Version: 1.23-g0c763bfd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: first-subtest\n1:\u0001\n2:\u0002\n3:\u0003\n4:\u0004\n5:\u0005\n6:\u0006\n7:\u0007\n8:\b\n9:\t\n10:\n\n11:\u000b\n12:\f\n13:\r\n14:\u000e\n15:\u000f\n16:\u0010\n17:\u0011\n18:\u0012\n19:\u0013\n20:\u0014\n21:\u0015\n22:\u0016\n23:\u0017\n24:\u0018\n25:\u0019\n26:\u001a\n27:\u001b\n28:\u001c\n29:\u001d\n30:\u001e\n31:\u001f\n32: \n33:!\n34:\"\n35:#\n36:$\n37:%\n38:&\n39:'\n40:(\n41:)\n42:*\n43:+\n44:,\n45:-\n46:.\n47:\/\n48:0\n49:1\n50:2\n51:3\n52:4\n53:5\n54:6\n55:7\n56:8\n57:9\n58::\n59:;\n60:<\n61:=\n62:>\n63:?\n64:@\n65:A\n66:B\n67:C\n68:D\n69:E\n70:F\n71:G\n72:H\n73:I\n74:J\n75:K\n76:L\n77:M\n78:N\n79:O\n80:P\n81:Q\n82:R\n83:S\n84:T\n85:U\n86:V\n87:W\n88:X\n89:Y\n90:Z\n91:[\n92:\\\n93:]\n94:^\n95:_\n96:`\n97:a\n98:b\n99:c\n100:d\n101:e\n102:f\n103:g\n104:h\n105:i\n106:j\n107:k\n108:l\n109:m\n110:n\n111:o\n112:p\n113:q\n114:r\n115:s\n116:t\n117:u\n118:v\n119:w\n120:x\n121:y\n122:z\n123:{\n124:|\n125:}\n126:~\n127:\x7f\n128:€\n129:\n130:‚\n131:ƒ\n132:„\n133:…\n134:†\n135:‡\n136:ˆ\n137:‰\n138:Š\n139:‹\n140:Œ\n141:\n142:Ž\n143:\n144:\n145:‘\n146:’\n147:“\n148:”\n149:•\n150:–\n151:—\n152:˜\n153:™\n154:š\n155:›\n156:œ\n157:\n158:ž\n159:Ÿ\n160: \n161:¡\n162:¢\n163:£\n164:¤\n165:¥\n166:¦\n167:§\n168:¨\n169:©\n170:ª\n171:«\n172:¬\n173:­\n174:®\n175:¯\n176:°\n177:±\n178:²\n179:³\n180:´\n181:µ\n182:¶\n183:·\n184:¸\n185:¹\n186:º\n187:»\n188:¼\n189:½\n190:¾\n191:¿\n192:À\n193:Á\n194:Â\n195:Ã\n196:Ä\n197:Å\n198:Æ\n199:Ç\n200:È\n201:É\n202:Ê\n203:Ë\n204:Ì\n205:Í\n206:Î\n207:Ï\n208:Ð\n209:Ñ\n210:Ò\n211:Ó\n212:Ô\n213:Õ\n214:Ö\n215:×\n216:Ø\n217:Ù\n218:Ú\n219:Û\n220:Ü\n221:Ý\n222:Þ\n223:ß\n224:à\n225:á\n226:â\n227:ã\n228:ä\n229:å\n230:æ\n231:ç\n232:è\n233:é\n234:ê\n235:ë\n236:ì\n237:í\n238:î\n239:ï\n240:ð\n241:ñ\n242:ò\n243:ó\n244:ô\n245:õ\n246:ö\n247:÷\n248:ø\n249:ù\n250:ú\n251:û\n252:ü\n253:ý\n254:þ\n255:ÿ\nSubtest first-subtest: SUCCESS (0.000s)\n",
+      "igt-version":"IGT-Version: 1.23-g0c763bfd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
+      "result":"warn",
+      "time":{
+        "__type__":"TimeAttribute",
+        "start":0,
+        "end":0
+      },
+      "err":"Starting subtest: first-subtest\n1:\u0001\n2:\u0002\n3:\u0003\n4:\u0004\n5:\u0005\n6:\u0006\n7:\u0007\n8:\b\n9:\t\n10:\n\n11:\u000b\n12:\f\n13:\r\n14:\u000e\n15:\u000f\n16:\u0010\n17:\u0011\n18:\u0012\n19:\u0013\n20:\u0014\n21:\u0015\n22:\u0016\n23:\u0017\n24:\u0018\n25:\u0019\n26:\u001a\n27:\u001b\n28:\u001c\n29:\u001d\n30:\u001e\n31:\u001f\n32: \n33:!\n34:\"\n35:#\n36:$\n37:%\n38:&\n39:'\n40:(\n41:)\n42:*\n43:+\n44:,\n45:-\n46:.\n47:\/\n48:0\n49:1\n50:2\n51:3\n52:4\n53:5\n54:6\n55:7\n56:8\n57:9\n58::\n59:;\n60:<\n61:=\n62:>\n63:?\n64:@\n65:A\n66:B\n67:C\n68:D\n69:E\n70:F\n71:G\n72:H\n73:I\n74:J\n75:K\n76:L\n77:M\n78:N\n79:O\n80:P\n81:Q\n82:R\n83:S\n84:T\n85:U\n86:V\n87:W\n88:X\n89:Y\n90:Z\n91:[\n92:\\\n93:]\n94:^\n95:_\n96:`\n97:a\n98:b\n99:c\n100:d\n101:e\n102:f\n103:g\n104:h\n105:i\n106:j\n107:k\n108:l\n109:m\n110:n\n111:o\n112:p\n113:q\n114:r\n115:s\n116:t\n117:u\n118:v\n119:w\n120:x\n121:y\n122:z\n123:{\n124:|\n125:}\n126:~\n127:\x7f\n128:€\n129:\n130:‚\n131:ƒ\n132:„\n133:…\n134:†\n135:‡\n136:ˆ\n137:‰\n138:Š\n139:‹\n140:Œ\n141:\n142:Ž\n143:\n144:\n145:‘\n146:’\n147:“\n148:”\n149:•\n150:–\n151:—\n152:˜\n153:™\n154:š\n155:›\n156:œ\n157:\n158:ž\n159:Ÿ\n160: \n161:¡\n162:¢\n163:£\n164:¤\n165:¥\n166:¦\n167:§\n168:¨\n169:©\n170:ª\n171:«\n172:¬\n173:­\n174:®\n175:¯\n176:°\n177:±\n178:²\n179:³\n180:´\n181:µ\n182:¶\n183:·\n184:¸\n185:¹\n186:º\n187:»\n188:¼\n189:½\n190:¾\n191:¿\n192:À\n193:Á\n194:Â\n195:Ã\n196:Ä\n197:Å\n198:Æ\n199:Ç\n200:È\n201:É\n202:Ê\n203:Ë\n204:Ì\n205:Í\n206:Î\n207:Ï\n208:Ð\n209:Ñ\n210:Ò\n211:Ó\n212:Ô\n213:Õ\n214:Ö\n215:×\n216:Ø\n217:Ù\n218:Ú\n219:Û\n220:Ü\n221:Ý\n222:Þ\n223:ß\n224:à\n225:á\n226:â\n227:ã\n228:ä\n229:å\n230:æ\n231:ç\n232:è\n233:é\n234:ê\n235:ë\n236:ì\n237:í\n238:î\n239:ï\n240:ð\n241:ñ\n242:ò\n243:ó\n244:ô\n245:õ\n246:ö\n247:÷\n248:ø\n249:ù\n250:ú\n251:û\n252:ü\n253:ý\n254:þ\n255:ÿ\nSubtest first-subtest: SUCCESS (0.000s)\n",
+      "dmesg":"<6> [3216186.095083] Console: switching to colour dummy device 80x25\n<6> [3216186.095097] [IGT] successtest: executing\n<6> [3216186.101115] [IGT] successtest: starting subtest first-subtest\n<6> [3216186.101160] [IGT] successtest: exiting, ret=0\n<6> [3216186.101299] Console: switching to colour frame buffer device 240x75\n"
+    }
+  },
+  "totals":{
+    "":{
+      "crash":0,
+      "pass":0,
+      "dmesg-fail":0,
+      "dmesg-warn":0,
+      "skip":0,
+      "incomplete":0,
+      "timeout":0,
+      "notrun":0,
+      "fail":0,
+      "warn":1
+    },
+    "root":{
+      "crash":0,
+      "pass":0,
+      "dmesg-fail":0,
+      "dmesg-warn":0,
+      "skip":0,
+      "incomplete":0,
+      "timeout":0,
+      "notrun":0,
+      "fail":0,
+      "warn":1
+    },
+    "igt@successtest":{
+      "crash":0,
+      "pass":0,
+      "dmesg-fail":0,
+      "dmesg-warn":0,
+      "skip":0,
+      "incomplete":0,
+      "timeout":0,
+      "notrun":0,
+      "fail":0,
+      "warn":1
+    }
+  },
+  "runtimes":{
+    "igt@successtest":{
+      "time":{
+        "__type__":"TimeAttribute",
+        "start":0,
+        "end":0.014
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/runner/json_tests_data/unprintable-characters/starttime.txt b/runner/json_tests_data/unprintable-characters/starttime.txt
new file mode 100644
index 00000000..ae038f18
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/starttime.txt
@@ -0,0 +1 @@
+1539953735.111039
diff --git a/runner/json_tests_data/unprintable-characters/uname.txt b/runner/json_tests_data/unprintable-characters/uname.txt
new file mode 100644
index 00000000..a7aef6f7
--- /dev/null
+++ b/runner/json_tests_data/unprintable-characters/uname.txt
@@ -0,0 +1 @@
+Linux hostname 4.18.0-1-amd64 #1 SMP Debian 4.18.6-1 (2018-09-06) x86_64
diff --git a/runner/runner_json_tests.c b/runner/runner_json_tests.c
index 3443bd2b..1d2fc3eb 100644
--- a/runner/runner_json_tests.c
+++ b/runner/runner_json_tests.c
@@ -163,6 +163,7 @@ static const char *dirnames[] = {
 	"dmesg-warn-level-piglit-style",
 	"dmesg-warn-level-one-piglit-style",
 	"dynamic-subtests",
+	"unprintable-characters",
 };
 
 igt_main
-- 
2.19.1


[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded
  2019-12-05 13:02 [igt-dev] [PATCH i-g-t 1/2] runner: Ensure generated json is properly UTF8-encoded Petri Latvala
  2019-12-05 13:02 ` [igt-dev] [PATCH i-g-t 2/2] runner/json_tests: Test handling of unprintable output from tests Petri Latvala
@ 2019-12-11  8:10 ` Patchwork
  2019-12-16 13:26   ` Petri Latvala
  2020-01-10 11:18 ` [igt-dev] [PATCH i-g-t 1/2] " Arkadiusz Hiler
  2 siblings, 1 reply; 5+ messages in thread
From: Patchwork @ 2019-12-11  8:10 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded
URL   : https://patchwork.freedesktop.org/series/70492/
State : warning

== Summary ==

Did not get list of undocumented tests for this run, something is wrong!

Other than that, pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/87140 for the overview.

test:ninja-test has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1105688):
  (runner_json_test:2389) igt_core-INFO:   #3 ../runner/runner_json_tests.c:40 compare()
  (runner_json_test:2389) igt_core-INFO:   #4 ../runner/runner_json_tests.c:40 compare()
  (runner_json_test:2389) igt_core-INFO:   #5 ../runner/runner_json_tests.c:146 __real_main169()
  (runner_json_test:2389) igt_core-INFO:   #6 ../runner/runner_json_tests.c:169 main()
  (runner_json_test:2389) igt_core-INFO:   #7 [__libc_start_main+0xf3]
  (runner_json_test:2389) igt_core-INFO:   #8 [_start+0x2e]
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1575988880:build_script
  ^[[0Ksection_start:1575988880:after_script
  ^[[0Ksection_end:1575988881:after_script
  ^[[0Ksection_start:1575988881:upload_artifacts_on_failure
  ^[[0Ksection_end:1575988883:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1105689):
  (runner_json_test:2390) igt_core-INFO:   #2 [compare+0x249]
  (runner_json_test:2390) igt_core-INFO:   #3 [compare+0x249]
  (runner_json_test:2390) igt_core-INFO:   #4 [__real_main169+0x154]
  (runner_json_test:2390) igt_core-INFO:   #5 [main+0x29]
  (runner_json_test:2390) igt_core-INFO:   #6 [__libc_start_main+0xf3]
  (runner_json_test:2390) igt_core-INFO:   #7 [_start+0x2e]
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1575988880:build_script
  ^[[0Ksection_start:1575988880:after_script
  ^[[0Ksection_end:1575988881:after_script
  ^[[0Ksection_start:1575988881:upload_artifacts_on_failure
  ^[[0Ksection_end:1575988883:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1105691):
  (runner_json_test:5093) igt_core-INFO:   #6 ../runner/runner_json_tests.c:169 main()
  (runner_json_test:5093) igt_core-INFO:   #7 [__libc_start_main+0xe4]
  (runner_json_test:5093) igt_core-INFO:   #8 [_start+0x34]
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1575988868:build_script
  ^[[0Ksection_start:1575988868:after_script
  ^[[0Ksection_end:1575988869:after_script
  ^[[0Ksection_start:1575988869:upload_artifacts_on_failure
  ^[[0K^[[32;1mUploading artifacts...^[[0;m
  build: found 1367 matching files                  ^[[0;m 
  Uploading artifacts to coordinator... ok          ^[[0;m  id^[[0;m=1105691 responseStatus^[[0;m=201 Created token^[[0;m=6daYJK9Q
  section_end:1575988881:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1105692):
  (runner_json_test:4467) igt_core-INFO:   #6 ../runner/runner_json_tests.c:169 main()
  (runner_json_test:4467) igt_core-INFO:   #7 [__libc_start_main+0x98]
  (runner_json_test:4467) igt_core-INFO:   #8 [_start+0x34]
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1575988876:build_script
  ^[[0Ksection_start:1575988876:after_script
  ^[[0Ksection_end:1575988878:after_script
  ^[[0Ksection_start:1575988878:upload_artifacts_on_failure
  ^[[0K^[[32;1mUploading artifacts...^[[0;m
  build: found 1366 matching files                  ^[[0;m 
  Uploading artifacts to coordinator... ok          ^[[0;m  id^[[0;m=1105692 responseStatus^[[0;m=201 Created token^[[0;m=Ry_5mmhn
  section_end:1575988888:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

test:ninja-test-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/1105693):
  (runner_json_test:4924) CRITICAL: Test assertion failure function compare, file ../runner/runner_json_tests.c:109:
  (runner_json_test:4924) CRITICAL: Failed assertion: !strcmp(json_object_get_string(one), json_object_get_string(two))
  (runner_json_test:4924) igt_core-INFO: Stack trace:
  ****  END  ****
  -------
  
  Full log written to /builds/gfx-ci/igt-ci-tags/build/meson-logs/testlog.txt
  FAILED: meson-test 
  /usr/bin/meson test --no-rebuild --print-errorlogs
  ninja: build stopped: subcommand failed.
  section_end:1575988880:build_script
  ^[[0Ksection_start:1575988880:after_script
  ^[[0Ksection_end:1575988881:after_script
  ^[[0Ksection_start:1575988881:upload_artifacts_on_failure
  ^[[0K^[[32;1mUploading artifacts...^[[0;m
  build: found 1366 matching files                  ^[[0;m 
  Uploading artifacts to coordinator... ok          ^[[0;m  id^[[0;m=1105693 responseStatus^[[0;m=201 Created token^[[0;m=sgwGgmK5
  section_end:1575988892:upload_artifacts_on_failure
  ^[[0K^[[31;1mERROR: Job failed: exit code 1
  ^[[0;m

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/87140
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded
  2019-12-11  8:10 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded Patchwork
@ 2019-12-16 13:26   ` Petri Latvala
  0 siblings, 0 replies; 5+ messages in thread
From: Petri Latvala @ 2019-12-16 13:26 UTC (permalink / raw)
  To: igt-dev

On Wed, Dec 11, 2019 at 08:10:39AM +0000, Patchwork wrote:
> == Series Details ==
> 
> Series: series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded
> URL   : https://patchwork.freedesktop.org/series/70492/
> State : warning
> 
> == Summary ==
> 
> Did not get list of undocumented tests for this run, something is wrong!
> 
> Other than that, pipeline status: FAILED.


Not completely surprisingly the fancy-characters patch doesn't survive
being sent by email. The series can be seen in
https://gitlab.freedesktop.org/adrinael/igt-gpu-tools/commits/unprintable
with the build-time tests passing.


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/2] runner: Ensure generated json is properly UTF8-encoded
  2019-12-05 13:02 [igt-dev] [PATCH i-g-t 1/2] runner: Ensure generated json is properly UTF8-encoded Petri Latvala
  2019-12-05 13:02 ` [igt-dev] [PATCH i-g-t 2/2] runner/json_tests: Test handling of unprintable output from tests Petri Latvala
  2019-12-11  8:10 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded Patchwork
@ 2020-01-10 11:18 ` Arkadiusz Hiler
  2 siblings, 0 replies; 5+ messages in thread
From: Arkadiusz Hiler @ 2020-01-10 11:18 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On Thu, Dec 05, 2019 at 03:02:45PM +0200, Petri Latvala wrote:
> Sometimes tests output garbage (e.g. due to extreme occurrences of
> https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/55) but we
> need to present the garbage as results.
> 
> We already ignore any test output after the first \0, and for the rest
> of the bytes that are not directly UTF-8 as-is, we can quite easily
> represent them with two-byte UTF-8 encoding.
> 
> libjson-c already expects the string you feed it through
> json_object_new_string* functions to be UTF-8.
> 
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

the series is:
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

Added this series as an example here:
https://gitlab.freedesktop.org/patchwork-fdo/patchwork-fdo/issues/34
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-10 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 13:02 [igt-dev] [PATCH i-g-t 1/2] runner: Ensure generated json is properly UTF8-encoded Petri Latvala
2019-12-05 13:02 ` [igt-dev] [PATCH i-g-t 2/2] runner/json_tests: Test handling of unprintable output from tests Petri Latvala
2019-12-11  8:10 ` [igt-dev] ✗ GitLab.Pipeline: warning for series starting with [i-g-t,1/2] runner: Ensure generated json is properly UTF8-encoded Patchwork
2019-12-16 13:26   ` Petri Latvala
2020-01-10 11:18 ` [igt-dev] [PATCH i-g-t 1/2] " Arkadiusz Hiler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.