Closed Bug 1673723 Opened 5 years ago Closed 5 years ago

Test marker schema from xpcshell tests

Categories

(Core :: Gecko Profiler, task, P2)

task

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: gregtatum, Assigned: gregtatum)

Details

Attachments

(1 file)

Moving markers definitions to where they are used means that it's harder
to unit test them from gtests. xpcshell tests have the benefits of exercising
the markers in a more realistic setting. However, we still need to test the
output of the schema. This patch adds a new capability to do a deep equality
check of the schema results. The utility function attempts to make the output
more readable by humans, and suggest how to fix errors. This will hopefully
make it easy for users to update and maintain their markers.

Example output:

pid:17610 -----------------------------------------------------
 0:00.69 pid:17610 The expected marker schema:
 0:00.69 pid:17610 -----------------------------------------------------
 0:00.69 pid:17610 {
 0:00.69 pid:17610   "name": "FileIO",
 0:00.69 pid:17610   "display": [
 0:00.69 pid:17610     "marker-chart",
 0:00.69 pid:17610     "marker-table",
 0:00.69 pid:17610     "timeline-fileio"
 0:00.69 pid:17610   ],
 0:00.69 pid:17610   "data": [
 0:00.69 pid:17610     {
 0:00.69 pid:17610       "key": "operation",
 0:00.69 pid:17610       "label": "Operation",
 0:00.69 pid:17610       "format": "number",
 0:00.69 pid:17610       "searchable": true
 0:00.69 pid:17610     },
 0:00.69 pid:17610     {
 0:00.69 pid:17610       "key": "source",
 0:00.69 pid:17610       "label": "Source",
 0:00.69 pid:17610       "format": "string",
 0:00.69 pid:17610       "searchable": true
 0:00.69 pid:17610     },
 0:00.69 pid:17610     {
 0:00.69 pid:17610       "key": "filename",
 0:00.69 pid:17610       "label": "Filename",
 0:00.69 pid:17610       "format": "file-path",
 0:00.69 pid:17610       "searchable": true
 0:00.69 pid:17610     }
 0:00.69 pid:17610   ]
 0:00.69 pid:17610 }
 0:00.69 pid:17610 -----------------------------------------------------
 0:00.69 pid:17610 The actual marker schema:
 0:00.69 pid:17610 -----------------------------------------------------
 0:00.69 pid:17610 {
 0:00.69 pid:17610   "name": "FileIO",
 0:00.69 pid:17610   "display": [
 0:00.69 pid:17610     "marker-chart",
 0:00.69 pid:17610     "marker-table",
 0:00.70 pid:17610     "timeline-fileio"
 0:00.70 pid:17610   ],
 0:00.70 pid:17610   "data": [
 0:00.70 pid:17610     {
 0:00.70 pid:17610       "key": "operation",
 0:00.70 pid:17610       "label": "Operation",
 0:00.70 pid:17610       "format": "string",
 0:00.70 pid:17610       "searchable": true
 0:00.70 pid:17610     },
 0:00.70 pid:17610     {
 0:00.70 pid:17610       "key": "source",
 0:00.70 pid:17610       "label": "Source",
 0:00.70 pid:17610       "format": "string",
 0:00.70 pid:17610       "searchable": true
 0:00.70 pid:17610     },
 0:00.70 pid:17610     {
 0:00.70 pid:17610       "key": "filename",
 0:00.70 pid:17610       "label": "Filename",
 0:00.70 pid:17610       "format": "file-path",
 0:00.70 pid:17610       "searchable": true
 0:00.70 pid:17610     }
 0:00.70 pid:17610   ]
 0:00.70 pid:17610 }
 0:00.70 pid:17610 -----------------------------------------------------
 0:00.70 pid:17610 A marker schema was not equal to expectations. If you
 0:00.70 pid:17610 are modifying the schema, then please copy and paste
 0:00.70 pid:17610 the new schema into this test.
 0:00.70 pid:17610 -----------------------------------------------------
 0:00.70 pid:17610 Copy this: {"name":"FileIO","display":["marker-chart","marker-table","timeline-fileio"],"data":[{"key":"operation","label":"Operation","format":"string","searchable":true},{"key":"source","label":"Source","format":"string","searchable":true},{"key":"filename","label":"Filename","format":"file-path","searchable":true}]}
 0:00.70 pid:17610 -----------------------------------------------------
 0:00.69 ERROR Unexpected exception NS_ERROR_ABORT: 
_abort_failed_test@/Users/greg/dev/platform-gecko2/testing/xpcshell/head.js:833:20
do_report_result@/Users/greg/dev/platform-gecko2/testing/xpcshell/head.js:934:5
Assert<@/Users/greg/dev/platform-gecko2/testing/xpcshell/head.js:73:21
proto.report@resource://testing-common/Assert.jsm:233:10
deepEqual@resource://testing-common/Assert.jsm:310:8
checkSchema@file:///Users/greg/dev/platform-gecko2/obj-ff-release/_tests/xpcshell/tools/profiler/tests/xpcshell/shared-head.js:241:18
@/Users/greg/dev/platform-gecko2/obj-ff-release/_tests/xpcshell/tools/profiler/tests/xpcshell/test_feature_mainthreadio.js:29:16
_do_main@/Users/greg/dev/platform-gecko2/testing/xpcshell/head.js:248:6
_execute_test@/Users/greg/dev/platform-gecko2/testing/xpcshell/head.js:577:5
@-e:1:1
Priority: -- → P2

Moving markers definitions to where they are used means that it's harder
to unit test them from gtests. xpcshell tests have the benefits of exercising
the markers in a more realistic setting. However, we still need to test the
output of the schema. This patch adds a new capability to do a deep equality
check of the schema results. The utility function attempts to make the output
more readable by humans, and suggest how to fix errors. This will hopefully
make it easy for users to update and maintain their markers.

Assignee: nobody → gtatum
Status: NEW → ASSIGNED
Pushed by gtatum@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c386129a2f64 Test marker schema from xpcshell tests; r=gerald,julienw
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: