RFR: 8287008: Improve tests for thread dumps in JSON format

Alan Bateman alanb at openjdk.java.net
Thu May 19 16:52:41 UTC 2022


On Thu, 19 May 2022 09:38:06 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> This is a test-only change to add some test infrastructure and improve the testing of thread dumps in JSON format. The new tests added by JEP 425 for this thread dump format search the JSON text for strings but don't parse it completely.  These tests can be improved with a test class that parses the thread dump. The tests for JEP 428 like make use of the test infrastructure too.

If we use JSON schema then it will something like this, does that help?


{
  "properties": {
    "threadDump": {
      "type": "object",
      "properties": {
        "processId": {
          "type": "integer"
        },
        "time": {
          "type": "string"
        },
        "runtimeVersion": {
          "type": "string"
        },
        "threadContainers": {
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {
                "tid": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "stack": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ]
                }
              },
              "required": [
                "tid",
                "name",
                "stack"
              ]
            }
          ]
        }
      },
      "required": [
        "processId",
        "time",
        "runtimeVersion",
        "threadContainers"
      ]
    }
  },
  "required": [
    "threadDump"
  ]
}

-------------

PR: https://git.openjdk.java.net/jdk/pull/8784


More information about the serviceability-dev mailing list