# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# This script prints the output of test failures that were recorded by `stl-lit.py -o TEST_LOG_FILENAME`.

import json
import sys

if len(sys.argv) != 2:
    sys.exit(f"Usage: python {sys.argv[0]} TEST_LOG_FILENAME")

test_log = json.load(open(sys.argv[1]))

for result in test_log["tests"]:
    if not result["code"] in ["PASS", "UNSUPPORTED", "XFAIL"]:
        print("code: {}".format(result["code"]))
        # Ignore result["elapsed"].
        print("name: {}".format(result["name"]))
        # The JSON contains embedded CRLFs (which aren't affected by opening the file in text mode).
        # If we don't replace these CRLFs with LFs here, this script will appear to be okay in the console,
        # but redirecting it to a file will result in ugly double newlines.
        print("output: {}".format(result["output"].replace("\r\n", "\n")))
        print("==================================================")

6277e324edb5eb091ef9b5a72d7bdd5f0f0f9ce2
<mask token>

<mask token>
if len(sys.argv) != 2:
    sys.exit(f'Usage: python {sys.argv[0]} TEST_LOG_FILENAME')
<mask token>
for result in test_log['tests']:
    if not result['code'] in ['PASS', 'UNSUPPORTED', 'XFAIL']:
        print('code: {}'.format(result['code']))
        print('name: {}'.format(result['name']))
        print('output: {}'.format(result['output'].replace('\r\n', '\n')))
        print('==================================================')

<mask token>
if len(sys.argv) != 2:
    sys.exit(f'Usage: python {sys.argv[0]} TEST_LOG_FILENAME')
test_log = json.load(open(sys.argv[1]))
for result in test_log['tests']:
    if not result['code'] in ['PASS', 'UNSUPPORTED', 'XFAIL']:
        print('code: {}'.format(result['code']))
        print('name: {}'.format(result['name']))
        print('output: {}'.format(result['output'].replace('\r\n', '\n')))
        print('==================================================')

import json
import sys
if len(sys.argv) != 2:
    sys.exit(f'Usage: python {sys.argv[0]} TEST_LOG_FILENAME')
test_log = json.load(open(sys.argv[1]))
for result in test_log['tests']:
    if not result['code'] in ['PASS', 'UNSUPPORTED', 'XFAIL']:
        print('code: {}'.format(result['code']))
        print('name: {}'.format(result['name']))
        print('output: {}'.format(result['output'].replace('\r\n', '\n')))
        print('==================================================')

# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# This script prints the output of test failures that were recorded by `stl-lit.py -o TEST_LOG_FILENAME`.

import json
import sys

if len(sys.argv) != 2:
    sys.exit(f"Usage: python {sys.argv[0]} TEST_LOG_FILENAME")

test_log = json.load(open(sys.argv[1]))

for result in test_log["tests"]:
    if not result["code"] in ["PASS", "UNSUPPORTED", "XFAIL"]:
        print("code: {}".format(result["code"]))
        # Ignore result["elapsed"].
        print("name: {}".format(result["name"]))
        # The JSON contains embedded CRLFs (which aren't affected by opening the file in text mode).
        # If we don't replace these CRLFs with LFs here, this script will appear to be okay in the console,
        # but redirecting it to a file will result in ugly double newlines.
        print("output: {}".format(result["output"].replace("\r\n", "\n")))
        print("==================================================")
