python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
#!/usr/bin/env python from __future__ import print_function import argparse import errno import functools import html import io from multiprocessing import cpu_count import os.path import re import shutil import sys from pygments import highlight from pygments.lexers.c_cpp import CppLexer from pygments.formatters im...
MDL-SDK-master
src/mdl/jit/llvm/dist/tools/opt-viewer/opt-viewer.py
#!/usr/bin/env python from __future__ import print_function import io import yaml # Try to use the C parser. try: from yaml import CLoader as Loader except ImportError: print("For faster parsing, you may want to install libYAML for PyYAML") from yaml import Loader import html from collections import defa...
MDL-SDK-master
src/mdl/jit/llvm/dist/tools/opt-viewer/optrecord.py
import sys import multiprocessing _current = None _total = None def _init(current, total): global _current global _total _current = current _total = total def _wrapped_func(func_and_args): func, argument, should_print_progress, filter_ = func_and_args if should_print_progress: wit...
MDL-SDK-master
src/mdl/jit/llvm/dist/tools/opt-viewer/optpmap.py
#!/usr/bin/env python """A shuffle-select vector fuzz tester. This is a python program to fuzz test the LLVM shufflevector and select instructions. It generates a function with a random sequnece of shufflevectors while optionally attaching it with a select instruction (regular or zero merge), maintaining the element ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/shuffle_select_fuzz_tester.py
#!/usr/bin/env python #changelog: #10/13/2005b: replaced the # in tmp(.#*)* with alphanumeric and _, this will then remove #nodes such as %tmp.1.i and %tmp._i.3 #10/13/2005: exntended to remove variables of the form %tmp(.#)* rather than just #%tmp.#, i.e. it now will remove %tmp.12.3.15 etc, additionally fixed a sp...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/DSAclean.py
#!/usr/bin/env python '''A utility to update LLVM IR CHECK lines in C/C++ FileCheck test files. Example RUN lines in .c/.cc test files: // RUN: %clang -emit-llvm -S %s -o - -O2 | FileCheck %s // RUN: %clangxx -emit-llvm -S %s -o - -O2 | FileCheck -check-prefix=CHECK-A %s Usage: % utils/update_cc_test_checks.py --ll...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_cc_test_checks.py
#!/usr/bin/env python3 import re, sys def fix_string(s): TYPE = re.compile('\s*(i[0-9]+|float|double|x86_fp80|fp128|ppc_fp128|\[\[.*?\]\]|\[2 x \[\[[A-Z_0-9]+\]\]\]|<.*?>|{.*?}|\[[0-9]+ x .*?\]|%["a-z:A-Z0-9._]+({{.*?}})?|%{{.*?}}|{{.*?}}|\[\[.*?\]\])(\s*(\*|addrspace\(.*?\)|dereferenceable\(.*?\)|byval\(.*?\)|sre...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/add_argument_names.py
#!/usr/bin/env python """ wciia - Whose Code Is It Anyway Determines code owner of the file/folder relative to the llvm source root. Code owner is determined from the content of the CODE_OWNERS.TXT by parsing the D: field usage: utils/wciia.py path limitations: - must be run from llvm source root - very simplist...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/wciia.py
#!/usr/bin/env python3 import os import re import sys from concurrent.futures import ThreadPoolExecutor, as_completed def remove_prefix(i, d=0): if d == 100: return 2 s = os.popen('llvm-lit -a ' + i).read() r = re.search('no check strings found with (?:prefix|prefixes) \'([^:]+)', s) with open...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_test_prefix.py
# Given a path to llvm-objdump and a directory tree, spider the directory tree # dumping every object file encountered with correct options needed to demangle # symbols in the object file, and collect statistics about failed / crashed # demanglings. Useful for stress testing the demangler against a large corpus # of i...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/demangle_tree.py
""" LLDB Formatters for LLVM data types. Load into LLDB with 'command script import /path/to/lldbDataFormatters.py' """ def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand('type category define -e llvm -l c++') debugger.HandleCommand('type synthetic add -w llvm ' ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lldbDataFormatters.py
#!/usr/bin/env python """ Summarize the information in the given coverage files. Emits the number of rules covered or the percentage of rules covered depending on whether --num-rules has been used to specify the total number of rules. """ from __future__ import print_function import argparse import struct class File...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/llvm-gisel-cov.py
#!/usr/bin/env python3 """ This script: - Builds clang with user-defined flags - Uses that clang to build an instrumented clang, which can be used to collect PGO samples - Builds a user-defined set of sources (default: clang) to act as a "benchmark" to generate a PGO profile - Builds clang once more with the PGO pr...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/collect_and_build_with_pgo.py
#!/usr/bin/env python3 """A script to generate FileCheck statements for 'opt' regression tests. This script is a utility to update LLVM opt test cases with new FileCheck patterns. It can either update all of the tests in the file or a single test function. Example usage: $ update_test_checks.py --opt=../bin/opt test...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_test_checks.py
#!/usr/bin/env python """A tool for extracting a list of symbols to export When exporting symbols from a dll or exe we either need to mark the symbols in the source code as __declspec(dllexport) or supply a list of symbols to the linker. This program automates the latter by inspecting the symbol tables of a list of l...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/extract_symbols.py
#!/usr/bin/env python """A tool for looking for indirect jumps and calls in x86 binaries. Helpful to verify whether or not retpoline mitigations are catching all of the indirect branches in a binary and telling you which functions the remaining ones are in (assembly, etc). Depends on llvm-objdump being i...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/indirect_calls.py
#!/usr/bin/env python """Script to sort the top-most block of #include lines. Assumes the LLVM coding conventions. Currently, this script only bothers sorting the llvm/... headers. Patches welcome for more functionality, and sorting other header groups. """ import argparse import os def sort_includes(f): """Sort...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/sort_includes.py
#!/usr/bin/env python """ Helper script to convert the log generated by '-debug-only=constraint-system' to a Python script that uses Z3 to verify the decisions using Z3's Python API. Example usage: > cat path/to/file.log --- x6 + -1 * x7 <= -1 x6 + -1 * x7 <= -2 sat > ./convert-constraint-log-to-z3.py path/to/file....
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/convert-constraint-log-to-z3.py
#!/usr/bin/env python """ Unicode case folding database conversion utility Parses the database and generates a C++ function which implements the case folding algorithm. The database entries are of the form: <code>; <status>; <mapping>; # <name> <status> can be one of four characters: C - Common mappings S - ma...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/unicode-case-fold.py
#!/usr/bin/env python3 """A script to generate FileCheck statements for 'opt' analysis tests. This script is a utility to update LLVM opt analysis test cases with new FileCheck patterns. It can either update all of the tests in the file or a single test function. Example usage: $ update_analyze_test_checks.py --opt=...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_analyze_test_checks.py
#!/usr/bin/env python #this is a script to extract given named nodes from a dot file, with #the associated edges. An edge is kept iff for edge x -> y # x and y are both nodes specified to be kept. #known issues: if a line contains '->' and is not an edge line #problems will occur. If node labels do not begin with #...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/DSAextract.py
#!/usr/bin/env python # This script extracts the VPlan digraphs from the vectoriser debug messages # and saves them in individual dot files (one for each plan). Optionally, and # providing 'dot' is installed, it can also render the dot into a PNG file. from __future__ import print_function import sys import re impor...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/extract_vplan.py
#!/usr/bin/env python # Given a -print-before-all -print-module-scope log from an opt invocation, # chunk it into a series of individual IR files, one for each pass invocation. # If the log ends with an obvious stack trace, try to split off a separate # "crashinfo.txt" file leaving only the valid input IR in the last c...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/chunk-print-before-all.py
#!/usr/bin/env python """Reduces GlobalISel failures. This script is a utility to reduce tests that GlobalISel fails to compile. It runs llc to get the error message using a regex and creates a custom command to check that specific error. Then, it runs bugpoint with the custom command. """ from __future__ import pr...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/bugpoint_gisel_reducer.py
#!/usr/bin/env python3 ''' Merge .stats files generated by llvm tools merge-stats.py takes as argument a list of stats files to merge and output the result on stdout Usage: merge-stats.py $(find ./builddir/ -name "*.stats") > total.stats ''' import json import sys result = {} for arg in range(1, len(sys.argv)): ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/merge-stats.py
#!/usr/bin/env python #===----------------------------------------------------------------------===## # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===------------...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/remote-exec.py
#!/usr/bin/env python """A ladder graph creation program. This is a python program that creates c source code that will generate CFGs that are ladder graphs. Ladder graphs are generally the worst case for a lot of dominance related algorithms (Dominance frontiers, etc), and often generate N^2 or worse behavior. One ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/create_ladder_graph.py
#!/usr/bin/env python3 # # ======- check-ninja-deps - build debugging script ----*- python -*--========# # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ==---------...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/check_ninja_deps.py
#!/usr/bin/env python3 """A test case update script. This script is a utility to update LLVM 'llc' based test cases with new FileCheck patterns. It can either update all of the tests in the file or a single test function. """ from __future__ import print_function import argparse import os # Used to advertise this ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_llc_test_checks.py
#!/usr/bin/env python # This creates a CSV file from the output of the debug output of subtarget: # llvm-tblgen --gen-subtarget --debug-only=subtarget-emitter # With thanks to Dave Estes for mentioning the idea at 2014 LLVM Developers' Meeting import os; import sys; import re; import operator; table = {} models = ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/schedcover.py
#!/usr/bin/env python3 """Updates FileCheck checks in MIR tests. This script is a utility to update MIR based tests with new FileCheck patterns. The checks added by this script will cover the entire body of each function it handles. Virtual registers used are given names via FileCheck patterns, so if you do want to ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_mir_test_checks.py
#!/usr/bin/env python # # Given a previous good compile narrow down miscompiles. # Expects two directories named "before" and "after" each containing a set of # assembly or object files where the "after" version is assumed to be broken. # You also have to provide a script called "link_test". It is called with a # list ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/abtest.py
#!/usr/bin/env python from __future__ import print_function '''Prepare a code coverage artifact. - Collate raw profiles into one indexed profile. - Generate html reports for the given binaries. Caution: The positional arguments to this script must be specified before any optional arguments, such as --restrict. '''...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/prepare-code-coverage-artifact.py
#!/usr/bin/env python """A shuffle vector fuzz tester. This is a python program to fuzz test the LLVM shufflevector instruction. It generates a function with a random sequnece of shufflevectors, maintaining the element mapping accumulated across the function. It then generates a main function which calls it with a di...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/shuffle_fuzz.py
#!/usr/bin/env python3 """A test case update script. This script is a utility to update LLVM 'llvm-mca' based test cases with new FileCheck patterns. """ import argparse from collections import defaultdict import glob import os import sys import warnings from UpdateTestChecks import common COMMENT_CHAR = '#' ADVE...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/update_mca_test_checks.py
#!/usr/bin/env python # encoding: utf-8 import argparse import errno import logging import os import platform import re import sys import subprocess import tempfile try: import winreg except ImportError: import _winreg as winreg try: import urllib.request as request except ImportError: import urllib a...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/benchmark/mingw.py
#!/usr/bin/env python """ strip_asm.py - Cleanup ASM output for the specified file """ from argparse import ArgumentParser import sys import os import re def find_used_labels(asm): found = set() label_re = re.compile("\s*j[a-z]+\s+\.L([a-zA-Z0-9][a-zA-Z0-9_]*)") for l in asm.splitlines(): m = lab...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/benchmark/tools/strip_asm.py
#!/usr/bin/env python """ compare.py - versatile benchmark output compare tool """ import argparse from argparse import ArgumentParser import sys import gbench from gbench import util, report from gbench.util import * def check_inputs(in1, in2, flags): """ Perform checking on the user provided inputs and di...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/benchmark/tools/compare.py
"""util.py - General utilities for running, loading, and processing benchmarks """ import json import os import tempfile import subprocess import sys # Input file type enumeration IT_Invalid = 0 IT_JSON = 1 IT_Executable = 2 _num_magic_bytes = 2 if sys.platform.startswith('win') else 4 def is_executable_file...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/benchmark/tools/gbench/util.py
"""Google Benchmark tooling""" __author__ = 'Eric Fiselier' __email__ = 'eric@efcs.ca' __versioninfo__ = (0, 5, 0) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = []
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/benchmark/tools/gbench/__init__.py
"""report.py - Utilities for reporting statistics about benchmark results """ import os import re import copy class BenchmarkColor(object): def __init__(self, name, code): self.name = name self.code = code def __repr__(self): return '%s%r' % (self.__class__.__name__, ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/benchmark/tools/gbench/report.py
from __future__ import print_function import struct import sys import gdb.printing import gdb.types class Iterator: def __iter__(self): return self if sys.version_info.major == 2: def next(self): return self.__next__() def children(self): return self def escape_bytes(val, l): return '...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/gdb-scripts/prettyprinters.py
#!/usr/bin/env python # # This is a tool that works like debug location coverage calculator. # It parses the llvm-dwarfdump --statistics output by reporting it # in a more human readable way. # from __future__ import print_function import argparse import os import sys from json import loads from math import ceil from ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/llvm-locstats/llvm-locstats.py
#!/usr/bin/env python # # Checks files to make sure they conform to LLVM standards which can be applied # to any programming language: at present, line length and trailing whitespace. import common_lint import sys class GenericCodeLint(common_lint.BaseLint): MAX_LINE_LENGTH = 80 def RunOnFile(self, filename, lin...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lint/generic_lint.py
#!/usr/bin/env python # # Checks C++ files to make sure they conform to LLVM standards, as specified in # http://llvm.org/docs/CodingStandards.html . # # TODO: add unittests for the verifier functions: # http://docs.python.org/library/unittest.html . from __future__ import print_function import common_lint import re i...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lint/cpp_lint.py
#!/usr/bin/env python # # Common lint functions applicable to multiple types of files. from __future__ import print_function import re def VerifyLineLength(filename, lines, max_length): """Checks to make sure the file has no lines with lines exceeding the length limit. Args: filename: the file under consid...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lint/common_lint.py
#!/usr/bin/env python """ A small program to compute checksums of LLVM checkout. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import hashlib import logging import re import sys from argparse import ArgumentParser from project_tree import * SVN_DATES_...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/docker/scripts/llvm_checksum/llvm_checksum.py
"""Contains helper functions to compute checksums for LLVM checkouts. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import os import os.path import sys class LLVMProject(object): """An LLVM project with a descriptive name and a relat...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/docker/scripts/llvm_checksum/project_tree.py
#!/usr/bin/env python3 from lit.main import main if __name__ == '__main__': main()
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit.py
import lit import os from setuptools import setup, find_packages # setuptools expects to be invoked from within the directory of setup.py, but it # is nice to allow: # python path/to/setup.py install # to work (for scripts, etc.) os.chdir(os.path.dirname(os.path.abspath(__file__))) setup( name = "lit", ver...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/setup.py
from __future__ import absolute_import import itertools import lit.util from lit.ShCommands import Command, GlobItem, Pipeline, Seq class ShLexer: def __init__(self, data, win32Escapes = False): self.data = data self.pos = 0 self.end = len(data) self.win32Escapes = win32Escapes ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/ShUtil.py
""" The functions in this module are meant to run on a separate worker process. Exception: in single process mode _execute is called directly. For efficiency, we copy all data needed to execute all tests into each worker and store it in global variables. This reduces the cost of each task. """ import contextlib import...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/worker.py
import multiprocessing import os import time import lit.Test import lit.util import lit.worker class MaxFailuresError(Exception): pass class TimeoutError(Exception): pass class Run(object): """A concrete, configured testing run.""" def __init__(self, tests, lit_config, workers, progress_callback, ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/run.py
import argparse import os import shlex import sys import lit.reports import lit.util def parse_args(): parser = argparse.ArgumentParser(prog='lit') parser.add_argument('test_paths', nargs='+', metavar="TEST_PATH", help='File or path to include in the test suite') pars...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/cl_arguments.py
""" Test discovery functions. """ import copy import os import sys from lit.TestingConfig import TestingConfig from lit import LitConfig, Test def chooseConfigFileFromDir(dir, config_names): for name in config_names: p = os.path.join(dir, name) if os.path.exists(p): return p retur...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/discovery.py
from __future__ import print_function import errno import itertools import math import numbers import os import platform import signal import subprocess import sys import threading def is_string(value): try: # Python 2 and Python 3 are different here. return isinstance(value, basestring) exce...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/util.py
"""'lit' Testing Tool""" __author__ = 'Daniel Dunbar' __email__ = 'daniel@minormatter.com' __versioninfo__ = (12, 0, 1) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = []
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/__init__.py
import itertools import os from json import JSONEncoder from lit.BooleanExpression import BooleanExpression # Test result codes. class ResultCode(object): """Test result codes.""" # All result codes (including user-defined ones) in declaration order _all_codes = [] @staticmethod def all_codes()...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/Test.py
import sys def create_display(opts, tests, total_tests, workers): if opts.quiet: return NopDisplay() of_total = (' of %d' % total_tests) if (tests != total_tests) else '' header = '-- Testing: %d%s tests, %d workers --' % (tests, of_total, workers) progress_bar = None if opts.succinct an...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/display.py
#!/usr/bin/env python # Source: http://code.activestate.com/recipes/475116/, with # modifications by Daniel Dunbar. import sys, re, time def to_bytes(str): # Encode to UTF-8 to get binary data. return str.encode('utf-8') class TerminalController: """ A class that can be used to portably generate for...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/ProgressBar.py
import os import sys class TestingConfig(object): """" TestingConfig - Information on the tests inside a suite. """ @staticmethod def fromdefaults(litConfig): """ fromdefaults(litConfig) -> TestingConfig Create a TestingConfig object with default values. """ ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/TestingConfig.py
import itertools import json from xml.sax.saxutils import quoteattr as quo import lit.Test def by_suite_and_test_path(test): # Suite names are not necessarily unique. Include object identity in sort # key to avoid mixing tests of different suites. return (test.suite.name, id(test.suite), test.path_in_s...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/reports.py
""" lit - LLVM Integrated Tester. See lit.pod for more information. """ import itertools import os import platform import sys import time import lit.cl_arguments import lit.discovery import lit.display import lit.LitConfig import lit.reports import lit.run import lit.Test import lit.util def main(builtin_params={}...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/main.py
import re class BooleanExpression: # A simple evaluator of boolean expressions. # # Grammar: # expr :: or_expr # or_expr :: and_expr ('||' and_expr)* # and_expr :: not_expr ('&&' not_expr)* # not_expr :: '!' not_expr # '(' or_expr ')' # ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/BooleanExpression.py
class Command: def __init__(self, args, redirects): self.args = list(args) self.redirects = list(redirects) def __repr__(self): return 'Command(%r, %r)' % (self.args, self.redirects) def __eq__(self, other): if not isinstance(other, Command): return False ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/ShCommands.py
import unittest import lit.discovery import lit.LitConfig import lit.worker """ TestCase adaptor for providing a Python 'unittest' compatible interface to 'lit' tests. """ class UnresolvedError(RuntimeError): pass class LitTestCase(unittest.TestCase): def __init__(self, test, lit_config): unittest...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/LitTestCase.py
from __future__ import absolute_import import errno import io import itertools import getopt import os, signal, subprocess, sys import re import stat import platform import shutil import tempfile import threading import io try: from StringIO import StringIO except ImportError: from io import StringIO from lit...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/TestRunner.py
from __future__ import absolute_import import inspect import os import platform import sys import lit.Test import lit.formats import lit.TestingConfig import lit.util # LitConfig must be a new style class for properties to work class LitConfig(object): """LitConfig - Configuration data for a 'lit' test runner ins...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/LitConfig.py
from __future__ import absolute_import import lit.TestRunner import lit.util from .base import FileBasedTest class ShTest(FileBasedTest): """ShTest is a format with one file per test. This is the primary format for regression tests as described in the LLVM testing guide: http://llvm.org/docs/T...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/formats/shtest.py
from lit.formats.base import ( # noqa: F401 TestFormat, FileBasedTest, OneCommandPerFileTest, ExecutableTest ) from lit.formats.googletest import GoogleTest # noqa: F401 from lit.formats.shtest import ShTest # noqa: F401
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/formats/__init__.py
from __future__ import absolute_import import os import subprocess import sys import lit.Test import lit.TestRunner import lit.util from .base import TestFormat kIsWindows = sys.platform in ['win32', 'cygwin'] class GoogleTest(TestFormat): def __init__(self, test_sub_dirs, test_suffix): self.test_sub_dir...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/formats/googletest.py
from __future__ import absolute_import import os import lit.Test import lit.util class TestFormat(object): pass ### class FileBasedTest(TestFormat): def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig): source_path = testSuite.getSourcePath(path...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/formats/base.py
import getopt import sys try: from StringIO import StringIO except ImportError: from io import StringIO def convertToCaretAndMNotation(data): newdata = StringIO() if isinstance(data, str): data = bytearray(data) for intval in data: if intval == 9 or intval == 10: newdata.writ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/builtin_commands/cat.py
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/builtin_commands/__init__.py
import difflib import functools import getopt import io import locale import os import sys import util from util import to_string class DiffFlags(): def __init__(self): self.ignore_all_space = False self.ignore_space_change = False self.unified_diff = False self.num_context_lines =...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/builtin_commands/diff.py
import itertools import os import platform import re import subprocess import sys import lit.util from lit.llvm.subst import FindTool from lit.llvm.subst import ToolSubst lit_path_displayed = False class LLVMConfig(object): def __init__(self, lit_config, config): self.lit_config = lit_config sel...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/llvm/config.py
from lit.llvm import config llvm_config = None def initialize(lit_config, test_config): global llvm_config llvm_config = config.LLVMConfig(lit_config, test_config)
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/llvm/__init__.py
import os import re import lit.util expr = re.compile(r"^(\\)?((\| )?)\W+b(\S+)\\b\W*$") wordifier = re.compile(r"(\W*)(\b[^\b]+\b)") class FindTool(object): def __init__(self, name): self.name = name def resolve(self, config, dirs): # Check for a user explicitely overriding a tool. This a...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/lit/llvm/subst.py
# Check cases where LIT_OPTS has no effect. # # RUN: %{lit} -j 1 -s %{inputs}/lit-opts | FileCheck %s # RUN: env LIT_OPTS= %{lit} -j 1 -s %{inputs}/lit-opts | FileCheck %s # RUN: env LIT_OPTS=-s %{lit} -j 1 -s %{inputs}/lit-opts | FileCheck %s # Check that LIT_OPTS can override command-line options. ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/lit-opts.py
# Check that we route argv[0] as it was written, instead of the resolved # path. This is important for some tools, in particular '[' which at least on OS # X only recognizes that it is in '['-mode when its argv[0] is exactly # '['. Otherwise it will refuse to accept the trailing closing bracket. # # This test is not su...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-format-argv0.py
# Test the boolean expression parser # used for REQUIRES and UNSUPPORTED and XFAIL # RUN: %{python} -m lit.BooleanExpression
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/boolean-parsing.py
# Check that we do not crash if a parallelism group is set to None. Permits # usage of the following pattern. # # [lit.common.cfg] # lit_config.parallelism_groups['my_group'] = None # if <condition>: # lit_config.parallelism_groups['my_group'] = 3 # # [project/lit.cfg] # config.parallelism_group = 'my_group' ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/parallelism-groups.py
# RUN: %{lit} -j 1 -v %{inputs}/test-data-micro --output %t.results.out # RUN: FileCheck < %t.results.out %s # RUN: rm %t.results.out # CHECK: { # CHECK: "__version__" # CHECK: "elapsed" # CHECK-NEXT: "tests": [ # CHECK-NEXT: { # CHECK-NEXT: "code": "PASS", # CHECK-NEXT: "elapsed": null, # CHECK-NEXT: "...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/test-output-micro.py
# REQUIRES: lit-max-individual-test-time # llvm.org/PR33944 # UNSUPPORTED: system-windows ############################################################################### # Check tests can hit timeout when set ############################################################################### # Test per test timeout usin...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-timeout.py
# Check the behavior of the ALLOW_RETRIES keyword. # This test uses a file that's stable across retries of the test to fail and # only succeed the fourth time it is retried. # # RUN: rm -f %t.counter # RUN: %{lit} -j 1 %{inputs}/allow-retries/succeeds-within-limit.py -Dcounter=%t.counter -Dpython=%{python} | FileCheck...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/allow-retries.py
# Just run the ShUtil unit tests. # # RUN: %{python} -m lit.ShUtil
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shell-parsing.py
# Check the basic discovery process, including a sub-suite. # # RUN: %{lit} %{inputs}/discovery \ # RUN: -j 1 --debug --show-tests --show-suites \ # RUN: -v > %t.out 2> %t.err # RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s # RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s # # CHECK-BASIC-ERR:...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/discovery.py
# Check the not command # # RUN: not %{lit} -j 1 -a -v %{inputs}/shtest-not \ # RUN: | FileCheck -match-full-lines %s # # END. # Make sure not and env commands are included in printed commands. # CHECK: -- Testing: 13 tests{{.*}} # CHECK: FAIL: shtest-not :: not-args-last-is-crash.txt {{.*}} # CHECK: $ "not" "--cras...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-not.py
# Check for correct error message when discovery of tests fails. # # RUN: not %{lit} -j 1 -v %{inputs}/googletest-discovery-failed > %t.cmd.out # RUN: FileCheck < %t.cmd.out %s # CHECK: -- Testing: # CHECK: Failed Tests (1): # CHECK: googletest-discovery-failed :: subdir/OneTest.py/failed_to_discover_tests_from_gte...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/googletest-discovery-failed.py
# Check that -vv makes the line number of the failing RUN command clear. # (-v is actually sufficient in the case of the internal shell.) # # RUN: not %{lit} -j 1 -vv %{inputs}/shtest-run-at-line > %t.out # RUN: FileCheck --input-file %t.out %s # # END. # CHECK: Testing: 4 tests # In the case of the external shell,...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-run-at-line.py
# Check the internal shell handling component of the ShTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out # FIXME: Temporarily dump test output so we can debug failing tests on # buildbots. # RUN: cat %t.out # RUN: FileCheck --input-file %t.out %s # # Test again in non-UTF shell to catch potential...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-shell.py
# Test features related to formats which support reporting additional test data. # and multiple test results. # RUN: %{lit} -j 1 -v %{inputs}/test-data-micro | FileCheck %s # CHECK: -- Testing: # CHECK: PASS: test-data-micro :: micro-tests.ini # CHECK-NEXT: *** TEST 'test-data-micro :: micro-tests.ini' RESULTS *** #...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/test-data-micro.py
# RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out # RUN: FileCheck < %t.results.out %s # CHECK: { # CHECK: "__version__" # CHECK: "elapsed" # CHECK-NEXT: "tests": [ # CHECK-NEXT: { # CHECK-NEXT: "code": "PASS", # CHECK-NEXT: "elapsed": {{[0-9.]+}}, # CHECK-NEXT: "metrics": { # CH...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/test-output.py
# Check the various features of the ShTest format. # # RUN: rm -f %t.xml # RUN: not %{lit} -j 1 -v %{inputs}/shtest-format --xunit-xml-output %t.xml > %t.out # RUN: FileCheck < %t.out %s # RUN: FileCheck --check-prefix=XUNIT < %t.xml %s # END. # CHECK: -- Testing: # CHECK: FAIL: shtest-format :: external_shell/fail....
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-format.py
# Check the various features of the GoogleTest format. # # RUN: not %{lit} -j 1 -v %{inputs}/googletest-format > %t.out # FIXME: Temporarily dump test output so we can debug failing tests on # buildbots. # RUN: cat %t.out # RUN: FileCheck < %t.out %s # # END. # CHECK: -- Testing: # CHECK: PASS: googletest-format :: {{...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/googletest-format.py
# RUN: %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-BASIC %s # CHECK-BASIC: Testing: 5 tests # Check that we exit with an error if we do not discover any tests, even with --allow-empty-runs. # # RUN: not %{lit} %{inputs}/nonexistent 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s #...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/selecting.py
# Check the simple progress bar. # # RUN: not %{lit} -j 1 -s %{inputs}/progress-bar > %t.out # RUN: FileCheck < %t.out %s # # CHECK: Testing: # CHECK: FAIL: progress-bar :: test-1.txt (1 of 4) # CHECK: Testing: 0.. 10.. 20 # CHECK: FAIL: progress-bar :: test-2.txt (2 of 4) # CHECK: Testing: 0.. 10.. 20.. 30.. 40.. # ...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/progress-bar.py
# UNSUPPORTED: system-windows # Check the behavior of --max-failures option. # # RUN: not %{lit} -j 1 %{inputs}/max-failures > %t.out 2>&1 # RUN: not %{lit} --max-failures=1 -j 1 %{inputs}/max-failures >> %t.out 2>&1 # RUN: not %{lit} --max-failures=2 -j 1 %{inputs}/max-failures >> %t.out 2>&1 # RUN:...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/max-failures.py
# REQUIRES: lit-max-individual-test-time ############################################################################### # Check tests can hit timeout when set ############################################################################### # Check that the per test timeout is enforced when running GTest tests. # # RU...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/googletest-timeout.py
# RUN: not %{lit} -j 1 -vv %{inputs}/shtest-keyword-parse-errors > %t.out # RUN: FileCheck -input-file %t.out %s # # END. # CHECK: Testing: 3 tests # CHECK-LABEL: UNRESOLVED: shtest-keyword-parse-errors :: empty.txt # CHECK: {{^}}Test has no 'RUN:' line{{$}} # CHECK-LABEL: UNRESOLVED: shtest-keyword-parse-erro...
MDL-SDK-master
src/mdl/jit/llvm/dist/utils/lit/tests/shtest-keyword-parse-errors.py