diff options
Diffstat (limited to 'lldb/third_party/Python/module/pexpect-4.6/tools')
6 files changed, 0 insertions, 448 deletions
diff --git a/lldb/third_party/Python/module/pexpect-4.6/tools/display-fpathconf.py b/lldb/third_party/Python/module/pexpect-4.6/tools/display-fpathconf.py deleted file mode 100644 index d40cbae206f..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tools/display-fpathconf.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -"""Displays os.fpathconf values related to terminals. """ -from __future__ import print_function -import sys -import os - - -def display_fpathconf(): - DISP_VALUES = ( - ('PC_MAX_CANON', ('Max no. of bytes in a ' - 'terminal canonical input line.')), - ('PC_MAX_INPUT', ('Max no. of bytes for which ' - 'space is available in a terminal input queue.')), - ('PC_PIPE_BUF', ('Max no. of bytes which will ' - 'be written atomically to a pipe.')), - ('PC_VDISABLE', 'Terminal character disabling value.') - ) - FMT = '{name:<13} {value:<5} {description}' - - # column header - print(FMT.format(name='name', value='value', description='description')) - print(FMT.format(name=('-' * 13), value=('-' * 5), description=('-' * 11))) - - fd = sys.stdin.fileno() - for name, description in DISP_VALUES: - key = os.pathconf_names.get(name, None) - if key is None: - value = 'UNDEF' - else: - try: - value = os.fpathconf(fd, name) - except OSError as err: - value = 'OSErrno {0.errno}'.format(err) - if name == 'PC_VDISABLE': - value = hex(value) - print(FMT.format(name=name, value=value, description=description)) - print() - - -if __name__ == '__main__': - display_fpathconf() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tools/display-maxcanon.py b/lldb/third_party/Python/module/pexpect-4.6/tools/display-maxcanon.py deleted file mode 100644 index cbd664ffec7..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tools/display-maxcanon.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -""" -This tool uses pexpect to test expected Canonical mode length. - -All systems use the value of MAX_CANON which can be found using -fpathconf(3) value PC_MAX_CANON -- with the exception of Linux -and FreeBSD. - -Linux, though defining a value of 255, actually honors the value -of 4096 from linux kernel include file tty.h definition -N_TTY_BUF_SIZE. - -Linux also does not honor IMAXBEL. termios(3) states, "Linux does not -implement this bit, and acts as if it is always set." Although these -tests ensure it is enabled, this is a non-op for Linux. - -FreeBSD supports neither, and instead uses a fraction (1/5) of the tty -speed which is always 9600. Therefor, the maximum limited input line -length is 9600 / 5 = 1920. - -These tests only ensure the correctness of the behavior described by -the sendline() docstring -- the values listed there, and above should -be equal to the output of the given OS described, but no promises! -""" -# std import -from __future__ import print_function -import sys -import os - - -def detect_maxcanon(): - import pexpect - bashrc = os.path.join( - # re-use pexpect/replwrap.py's bashrc file, - os.path.dirname(__file__), os.path.pardir, 'pexpect', 'bashrc.sh') - - child = pexpect.spawn('bash', ['--rcfile', bashrc], - echo=True, encoding='utf8', timeout=3) - - child.sendline(u'echo -n READY_; echo GO') - child.expect_exact(u'READY_GO') - - child.sendline(u'stty icanon imaxbel erase ^H; echo -n retval: $?') - child.expect_exact(u'retval: 0') - - child.sendline(u'echo -n GO_; echo AGAIN') - child.expect_exact(u'GO_AGAIN') - child.sendline(u'cat') - - child.delaybeforesend = 0 - - column, blocksize = 0, 64 - ch_marker = u'_' - - print('auto-detecting MAX_CANON: ', end='') - sys.stdout.flush() - - while True: - child.send(ch_marker * blocksize) - result = child.expect([ch_marker * blocksize, u'\a']) - if result == 0: - # entire block fit without emitting bel - column += blocksize - elif result == 1: - # an '\a' was emitted, count the number of ch_markers - # found since last blocksize, determining our MAX_CANON - column += child.before.count(ch_marker) - break - print(column) - -if __name__ == '__main__': - try: - detect_maxcanon() - except ImportError: - # we'd like to use this with CI -- but until we integrate - # with tox, we can't determine a period in testing when - # the pexpect module has been installed - print('warning: pexpect not in module path, MAX_CANON ' - 'could not be determined by systems test.', - file=sys.stderr) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tools/display-sighandlers.py b/lldb/third_party/Python/module/pexpect-4.6/tools/display-sighandlers.py deleted file mode 100755 index f3559f72e31..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tools/display-sighandlers.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# Displays all signals, their values, and their handlers. -from __future__ import print_function -import signal -FMT = '{name:<10} {value:<5} {description}' - -# header -print(FMT.format(name='name', value='value', description='description')) -print('-' * (33)) - -for name, value in [(signal_name, getattr(signal, signal_name)) - for signal_name in dir(signal) - if signal_name.startswith('SIG') - and not signal_name.startswith('SIG_')]: - try: - handler = signal.getsignal(value) - except ValueError: - # FreeBSD: signal number out of range - handler = 'out of range' - description = { - signal.SIG_IGN: "ignored(SIG_IGN)", - signal.SIG_DFL: "default(SIG_DFL)" - }.get(handler, handler) - print(FMT.format(name=name, value=value, description=description)) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tools/display-terminalinfo.py b/lldb/third_party/Python/module/pexpect-4.6/tools/display-terminalinfo.py deleted file mode 100755 index 1288397acbb..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tools/display-terminalinfo.py +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/bin/env python -""" Display known information about our terminal. """ -from __future__ import print_function -import termios -import locale -import sys -import os - -BITMAP_IFLAG = { - 'IGNBRK': 'ignore BREAK condition', - 'BRKINT': 'map BREAK to SIGINTR', - 'IGNPAR': 'ignore (discard) parity errors', - 'PARMRK': 'mark parity and framing errors', - 'INPCK': 'enable checking of parity errors', - 'ISTRIP': 'strip 8th bit off chars', - 'INLCR': 'map NL into CR', - 'IGNCR': 'ignore CR', - 'ICRNL': 'map CR to NL (ala CRMOD)', - 'IXON': 'enable output flow control', - 'IXOFF': 'enable input flow control', - 'IXANY': 'any char will restart after stop', - 'IMAXBEL': 'ring bell on input queue full', - 'IUCLC': 'translate upper case to lower case', -} - -BITMAP_OFLAG = { - 'OPOST': 'enable following output processing', - 'ONLCR': 'map NL to CR-NL (ala CRMOD)', - 'OXTABS': 'expand tabs to spaces', - 'ONOEOT': 'discard EOT\'s `^D\' on output)', - 'OCRNL': 'map CR to NL', - 'OLCUC': 'translate lower case to upper case', - 'ONOCR': 'No CR output at column 0', - 'ONLRET': 'NL performs CR function', -} - -BITMAP_CFLAG = { - 'CSIZE': 'character size mask', - 'CS5': '5 bits (pseudo)', - 'CS6': '6 bits', - 'CS7': '7 bits', - 'CS8': '8 bits', - 'CSTOPB': 'send 2 stop bits', - 'CREAD': 'enable receiver', - 'PARENB': 'parity enable', - 'PARODD': 'odd parity, else even', - 'HUPCL': 'hang up on last close', - 'CLOCAL': 'ignore modem status lines', - 'CCTS_OFLOW': 'CTS flow control of output', - 'CRTSCTS': 'same as CCTS_OFLOW', - 'CRTS_IFLOW': 'RTS flow control of input', - 'MDMBUF': 'flow control output via Carrier', -} - -BITMAP_LFLAG = { - 'ECHOKE': 'visual erase for line kill', - 'ECHOE': 'visually erase chars', - 'ECHO': 'enable echoing', - 'ECHONL': 'echo NL even if ECHO is off', - 'ECHOPRT': 'visual erase mode for hardcopy', - 'ECHOCTL': 'echo control chars as ^(Char)', - 'ISIG': 'enable signals INTR, QUIT, [D]SUSP', - 'ICANON': 'canonicalize input lines', - 'ALTWERASE': 'use alternate WERASE algorithm', - 'IEXTEN': 'enable DISCARD and LNEXT', - 'EXTPROC': 'external processing', - 'TOSTOP': 'stop background jobs from output', - 'FLUSHO': 'output being flushed (state)', - 'NOKERNINFO': 'no kernel output from VSTATUS', - 'PENDIN': 'XXX retype pending input (state)', - 'NOFLSH': 'don\'t flush after interrupt', -} - -CTLCHAR_INDEX = { - 'VEOF': 'EOF', - 'VEOL': 'EOL', - 'VEOL2': 'EOL2', - 'VERASE': 'ERASE', - 'VWERASE': 'WERASE', - 'VKILL': 'KILL', - 'VREPRINT': 'REPRINT', - 'VINTR': 'INTR', - 'VQUIT': 'QUIT', - 'VSUSP': 'SUSP', - 'VDSUSP': 'DSUSP', - 'VSTART': 'START', - 'VSTOP': 'STOP', - 'VLNEXT': 'LNEXT', - 'VDISCARD': 'DISCARD', - 'VMIN': '---', - 'VTIME': '---', - 'VSTATUS': 'STATUS', -} - - -def display_bitmask(kind, bitmap, value): - """ Display all matching bitmask values for ``value`` given ``bitmap``. """ - col1_width = max(map(len, list(bitmap.keys()) + [kind])) - col2_width = 7 - FMT = '{name:>{col1_width}} {value:>{col2_width}} {description}' - print(FMT.format(name=kind, - value='Value', - description='Description', - col1_width=col1_width, - col2_width=col2_width)) - print('{0} {1} {2}'.format('-' * col1_width, - '-' * col2_width, - '-' * max(map(len, bitmap.values())))) - for flag_name, description in bitmap.items(): - try: - bitmask = getattr(termios, flag_name) - bit_val = 'on' if bool(value & bitmask) else 'off' - except AttributeError: - bit_val = 'undef' - print(FMT.format(name=flag_name, - value=bit_val, - description=description, - col1_width=col1_width, - col2_width=col2_width)) - print() - - -def display_ctl_chars(index, cc): - """ Display all control character indicies, names, and values. """ - title = 'Special Character' - col1_width = len(title) - col2_width = max(map(len, index.values())) - FMT = '{idx:<{col1_width}} {name:<{col2_width}} {value}' - print('Special line Characters'.center(40).rstrip()) - print(FMT.format(idx='Index', - name='Name', - value='Value', - col1_width=col1_width, - col2_width=col2_width)) - print('{0} {1} {2}'.format('-' * col1_width, - '-' * col2_width, - '-' * 10)) - for index_name, name in index.items(): - try: - index = getattr(termios, index_name) - value = cc[index] - if value == b'\xff': - value = '_POSIX_VDISABLE' - else: - value = repr(value) - except AttributeError: - value = 'undef' - print(FMT.format(idx=index_name, - name=name, - value=value, - col1_width=col1_width, - col2_width=col2_width)) - print() - - -def display_conf(kind, names, getter): - col1_width = max(map(len, names)) - FMT = '{name:>{col1_width}} {value}' - print(FMT.format(name=kind, - value='value', - col1_width=col1_width)) - print('{0} {1}'.format('-' * col1_width, '-' * 27)) - for name in names: - try: - value = getter(name) - except OSError as err: - value = err - print(FMT.format(name=name, value=value, col1_width=col1_width)) - print() - - -def main(): - fd = sys.stdin.fileno() - locale.setlocale(locale.LC_ALL, '') - encoding = locale.getpreferredencoding() - - print('os.isatty({0}) => {1}'.format(fd, os.isatty(fd))) - print('locale.getpreferredencoding() => {0}'.format(encoding)) - - display_conf(kind='pathconf', - names=os.pathconf_names, - getter=lambda name: os.fpathconf(fd, name)) - - try: - (iflag, oflag, cflag, lflag, ispeed, ospeed, cc - ) = termios.tcgetattr(fd) - except termios.error as err: - print('stdin is not a typewriter: {0}'.format(err)) - else: - display_bitmask(kind='Input Mode', - bitmap=BITMAP_IFLAG, - value=iflag) - display_bitmask(kind='Output Mode', - bitmap=BITMAP_OFLAG, - value=oflag) - display_bitmask(kind='Control Mode', - bitmap=BITMAP_CFLAG, - value=cflag) - display_bitmask(kind='Local Mode', - bitmap=BITMAP_LFLAG, - value=lflag) - display_ctl_chars(index=CTLCHAR_INDEX, - cc=cc) - try: - print('os.ttyname({0}) => {1}'.format(fd, os.ttyname(fd))) - print('os.ctermid() => {0}'.format(os.ctermid())) - except OSError as e: - # Travis fails on ttyname with errno 0 'Error'. - print("Error inspecting TTY: {0}".format(e)) - -if __name__ == '__main__': - main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tools/teamcity-coverage-report.sh b/lldb/third_party/Python/module/pexpect-4.6/tools/teamcity-coverage-report.sh deleted file mode 100755 index 2e32241b7b7..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tools/teamcity-coverage-report.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# This is to be executed by each individual OS test. It only -# combines coverage files and reports locally to the given -# TeamCity build configuration. -set -e -set -o pipefail -[ -z ${TEMP} ] && TEMP=/tmp - -# combine all .coverage* files, -coverage combine - -# create ascii report, -report_file=$(mktemp $TEMP/coverage.XXXXX) -coverage report --rcfile=`dirname $0`/../.coveragerc > "${report_file}" 2>/dev/null - -# Report Code Coverage for TeamCity, using 'Service Messages', -# https://confluence.jetbrains.com/display/TCD8/How+To...#HowTo...-ImportcoverageresultsinTeamCity -# https://confluence.jetbrains.com/display/TCD8/Custom+Chart#CustomChart-DefaultStatisticsValuesProvidedbyTeamCity -total_no_lines=$(awk '/TOTAL/{printf("%s",$2)}' < "${report_file}") -total_no_misses=$(awk '/TOTAL/{printf("%s",$3)}' < "${report_file}") -total_no_covered=$((${total_no_lines} - ${total_no_misses})) -echo "##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='""${total_no_lines}""']" -echo "##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='""${total_no_covered}""']" - -# Display for human consumption and remove ascii file. -cat "${report_file}" -rm "${report_file}" diff --git a/lldb/third_party/Python/module/pexpect-4.6/tools/teamcity-runtests.sh b/lldb/third_party/Python/module/pexpect-4.6/tools/teamcity-runtests.sh deleted file mode 100755 index bcb28f78aa6..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tools/teamcity-runtests.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# -# This script assumes that the project 'ptyprocess' is -# available in the parent of the project's folder. -set -e -set -o pipefail - -if [ -z $1 ]; then - echo "$0 (2.6|2.7|3.3|3.4)" - exit 1 -fi - -export PYTHONIOENCODING=UTF8 -export LANG=en_US.UTF-8 - -pyversion=$1 -shift -here=$(cd `dirname $0`; pwd) -osrel=$(uname -s) -venv=teamcity-pexpect -venv_wrapper=$(which virtualenvwrapper.sh) - -if [ -z $venv_wrapper ]; then - echo "virtualenvwrapper.sh not found in PATH." >&2 - exit 1 -fi - -. ${venv_wrapper} -rmvirtualenv ${venv} || true -mkvirtualenv -p `which python${pyversion}` ${venv} || true -workon ${venv} - -# install ptyprocess -cd $here/../../ptyprocess -pip uninstall --yes ptyprocess || true -python setup.py install - -# install all test requirements -pip install --upgrade pytest-cov coverage coveralls pytest-capturelog - -# run tests -cd $here/.. -ret=0 -py.test \ - --cov pexpect \ - --cov-config .coveragerc \ - --junit-xml=results.${osrel}.py${pyversion}.xml \ - --verbose \ - --verbose \ - "$@" || ret=$? - -if [ $ret -ne 0 ]; then - # we always exit 0, preferring instead the jUnit XML - # results to be the dominate cause of a failed build. - echo "py.test returned exit code ${ret}." >&2 - echo "the build should detect and report these failing tests." >&2 -fi - -# combine all coverage to single file, report for this build, -# then move into ./build-output/ as a unique artifact to allow -# the final "Full build" step to combine and report to coveralls.io -`dirname $0`/teamcity-coverage-report.sh -mkdir -p build-output -mv .coverage build-output/.coverage.${osrel}.py{$pyversion}.$RANDOM.$$ |