-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UT] Automatically generate skiplist when on a new platform (#1596)
# Functionality This PR fix #1423 # Use `./scripts/automate_skiplist.sh ${NEW_PLATFORM}` gives you `./scripts/skiplist/${NEW_PLATFORM}/....txt`
- Loading branch information
1 parent
f766f69
commit 66bdb7d
Showing
4 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# The target platform | ||
PLATFORM=$1 | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Please provide the platform name. Usage: $0 arg" | ||
exit 1 | ||
fi | ||
|
||
BASE=$(cd $(dirname "$0")/../.. && pwd) | ||
TRITON_PROJ=${BASE}/intel-xpu-backend-for-triton | ||
|
||
# Run core test, regression test and interpreter test in mode unskip | ||
. ${TRITON_PROJ}/scripts/test-triton.sh --core --interpreter --unskip --reports | ||
|
||
# Parse logs and get all failed cases for all categories | ||
TXT_DIR=${TRITON_PROJ}/scripts/skiplist/${PLATFORM} | ||
mkdir -p "${TXT_DIR}" | ||
|
||
for xml_file in ${TRITON_TEST_REPORTS_DIR}/*.xml; do | ||
file_name=$(basename ${xml_file} .xml) | ||
OUT_FILE=${TXT_DIR}/$file_name.txt | ||
|
||
python ${TRITON_PROJ}/scripts/get_failed_cases.py ${xml_file} ${OUT_FILE} | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import xml.etree.ElementTree as ET | ||
import argparse | ||
|
||
|
||
def create_argument_parser() -> argparse.ArgumentParser: | ||
"""Create argument parser.""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('input_file', type=str, help='input XML file') | ||
parser.add_argument('output_file', type=str, help='output TXT file') | ||
return parser | ||
|
||
|
||
def extract_failed_from_xml(in_file: str, out_file: str): | ||
"""Process XML log file and output failed cases.""" | ||
root = ET.parse(in_file).getroot() | ||
failed = [] | ||
|
||
for testcase in root.findall('.//testcase'): | ||
for child in testcase: | ||
if child.tag == 'error' or child.tag == 'failure': | ||
classname = testcase.get('classname').replace('.', '/') + '.py' | ||
case = testcase.get('name') | ||
result = f'{classname}::{case}' | ||
failed.append(result) | ||
|
||
if len(failed) == 0: | ||
return | ||
|
||
with open(out_file, 'w') as f: | ||
for result in failed: | ||
f.write(result + '\n') | ||
|
||
|
||
def main(): | ||
"""Main.""" | ||
args = create_argument_parser().parse_args() | ||
extract_failed_from_xml(args.input_file, args.output_file) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters