Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion azure-devops/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ jobs:
targetPlatform: ${{ parameters.targetPlatform }}
targetArch: ${{ parameters.vsDevCmdArch }}
displayName: 'Build Tests'
publishArtifact: false # disabled due to GH-1653
15 changes: 4 additions & 11 deletions azure-devops/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ parameters:
- name: displayName
type: string
default: 'Run Tests'
- name: publishArtifact
type: boolean
default: false
steps:
- task: CmdLine@2
displayName: ${{ parameters.displayName }}
Expand All @@ -38,11 +35,7 @@ steps:
testResultsFormat: JUnit
testResultsFiles: '**/test-results.xml'
testRunTitle: 'test-${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)'
- publish: $(${{ parameters.buildOutPutLocationVar }})/out
artifact: '${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)-libs-$(System.JobId)'
condition: ${{ parameters.publishArtifact }}
displayName: 'Publish Libs and Headers Artifact'
- publish: $(${{ parameters.buildOutPutLocationVar }})/tests
artifact: '${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)-tests-$(System.JobId)'
condition: ${{ parameters.publishArtifact }}
displayName: 'Publish Tests Artifact'
- publish: $(${{ parameters.buildOutputLocationVar }})/test-results.xml
artifact: '${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)-xml-$(System.JobId)'
condition: failed()
displayName: 'Publish XML Artifact'
42 changes: 28 additions & 14 deletions tools/scripts/print_failures.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
# 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`.
# This script prints the output of test failures that were recorded by `stl-lit.py -o TEST_LOG_FILENAME`
# or `stl-lit.py --xunit-xml-output=TEST_RESULTS.xml`.

import json
import os
import sys
import xml.dom.minidom

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

with open(sys.argv[1]) as file:
test_log = json.load(file)
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("==================================================")
filename = sys.argv[1]
extension = os.path.splitext(filename)[1]

with open(filename) as file:
if extension.casefold() == ".xml".casefold():
test_xml = xml.dom.minidom.parse(file)
for testcase_elem in test_xml.getElementsByTagName("testcase"):
for failure_elem in testcase_elem.getElementsByTagName("failure"):
print("name: {}".format(testcase_elem.getAttribute("classname")))
print("output: {}".format(failure_elem.firstChild.data))
print("==================================================")
else:
test_log = json.load(file)
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("==================================================")