diff options
author | Davide Italiano <davide@freebsd.org> | 2019-03-12 20:41:36 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2019-03-12 20:41:36 +0000 |
commit | 4be269e604c380a974a01623796b23f41986f974 (patch) | |
tree | 5e1598417a60668344a8a08d74188903ef233454 /lldb/third_party/Python/module/pexpect-4.6/tests | |
parent | 2bd995b7e8fda6d51cb586e4a0f92ea1d99596e0 (diff) | |
download | bcm5719-llvm-4be269e604c380a974a01623796b23f41986f974.tar.gz bcm5719-llvm-4be269e604c380a974a01623796b23f41986f974.zip |
[lldb/thirdparty] Remove unneeded files, asked by Jonas.
llvm-svn: 355969
Diffstat (limited to 'lldb/third_party/Python/module/pexpect-4.6/tests')
66 files changed, 0 insertions, 6536 deletions
diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/PexpectTestCase.py b/lldb/third_party/Python/module/pexpect-4.6/tests/PexpectTestCase.py deleted file mode 100644 index 307437efad3..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/PexpectTestCase.py +++ /dev/null @@ -1,108 +0,0 @@ - -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function - -import contextlib -import unittest -import signal -import sys -import os - - -class PexpectTestCase(unittest.TestCase): - def setUp(self): - self.PYTHONBIN = sys.executable - self.original_path = os.getcwd() - tests_dir = os.path.dirname(__file__) - self.project_dir = project_dir = os.path.dirname(tests_dir) - - # all tests are executed in this folder; there are many auxiliary - # programs in this folder executed by spawn(). - os.chdir(tests_dir) - - # If the pexpect raises an exception after fork(), but before - # exec(), our test runner *also* forks. We prevent this by - # storing our pid and asserting equality on tearDown. - self.pid = os.getpid() - - coverage_rc = os.path.join(project_dir, '.coveragerc') - os.environ['COVERAGE_PROCESS_START'] = coverage_rc - os.environ['COVERAGE_FILE'] = os.path.join(project_dir, '.coverage') - print('\n', self.id(), end=' ') - sys.stdout.flush() - - # some build agents will ignore SIGHUP and SIGINT, which python - # inherits. This causes some of the tests related to terminate() - # to fail. We set them to the default handlers that they should - # be, and restore them back to their SIG_IGN value on tearDown. - # - # I'm not entirely convinced they need to be restored, only our - # test runner is affected. - self.restore_ignored_signals = [ - value for value in (signal.SIGHUP, signal.SIGINT,) - if signal.getsignal(value) == signal.SIG_IGN] - if signal.SIGHUP in self.restore_ignored_signals: - # sighup should be set to default handler - signal.signal(signal.SIGHUP, signal.SIG_DFL) - if signal.SIGINT in self.restore_ignored_signals: - # SIGINT should be set to signal.default_int_handler - signal.signal(signal.SIGINT, signal.default_int_handler) - unittest.TestCase.setUp(self) - - def tearDown(self): - # restore original working folder - os.chdir(self.original_path) - - if self.pid != os.getpid(): - # The build server pattern-matches phrase 'Test runner has forked!' - print("Test runner has forked! This means a child process raised " - "an exception before exec() in a test case, the error is " - "more than likely found above this line in stderr.", - file=sys.stderr) - exit(1) - - # restore signal handlers - for signal_value in self.restore_ignored_signals: - signal.signal(signal_value, signal.SIG_IGN) - - if sys.version_info < (2, 7): - # We want to use these methods, which are new/improved in 2.7, but - # we are still supporting 2.6 for the moment. This section can be - # removed when we drop Python 2.6 support. - @contextlib.contextmanager - def assertRaises(self, excClass): - try: - yield - except Exception as e: - assert isinstance(e, excClass) - else: - raise AssertionError("%s was not raised" % excClass) - - @contextlib.contextmanager - def assertRaisesRegexp(self, excClass, pattern): - import re - try: - yield - except Exception as e: - assert isinstance(e, excClass) - assert re.match(pattern, str(e)) - else: - raise AssertionError("%s was not raised" % excClass) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/README b/lldb/third_party/Python/module/pexpect-4.6/tests/README deleted file mode 100644 index ef5b613498e..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/README +++ /dev/null @@ -1,8 +0,0 @@ - -The best way to run these tests is from the directory above this one. Run: - - py.test - -To run a specific test file: - - py.test tests/test_constructor.py diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/TESTDATA.txt b/lldb/third_party/Python/module/pexpect-4.6/tests/TESTDATA.txt deleted file mode 100644 index adb9c01360f..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/TESTDATA.txt +++ /dev/null @@ -1,8 +0,0 @@ -This is test data. - One - 2 - THREE - IV - ..... - 110 -This is the end of test data: END diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/__init__.py b/lldb/third_party/Python/module/pexpect-4.6/tests/__init__.py deleted file mode 100755 index f717d82ecf5..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ - -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -# __init__.py -# The mere presence of this file makes the dir a package. -pass - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/adhoc.py b/lldb/third_party/Python/module/pexpect-4.6/tests/adhoc.py deleted file mode 100755 index 0813d349ee9..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/adhoc.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function - -import pexpect -import time - -p = pexpect.spawn ('./a.out') -print(p.exitstatus) -p.expect (pexpect.EOF) -print(p.before) -time.sleep(1) -print('exitstatus:', p.exitstatus) -print('isalive',p.isalive()) -print('exitstatus',p.exitstatus) -print('isalive',p.isalive()) -print('exitstatus',p.exitstatus) - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/alarm_die.py b/lldb/third_party/Python/module/pexpect-4.6/tests/alarm_die.py deleted file mode 100644 index a1519abac1d..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/alarm_die.py +++ /dev/null @@ -1,5 +0,0 @@ -import signal, time - -signal.alarm(1) # Schedule SIGALRM in 1s - -time.sleep(6)
\ No newline at end of file diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/bambi.vt b/lldb/third_party/Python/module/pexpect-4.6/tests/bambi.vt deleted file mode 100644 index 853f099b4c5..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/bambi.vt +++ /dev/null @@ -1,417 +0,0 @@ -[?25l -[1;24r -[2J -[10;1H The -[10;1H The Adventures -[10;1H The Adventures of -[10;1H The Adventures of BAMBI -[16;1H -[15;1H Number -[15;1H Number One : -[15;1H Number One : BAMBI -[15;1H Number One : BAMBI versus -[15;1H Number One : BAMBI versus GODZILLA -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[16;1H -[2J -[23;5H ,| *./[24;5H\|(/|/[1;1H -[22;38H /|[23;38H |/`|',[24;38H/| \|/[1;1H -[23;65H \/_,| /| /,[24;65H /<|\\/\|/|\[1;1H -[15;1H _^_ -[16;1H o / .\ -[17;1H \,--------; __o -[18;1H / .:::. . / -[19;1H \___________/ -[20;1H |\ |\ -[21;1H | > | \ -[22;1H / / | \ -[15;2H _^_ -[16;2H o / .\ -[17;2H \,--------; __o -[18;2H / .:::. . / -[19;2H \___________/ -[20;2H \| |\ -[21;2H \ | \ -[22;2H / \ / | -[15;3H _^_ -[16;3H o / .\ -[17;3H \,--------; __o -[18;3H / .:::. . / -[19;3H \___________/ -[20;3H \\ \| -[21;3H \\ \ -[22;3H | \ |\ -[15;4H _^_ -[16;4H o / .\ -[17;4H \,--------; __o -[18;4H / .:::. . / -[19;4H \___________/ -[20;4H \\ \| -[21;4H >\ \ -[22;4H / | /| -[15;5H _^_ -[16;5H o / .\ -[17;5H \,--------; __o -[18;5H / .:::.. . / -[19;5H \___________/ -[20;5H |\ |\ -[21;5H | > | \ -[22;5H / / | \ -[15;6H _^_ -[16;6H o / .\ -[17;6H \,--------; __o -[18;6H / .:::.. . / -[19;6H \___________/ -[20;6H \| |\ -[21;6H \ | \ -[22;6H / \ / | -[15;18H -[16;18H -[17;18H--,_^_ -[18;18H. .\ -[19;18H__--___o -[17;18H--_ -[18;18H. \ -[19;18H__ \/| -[20;18H|\( .| -[21;18H| \\ / -[22;18H | " -[17;18H--_ -[18;18H. \ -[19;18H__ \/| -[20;18H|\( .| -[21;18H| \\ / -[22;18H | " -[17;18H--_ -[18;18H. \ -[19;18H__ \/| -[20;18H|\( .| -[21;18H| \\ / -[22;18H | " -[17;18H--_ -[18;18H. \ -[19;18H__ \/| -[20;18H|\( .| -[21;18H| \\ / -[22;18H | " -[17;18H--,_^_ -[18;18H. .\ -[19;18H__--___o -[20;18H|\ -[21;18H| \ -[22;18H | -[15;7H _^_ -[16;7H o / .\ -[17;7H \,--------; __o -[18;7H / .:::.. . / -[19;7H \___________/ -[20;7H \\ \| -[21;7H \\ \ -[22;7H | \ |\ -[15;8H _^_ -[16;8H o / .\ -[17;8H \,--------; __o -[18;8H / .:::.. . / -[19;8H \___________/ -[20;8H \\ \| -[21;8H >\ \ -[22;8H / | /| -[15;9H _^_ -[16;9H o / .\ -[17;9H \,--------; __o -[18;9H / .:::.. . / -[19;9H \___________/ -[20;9H |\ |\ -[21;9H | > | \ -[22;9H / / | \ -[15;10H _^_ -[16;10H o / .\ -[17;10H \,--------; __o -[18;10H / .:::.. . / -[19;10H \___________/ -[20;10H \| |\ -[21;10H \ | \ -[22;10H / \ / | -[15;11H _^_ -[16;11H o / .\ -[17;11H \,--------; __o -[18;11H / .:::.. . / -[19;11H \___________/ -[20;11H \\ \| -[21;11H \\ \ -[22;11H | \ |\ -[15;12H _^_ -[16;12H o / .\ -[17;12H \,--------; __o -[18;12H / .:::.. . / -[19;12H \___________/ -[20;12H \\ \| -[21;12H >\ \ -[22;12H / | /| -[15;13H _^_ -[16;13H o / .\ -[17;13H \,--------; __o -[18;13H / .:::.. . / -[19;13H \___________/ -[20;13H |\ |\ -[21;13H | > | \ -[22;13H / / | \ -[15;14H _^_ -[16;14H o / .\ -[17;14H \,--------; __o -[18;14H / .:::.. . / -[19;14H \___________/ -[20;14H \| |\ -[21;14H \ | \ -[22;14H / \ / | -[15;15H _^_ -[16;15H o / .\ -[17;15H \,--------; __o -[18;15H / .:::.. . / -[19;15H \___________/ -[20;15H \\ \| -[21;15H \\ \ -[22;15H | \ |\ -[15;16H _^_ -[16;16H o / .\ -[17;16H \,--------; __o -[18;16H / .:::.. . / -[19;16H \___________/ -[20;16H \\ \| -[21;16H >\ \ -[22;16H / | /| -[15;17H _^_ -[16;17H o / .\ -[17;17H \,--------; __o -[18;17H / .:::.. . / -[19;17H \___________/ -[20;17H |\ |\ -[21;17H | > | \ -[22;17H / / | \ -[15;29H -[16;29H -[17;29H--,_^_ -[18;29H. .\ -[19;29H__--___o -[17;29H--_ -[18;29H. \ -[19;29H__ \/| -[20;29H|\( .| -[21;29H| \\ / -[22;29H| \" -[17;29H--_ -[18;29H. \ -[19;29H__ \/| -[20;29H|\( .| -[21;29H| \\ / -[22;29H| \" -[17;29H--,_^_ -[18;29H. .\ -[19;29H__--___o -[20;29H|\ -[21;29H| \ -[22;29H| \ -[17;29H--,_^_ -[18;29H. .\ -[19;29H__--___o -[20;29H|\ -[21;29H| \ -[22;29H| \ -[17;29H--_ -[18;29H. \ -[19;29H__ \/| -[20;29H|\( .| -[21;29H| \\ / -[22;29H| \" -[17;29H--_ -[18;29H. \ -[19;29H__ \/| -[20;29H|\( .| -[21;29H| \\ / -[22;29H| \" -[17;29H--_ -[18;29H. \ -[19;29H__ \/| -[20;29H|\( .| -[21;29H| \\ / -[22;29H| \" -[17;29H--,_^_ -[18;29H. .\ -[19;29H__--___o -[20;29H|\ -[21;29H| \ -[22;29H| \ -[15;18H _^_ -[16;18H o / .\ -[17;18H \,--------; __o -[18;18H / .:::.. . / -[19;18H \___________/ -[20;18H \| |\ -[21;18H \ | \ -[22;18H / \ / | -[15;19H _^_ -[16;19H o / .\ -[17;19H \,--------; __o -[18;19H / .:::.. . / -[19;19H \___________/ -[20;19H \\ \| -[21;19H \\ \ -[22;19H | \ |\ -[15;20H _^_ -[16;20H o / .\ -[17;20H \,--------; __o -[18;20H / .:::.. . / -[19;20H \___________/ -[20;20H \\ \| -[21;20H >\ \ -[22;20H / | /| -[15;21H _^_ -[16;21H o / .\ -[17;21H \,--------; __o -[18;21H / .:::.. . / -[19;21H \___________/ -[20;21H |\ |\ -[21;21H | > | \ -[22;21H / / | \ -[15;22H _^_ -[16;22H o / .\ -[17;22H \,--------; __o -[18;22H / .:::.. . / -[19;22H \___________/ -[20;22H \| |\ -[21;22H \ | \ -[22;22H / \ / | -[15;23H _^_ -[16;23H o / .\ -[17;23H \,--------; __o -[18;23H / .:::.. . / -[19;23H \___________/ -[20;23H \\ \| -[21;23H \\ \ -[22;23H | \ |\ -[15;24H _^_ -[16;24H o / .\ -[17;24H \,--------; __o -[18;24H / .:::.. . / -[19;24H \___________/ -[20;24H \\ \| -[21;24H >\ \ -[22;24H / | /| -[15;24H -[16;24H o -[17;24H \,----------,_^_ -[18;24H / .:::.. . .\ -[19;24H \___________--___o -[20;24H \\ \| -[21;24H >\ \ -[22;24H / | /| -[15;24H -[16;24H o -[17;24H \,----------_ -[18;24H / .:::.. . \ -[19;24H \___________ \/| -[20;24H \\ \|( .| -[21;24H >\ \ \ / -[22;24H / | /| " -[1;15r -[1;10H`' `.__________________________________/M -[1;10H( / ([1;54H/M -[1;10H(-.___[1;55H)M -[1;11H/ \/[1;55H)M -[1;12H_______.--'[1;54H\M -[1;23H,____________/[1;53H\M -[1;37H( / )M -[1;37H( ) /M -[1;37H\ \ )M -[1;36H( )M -[1;36H( ( /M -[1;36H\ ( )M -[1;35H( \ )M -[1;35H( ( /M -[1;16r -[1;35H\ ( ) )M -[1;17r -[1;34H( ( / )M -[1;18r -[1;34H( \ ) /M -[1;19r -[1;34H\ ( ) )M -[1;20r -[1;33H( ) )M -[1;21r -[1;33H( ) /M -[1;22r -[1;33H\ / )M -[1;24r -[1;32H( ) ) -[23;25H / > | \ -[1;1H -[1;1H -[10;1H T[10;1H T[10;1H T -[10;1H T H[10;1H T H[10;1H T H -[10;1H T H E[10;1H T H E[10;1H T H E [10;1H T H E -[10;1H T H E E[10;1H T H E E[10;1H T H E E -[10;1H T H E E N[10;1H T H E E N[10;1H T H E E N -[10;1H T H E E N D[10;1H T H E E N D -[11;1H =============== -[22;1H -[?25h diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/depricated_test_filedescriptor.py b/lldb/third_party/Python/module/pexpect-4.6/tests/depricated_test_filedescriptor.py deleted file mode 100755 index 6b0ef3e8cc8..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/depricated_test_filedescriptor.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -import PexpectTestCase -import os - -class ExpectTestCase(PexpectTestCase.PexpectTestCase): - def setUp(self): - print(self.id()) - PexpectTestCase.PexpectTestCase.setUp(self) - - def test_fd (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - s.expect ('This is the end of test data:') - s.expect (pexpect.EOF) - assert s.before == ' END\n' - - def test_maxread (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - s.maxread = 100 - s.expect('2') - s.expect ('This is the end of test data:') - s.expect (pexpect.EOF) - assert s.before == ' END\n' - - def test_fd_isalive (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - assert s.isalive() - os.close (fd) - assert not s.isalive() - - def test_fd_isatty (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = pexpect.spawn (fd) - assert not s.isatty() - os.close(fd) - -### def test_close_does_not_close_fd (self): -### '''Calling close() on a pexpect.spawn object should not -### close the underlying file descriptor. -### ''' -### fd = os.open ('TESTDATA.txt', os.O_RDONLY) -### s = pexpect.spawn (fd) -### try: -### s.close() -### self.fail('Expected an Exception.') -### except pexpect.ExceptionPexpect, e: -### pass - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase, 'test') - -#fout = open('delete_me_1','wb') -#fout.write(the_old_way) -#fout.close -#fout = open('delete_me_2', 'wb') -#fout.write(the_new_way) -#fout.close diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/echo_w_prompt.py b/lldb/third_party/Python/module/pexpect-4.6/tests/echo_w_prompt.py deleted file mode 100644 index 3c8055357df..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/echo_w_prompt.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import print_function - -try: - raw_input -except NameError: - raw_input = input - -while True: - try: - a = raw_input('<in >') - except EOFError: - print('<eof>') - break - print('<out>', a, sep='') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/echo_wait.py b/lldb/third_party/Python/module/pexpect-4.6/tests/echo_wait.py deleted file mode 100755 index e15205925cf..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/echo_wait.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import time -import termios -import sys - -# a dumb PAM will print the password prompt first then set ECHO -# False. What it should do it set ECHO False first then print the -# prompt. Otherwise, if we see the password prompt and type out -# password real fast before it turns off ECHO then some or all of -# our password might be visibly echod back to us. Sounds unlikely? -# It happens. - -print("fake password:") -sys.stdout.flush() -time.sleep(3) -attr = termios.tcgetattr(sys.stdout) -attr[3] = attr[3] & ~termios.ECHO -termios.tcsetattr(sys.stdout, termios.TCSANOW, attr) -time.sleep(12) -attr[3] = attr[3] | termios.ECHO -termios.tcsetattr(sys.stdout, termios.TCSANOW, attr) -time.sleep(2) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/exit1.py b/lldb/third_party/Python/module/pexpect-4.6/tests/exit1.py deleted file mode 100755 index 587b8adde79..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/exit1.py +++ /dev/null @@ -1,24 +0,0 @@ -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import os, sys - -print("Hello") -sys.stdout.flush() -os._exit(1) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/exit667.c b/lldb/third_party/Python/module/pexpect-4.6/tests/exit667.c deleted file mode 100644 index 962b9fdb676..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/exit667.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -*/ - -#include <stdio.h> -int main () -{ - printf ("Hello world!\n"); - exit(7); -} diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/fakessh/ssh b/lldb/third_party/Python/module/pexpect-4.6/tests/fakessh/ssh deleted file mode 100755 index d3259e4a252..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/fakessh/ssh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -from __future__ import print_function - -import getpass -import sys -PY3 = (sys.version_info[0] >= 3) -if not PY3: - input = raw_input - -server = sys.argv[-1] -if server == 'noserver': - print('No route to host') - sys.exit(1) - -print("Mock SSH client for tests. Do not enter real security info.") - -pw = getpass.getpass('password:') -if pw != 's3cret': - print('Permission denied!') - sys.exit(1) - -prompt = "$" -while True: - cmd = input(prompt) - if cmd.startswith('PS1='): - prompt = eval(cmd[4:]).replace('\$', '$') - elif cmd == 'ping': - print('pong') - elif cmd.startswith('ls'): - print('file1.py', 'file2.html', sep='\t') - elif cmd == 'echo $?': - print(0) - elif cmd in ('exit', 'logout'): - break diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/getch.py b/lldb/third_party/Python/module/pexpect-4.6/tests/getch.py deleted file mode 100755 index a362e521d31..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/getch.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function -import sys, tty, termios - -if hasattr(sys.stdin, 'buffer'): - # Python 3: we want to read raw bytes - stdin = sys.stdin.buffer -else: - stdin = sys.stdin - -def main(): - print('READY', end='\r\n') - while True: - try: - val = ord(stdin.read(1)) - except KeyboardInterrupt: - val = 3 - print('%d<STOP>' % (val,), end='\r\n') - if val == 0: - # StopIteration equivalent is ctrl+' ' (\x00, NUL) - break - -if __name__ == '__main__': - fd = sys.stdin.fileno() - old_settings = termios.tcgetattr(fd) - try: - tty.setraw(sys.stdin.fileno()) - main() - finally: - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) - sys.stdout.flush() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/globe.vt b/lldb/third_party/Python/module/pexpect-4.6/tests/globe.vt deleted file mode 100644 index 85dc78d7729..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/globe.vt +++ /dev/null @@ -1,690 +0,0 @@ -[H[J _-o#&&*''''?d:>b\_ - _o/"`'' '',, dMF9MMMMMHo_ - .o&#' `"MbHMMMMMMMMMMMHo. - .o"" ' vodM*$&&HMMMMMMMMMM?. - ,' $M&ood,~'`(&##MMMMMMH\ - / ,MMMMMMM#b?#bobMMMMHMMML - & ?MMMMMMMMMMMMMMMMM7MMM$R*Hk - ?$. :MMMMMMMMMMMMMMMMMMM/HMMM|`*L -| |MMMMMMMMMMMMMMMMMMMMbMH' T, -$H#: `*MMMMMMMMMMMMMMMMMMMMb#}' `? -]MMH# ""*""""*#MMMMMMMMMMMMM' - -MMMMMb_ |MMMMMMMMMMMP' : -HMMMMMMMHo `MMMMMMMMMT . -?MMMMMMMMP 9MMMMMMMM} - --?MMMMMMM |MMMMMMMMM?,d- ' - :|MMMMMM- `MMMMMMMT .M|. : - .9MMM[ &MMMMM*' `' . - :9MMk `MMM#" - - &M} ` .- - `&. . - `~, . ./ - . _ .- - '`--._,dd###pp=""' -[H _v->#H#P? "':o<>\_ - .,dP` `'' "'-o.+H6&MMMHo_ - oHMH9' `?&bHMHMMMMMMHo. - oMP"' ' ooMP*#&HMMMMMMM?. - ,M* - `*MSdob//`^&##MMMH\ - d*' .,MMMMMMH#o>#ooMMMMMb - HM- :HMMMMMMMMMMMMMMM&HM[R\ - d"Z\. 9MMMMMMMMMMMMMMMMM[HMM|: --H - MMMMMMMMMMMMMMMMMMMbMP' : -:??Mb# `9MMMMMMMMMMMMMMMMMMH#! . -: MMMMH#, "*""""`#HMMMMMMMMMMH - -||MMMMMM6\. {MMMMMMMMMH' : -:|MMMMMMMMMMHo `9MMMMMMMM' . -. HMMMMMMMMMMP' !MMMMMMMM ` -- `#MMMMMMMMM HMMMMMMM*,/ : - : ?MMMMMMMF HMMMMMM',P' : - . HMMMMR' {MMMMP' ^' - - : `HMMMT iMMH' .' - -.`HMH . - -:*H . ' - -`\,, . .- - ' . _ .-` - '`~\.__,obb#q==~''' -[H .ovr:HMM#?:`' >b\_ - .,:&Hi' `' "' \\|&bSMHo_ - oHMMM#*} `?&dMMMMMMHo. - .dMMMH"'''' ,oHH*&&9MMMM?. - ,MMM*' `*M\bd<|"*&#MH\ - dHH?' :MMMMMM#bd#odMML - H' |\ `dMMMMMMMMMMMMMM9Mk - JL/"7+,. `MMMMMMMMMMMMMMMH9ML --`Hp ' |MMMMMMMMMMMMMMMMHH|: -: \\#M#d? `HMMMMMMMMMMMMMMMMH. -. JMMMMM##, ``*""'"*#MMMMMMMMH --. ,MMMMMMMM6o_ |MMMMMMMM': -: |MMMMMMMMMMMMMb\ TMMMMMMT : -. ?MMMMMMMMMMMMM' :MMMMMM|.` -- ?HMMMMMMMMMM: HMMMMMM\|: - : 9MMMMMMMMH' `MMMMMP.P. - . `MMMMMMT'' HMMM*''- - - TMMMMM' MM*' - - '. HMM# - - -. `9M: .' - -. `b,, . . ' - '-\ ., .-` - '-:b~\\_,oddq==--" -[H _oo##'9MMHb':'-,o_ - .oH":HH$' ""' "' -\7*R&o_ - .oHMMMHMH#9: "\bMMMMHo. - dMMMMMM*""'`' .oHM"H9MM?. - ,MMMMMM' "HLbd<|?&H\ - JMMH#H' |MMMMM#b>bHb - :MH ."\ `|MMMMMMMMMMMM& - .:M:d-"|:b.. 9MMMMMMMMMMMMM+ -: "*H| - &MMMMMMMMMMMMMH: -. `LvdHH#d? `?MMMMMMMMMMMMMb -: iMMMMMMH#b `"*"'"#HMMMMMM -. . ,MMMMMMMMMMb\. {MMMMMH -- |MMMMMMMMMMMMMMHb, `MMMMM| -: |MMMMMMMMMMMMMMH' &MMMM, -- `#MMMMMMMMMMMM |MMMM6- - : `MMMMMMMMMM+ ]MMMT/ - . `MMMMMMMP" HMM*` - - |MMMMMH' ,M#'- - '. :MMMH| .- - . |MM - - ` . `#?.. . ..' - -. _. .- - '-|.#qo__,,ob=~~-'' -[H _ooppH[`MMMD::--\_ - _oHMR":&M&. ""' "' /&\\_ - oHMMMMMHMMH#9, `"<MMHo. - oHMMMMMMMM*""'`` .dMP#M?. - .dMMMMMMMM* `H\do?&\ - -iMMMHH#H' &MMMHb#? - : ZMM' 7-. `{MMMMMMMMH - . .M6_d|"`$|v.. 9MMMMMMMMML -- `'*H# : |MMMMMMMMMM: -: *\\dHM#dd. ?MMMMMMMMMb -- |MMMMMMM##\ `"*""?HMMM -: . |MMMMMMMMMMMo\. {MMM -. {MMMMMMMMMMMMMMMHo. `MMM -- ?MMMMMMMMMMMMMMM*' -MMP -: `#MMMMMMMMMMMMT dMM' - - |MMMMMMMMMMH' -MMT - : `MMMMMMMM"' JMP - - MMMMMMH' ,H? - '. HMMM#' : - . ?MM- . ' - -. *M:.. .- - - . _. .- - '-.~-dHb__\ov+~~-` -[H .oo>#&H6?*MMH:-.._ - .oHMMMR:"&MZ\ `"' " |$-_ - ..dMMMMMMMMdMMM#9\ `'HHo. - . ,dMMMMMMMMMMM"`' ` ?MP?. - . |MMMMMMMMMMM' `"$b&\ - - |MMMMHH##M' HMMH? - - TTMM| >.. \MMMMMH - : |MM\,#-""$~b\. `MMMMMM+ -. ``"H&# - &MMMMMM| -: *\v,#MHddc. `9MMMMMb -. MMMMMMMM##\ `"":HM -- . .HMMMMMMMMMMRo_. |M -: |MMMMMMMMMMMMMMMM#\ :M -- `HMMMMMMMMMMMMMMM' |T -: `*HMMMMMMMMMMMM' H' - : MMMMMMMMMMM| |T - . MMMMMMMM?' ./ - `. MMMMMMH' ./ - -. |MMMH#' . - . `MM* . ' - -. #M: . . .- - ` . ., .- - '-.-~ooHH__,,v~--` -[H _ood>H&H&Z?#M#b-\. - .\HMMMMMR?`\M6b."`' ''``v. - .. .MMMMMMMMMMHMMM#&. ``~o. - . ,HMMMMMMMMMMMM*"'-` &b. - . .MMMMMMMMMMMMH' `"&\ - - RMMMMM#H##R' 4Mb - - |7MMM' ?:: `|MMb - / HMM__#|`"\>?v.. `MMML -. `"'#Hd| ` 9MMM: -- |\,\?HH#bbL `9MMb -: !MMMMMMMH#b, `""T -. . ,MMMMMMMMMMMbo. | -: 4MMMMMMMMMMMMMMMHo | -: ?MMMMMMMMMMMMMMM? : --. `#MMMMMMMMMMMM: .- - : |MMMMMMMMMM? . - - JMMMMMMMT' : - `. MMMMMMH' - - -. |MMM#*` - - . HMH' . ' - -. #H:. .- - ` . .\ .- - '-..-+oodHL_,--/-` -[H _,\?dZkMHF&$*q#b.. - .//9MMMMMMM?:'HM\\"`-''`.. - ..` :MMMMMMMMMMHMMMMH?_ `-\ - . .dMMMMMMMMMMMMMM'"'" `\. - . |MMMMMMMMMMMMMR \\ - - T9MMMMMHH##M" `? - : (9MMM' !':. &k - .: HMM\_?p "":-b\. `ML -- "'"H&#, : |M| -: ?\,\dMH#b#. 9b -: |MMMMMMM##, `* -: . +MMMMMMMMMMMo_ - -: HMMMMMMMMMMMMMM#, : -: 9MMMMMMMMMMMMMH' . -: . *HMMMMMMMMMMP .' - : MMMMMMMMMH' . - - :MMMMMMM'` . - `. 9MMMMM*' - - -. {MMM#' : - - |MM" .' - `. &M'.. . ..' - ' . ._ .- - '-. -voboo#&:,-.-` -[H _oo:\bk99M[<$$+b\. - .$*"MMMMMMMM[:"\Mb\?^" . - . '` HMMMMMMMMMMHMMMM+?. `. - . .HMMMMMMMMMMMMMMP"'' . - . `MMMMMMMMMMMMMM| -`. - - `&MMMMMMHH##H: : - : `(*MMM} `|\ | - : `- ?MMb__#|""`|+v.. \ -. `''*H#b - :| -: `*\v,#M#b#, \ -. 9MMMMMMHb. : -: . #MMMMMMMMMb\ - -- .HMMMMMMMMMMMMb : -: `MMMMMMMMMMMMH . --: . `#MMMMMMMMMP ' - : ]MMMMMMMH' : - - ,MMMMMM?' . - `: HMMMMH" - - -. .HMM#* .- - `. .HH*' . - `-. &R". .- - -. ._ .- - '-. .voodoodc?..-` -[H _\oo\?ddk9MRbS>v\_ - ..:>*""MMMMMMMMM:?|H?$?-. - ..- - "HMMMMMMMMMMHMMMH\_-. - . dMMMMMMMMMMMMMMT" . - . TMMMMMMMMMMMMMM `. - - `&HMMMMMM#H#H: . - - `\7HMMH |\. . - : ` HMM\_?c`""+?\.. : -- "``#&#| . - -: `?,\#MHdb. . -: |MMMMMH#. : -: . ,HMMMMMMMb, - -: ' 4MMMMMMMMMMH` -: . 9MMMMMMMMMT- -:.` `#MMMMMMMH ' - : ' HMMMMMH': - - |MMMMH" - - `: |MMMH*' .' - '? dMM#' . - \. .dH" .' - -. ,M'- ..' - ` . .. ..-` - '-. .\ooooboo<^.-` -[H _o,:o?\?dM&MHcc~,. - ..^':&#""HMMMMMMMM$:?&&?. - .` -` 'HMMMMMMMMMHMMMp\. - . ' |MMMMMMMMMMMMMM"' . - . `9MMMMMMMMMMMMM -. - - `*9MMMMMHH##[ . - - `\Z9MMM `~\ . - : '| ?MMb_?p""-?v.. : -- `"'*&#, - . -: `?,oHH#? . --- |MMMMH,: -: . |MMMMMM6, -: - |MMMMMMMM -? HMMMMMMP --- . ' |HMMMMM' - :.` . ' JMMMM+ - \ ,MMMP: - : |MMH?: - -:\. dM#" . - \ ,H*' .' - -. d':..' - ` . .,.- - '-.. .\oooodov~^-` -[H _o\:,??\??MR9#cb\_ - .v/''':&#""#HMMMMMMM$?*d\. - ..~' - -` `"#MMMMMMMMMMMHv. - .-' HMMMMMMMMMMMR!. - : `9MMMMMMMMMMM| -. - . `*9MMMMMH##| . - - `(#MMH `:, . - : '| `HMb_>/"|\,.: -.' `"'#&b - . -: ?\oHH?. -: !MMM& -: . . HMMMM -/. - -MMMMM -\`. 9MMMP -:. . . - |MMM' - \... ' .MMT - &. .dMP - \, .HM* - \. `\. ,H&' - `- `| - ,&': - `. ,/\ ' - '-.. _.- - "---.._\o,oov+--'" -[H _,d?,:?o?:?HM>#b\_ - ..H*"''`'H#*"**MMMMMM6$$v_ - v//" - `` `'#MMMMMMMMHo. - /"` |MMMMMMMMMM:. - ,> `HMMMMMMMMH:. - : `#HMMMMHH\ - - ' `Z#MM, `,: - : '\ ?HH_>:`\, -: "'*&| `: -. <\Hb -: MM -: . iMM -Mb\. {MM -::.`- - !MP -`&. . . - :M' - 9H, \ ' |T - HM? ,P - *ML ?? - :&. `o .d' - ': |T /" - -. .<'' - `... ..- - "`-=.,_,,,oov-~.-` -[H _,oc>?_:b?o?HH#b\_ - .v/99*""" '*H#""*HMMMMMZ,_ - oH* /" - ' "`#MMMMM#o. - ./*>- `MMMMMMMb - ,b/' `#MMMMMMM\ - :' ``HMMMMb: - /- `|&MH `\ - / `-. |Hb??\ -,- ' "`&,. -1 \} -!. T -$,. . 1 -?`M??. M -?.::| '\ - ? - M?&. . . - ,' - 9MMH\ .. ' ` . - HMMM#. :' - 9#MMb .. - -:"# `b. .- - . ` {! / - - ,-' - ' . .- - ```^==\_.,,,ov--\-` -[H _\o##??,:io??$#b\_ - .oH#"H9*""" "`#H*"*#MMMHo_ - oHMM- -' - '' ``*HMMHo. - dM#S>-` ?MMMM?. - ,&&,/' "#MMMH\ - d?-" `*HMMb - H? "ZHb: - /: \ H?L -|:| . `*: -:?: \ ->" : -M|\,_ | -!|":HH?-'. : -:^'_:?"\ `-- - . -- |ML?b . .. - - - :HMMMMH\ \ ` : - >MMMMMM#. . - ^M*HMMM| - - `. `"#+ `?v .` - . `- +?' - - ` . ..' - - . .- - "`\b=p?.._\\vv---` -[H _,o#bH\??::?o?cbo_ - .o#MH#**SH""' "`*H#"*#MHo_ - oHMMMH^ ^" - ` '*HHo. - .dMMM#">>- `HM?. - ,MH:R_o/ `*MH\ - dMM' ' "ML - HMR! ' `#k - d&'. -. `L -:M :: ` `- -/| !| - -k.$-" : -}9R:!,,_. . -\::\':`*M#\-'. - -: "''..:"!`\ '- - ` -- ,HMb.H| . _ - .' - : ,MMMMMMMb. .. . - .`HMMMMMMMM? . - `.`9M#*HMMMM : - -.' "##* `b, . - . ` ,/' .' - ` . ..' - - . ..- - "`*#d##c.._\v----` -[H _,o#&oHb?\o::d?>\_ - .oHHMMM#**$M""` "`*HH"#&o_ - oHMMMMMMD' .'' - ' ``bo. - .dMMMMMH*'/|- `\b. - ,MMMM?T|_o/ `\\ - dMMMMP '' `| - HMMMH& - `\ - /MH7' : -- : --:MM {. . . -:i?' .!& . -:{, o| ' : --T?9M\:-'o,_ . -: \?::``"`?9MHo./.. - -. '"`'^ _.`"!"^. `- - ` -- ,bMM?.M\ . . - . .' - : .oMMMMMMMMb. .. ` . - . `HMMMMMMMMMMb - - - 9MH*#HMMMMH .' - '. ' `"*##' `b. : - . ` .d'' .' - -. . ' - -. .-` - "`*##H###:._\--.-` -[H _oo#H&d#b?\b:_>>\_ - .oHMMMMMMH*"*9R"'-``*#P\-_ - oHMMMMMMMMM$ ." ' `^- - .dMMMMMMMMH*",?- '\. - ,MMMMMMM:?}.,d' `. - dMMMMMMMH /'' : - HMMMMMMM&' - - - dPTMMP>' : -. : -|? -MM} .\ . -J' ::*' -$L . -: ?b .,H- ' : -- |6.&MP:: !.,_. - -: `\:: "' "`:"MM#,-^, - : -- ````:' _.:"?``\ `- . -: .?bMML.]# - _ ` . .' - - .o#MMMMMMMMH\ \. . . - - `HMMMMMMMMMMMH : - `. `HMM#*#MMMMMH' - - -. ' ``##*' i+ : - - `' v/' .' - `- ..' - ' . .- - "`*##HMH##:__,-.-` -[H _oo##Mbb&bo??o_>\_ - .oHMMMMMMMMM**#?M*' "?*&.. - oHMMMMMMMMMMMM4 `" - `. - .dMMMMMMMMMMMM#"\?.- . - ,MMMMMMMMMM}"9:_,d' -. - dMMMMMMMMMMM| ^'' . - &MMMMMMMMMMH\ - . - :{M*"MMMPT"' : `-. : -.'M' 'MMM. -T, . . -- k i:?'' -|& . -: ` -o& .,H- " : -- `M:`HMP|:'!.o._. . -: "<:::'<^ '"``9MH#,-^ . - -- '''``''._.`"?`^| ^ - : -: ?#dMM_.M? . . - ..' - : ,ddMMMMMMMMMb. .. ' . - . TMMMMMMMMMMMMM, : - - ?MMH**#MMMMMH' : - '. ' "`##*' &. : - -. `' ,~" .' - -. ..' - ` . .- - ```*##HMMMH#<:,..-` -[H _,dd#HMb&dHo?\?:\_ - .oHMMMMMMMMMMMH***9P'`"\v. - oHMMMMMMMMMMMMMMM> `' -. - .dMMMMMMMMMMMMMMMH*'|~-' . - ,MMMMMMMMMMMMM6>`H._,& -. - dMMMMMMMMMMMMMMM| `" . - H*MMMMMMMMMMMMMH&. - . - d' HMM""&MMMPT'' :. `.- -,' MP `TMMM, |: . - -| #: ? *" : &L : -! `' /?H ,#r `' : -. ?M: HMM^<~->,o._ : -: `9:::'`*-``':`9MHb,|-, ' : -. `"''':' :_ ""!"^. `| : -`. _dbHM6_|H. . . ' .' - \ _odHMMMMMMMMH, .. ` : - `- |MMMMMMMMMMMMM| : - `. 9MMH**#MMMMMH' : - -. ' "?##" d : - . ' ,/" .' - `.. ..' - ` . .- - '`"#HHMMMMM#<>..-` -[H _oo##bHMb&d#bd,>\_ - .oHMMMMMMMMMMMMMM***9R"-.. - oHMMMMMMMMMMMMMMMMMH\ ? `-. - .dMMMMMMMMMMMMMMMMMMM#".}-' . - ,MMMMMMMMMMMMMMMMM6/`H _o} -. - dMMMMMMMMMMMMMMMMMMML `'' . - HbP*HMMMMMMMMMMMMMMM*: - , - dMH' `MMMP'"HMMMR'T" : : -|H' -MR' `?MMMb P, . . -1& *| |.`*" .-`&| . -M' " |\&| .,#~ "' : -T :HL.|HMH\c~`|v,\_ : -| `"|:::':`-`` '"MM#\-'. -: -% ``'``'`' :_ '?'`| ``. : -||, ,#dMM?.M? . .` - - ?\ .,odMMMMMMMMM? \ ` : - / |MMMMMMMMMMMMM: .' - `. TMMH#*9MMMMM* : - -. ` "*#*' ,: . - . ` .v'' .' - `. ..' - '- . .- - "`\+HHMMMMMMHr~.-` -[H _,,>#b&HMHd&&bb>\_ - _oHMMMMMMMMMMMMMMMMH**H:. - oHMMMMMMMMMMMMMMMMMMMM#v`? `. - .dMMMMMMMMMMMMMMMMMMMMMMH*`+| . - ,MMMMMMMMMMMMMMMMMMMMMb|?+.,H -. - ddHMMMMMMMMMMMMMMMMMMMMMb `' . - HMMkZ**HMMMMMMMMMMMMMMMMH\ - . : - dTMMM* `9MMMP'"*MMMMPT"` .. : -|M6H'' 4MP' `"HMMM| !|. . . -1MHp' #L $ *"' .-:&. . -MMM' " q:H. .o#-``' : -MM' ?H?.|MMH::::-o,_. - -M[ `*?:::'|` `"`:9MH\~-. ` -&M. ""'`'^'.:.`?'`. '| -: -`M|d, .dbHM[.1? .. : - 9||| . _obMMMMMMMMH, . : - H.^ MMMMMMMMMMMM} - - \ |MMH#*HMMMMH' .' - . ` `#*' ,:- - ` '' .-'. - `. .- - '- . .-` - '`\bqHMMMMMMHHb--` -[H .,:,#&6dHHHb&##o\_ - .oHHMMMMMMMMMMMMMMMMMH*\,. - oHMMMMMMMMMMMMMMMMMMMMMMHb:'-. - .dMMMMMMMMMMMMMMMMMMMMMMMMMH|\/' . - ,&HMMMMMMMMMMMMMMMMMMMMMMM/"&.,d. -. - dboMMHMMMMMMMMMMMMMMMMMMMMMML `' . - HMHMMM$Z***MMMMMMMMMMMMMMMMMM|.- . - dMM}MMMM#' `9MMMH?"`MMMMR'T' _ : -|MMMbM#'' |MM" ``MMMH. <_ . -dMMMM#& *&. .?`*" .'&: . -MMMMMH- `' -v/H .dD "' ' : -MMMM* `*M: 4MM*::-!v,_ : -MMMM `*?::" "'``"?9Mb::. : -&MMM, `"'"'|"._ "?`| - : -`MMM}.H ,#dM[_H ..: - 9MMi`M: . .ooHMMMMMMM, .. - 9Mb `- 1MMMMMMMMMM| : - ?M |MM#*#MMMM* . - -. ` |#"' ,' - . -" v` - -. .- - - . . ` - '-*#d#HHMMMMHH#"-' -[H _,<_:&S6dHHHb&bb\_ - .odHMMMMMMMMMMMMMMMMMMM}-_ - .oHMMMMMMMMMMMMMMMMMMMMMMMM#d:. - ?9MMMMMMMMMMMMMMMMMMMMMMMMMMMH-$ . - ,::dHMMMMMMMMMMMMMMMMMMMMMMMMH:\.?? -. - dMdboHMMHMMMMMMMMMMMMMMMMMMMMMMH, ' . - HMMMM7MMMb$R***MMMMMMMMMMMMMMMMMH\ - . - dMMMMM/MMMMM* `$MMMM*'"*MMMM?&' . : -|MMMMMMb1H*' HMP' '9MMM| &. . . -dMMMMMMM##~` `#\ |.`*" .-9. : -9MMMMMMMM* ` |v7? .,H `' ` : -SMMMMMMH' '9M_-MMH::-\v_ : -:HMMMMM `\_:"'|'`':9Mv\. --|MMMMM, ""`'`':.`?\ \ -`:MMMMM}.d} .?bM6,| | - :?MMM6 M| . .,oHMMMMM| / - .?MMM- `' &MMMMMMMM|. - -`HM- HMH#*MMM?: - '. ' `#*:` - - -'/ - ` . . ' - ` . . ` - '--##HH#HMMMHH#""` -[H _o,d_?dZdoHHHb#b\_ - .vdMMMMMMMMMMMMMMMMMMMMH\. - .,HHMMMMMMMMMMMMMMMMMMMMMMMMH&,. - /?RMMMMMMMMMMMMMMMMMMMMMMMMMMMMH|.. - ,\?>`T#RMMMMMMMMMMMMMMMMMMMMMMMM6`\|/ - dMMbd#ooHMMMHMMMMMMMMMMMMMMMMMMMMMH,`' ' - HMMMMMMMTMMMMb$ZP**HMMMMMMMMMMMMMMMM|. : - dMMMMMMMM}$MMMMMH' `HMMMH?"`MMMM?T' . : -|MMMMMMMMMMoMH*'' `MM? ``MMM| +\ . -1MMMMMMMMMMMb#/ ?#? |`#" -T: : -*'HMMMMMMMMMM*' " ~?& .?} ' ' . -- 4MMMMMMMMP" `M? HMTc:\\.: -: `MMMMMMM[ "#:::`>`"?M{ -. |MMMMMMH. ``'``'_`:- -- |MMMMMMM|.dD ,#Mb\' - : *MMMMM: iM| . _oHMMMM: - . ?MMMM' "' ,MMMMMMP - : `HMH JM#*MMT - -. ' ` #' - . / - -. - .' - -. . ` - '--=&&MH##HMHH#""" -[H .-:?,Z?:&$dHH##b\_ - ,:bqRMMMMMMMMMMMMMMMMMHo. - .?HHHMMMMMMMMMMMMMMMMMMMMMMMHo. - -o/*M9MMMMMMMMMMMMMMMMMMMMMMMMMMMv - .:H\b\'|?#HHMMMMMMMMMMMMMMMMMMMMMM6?Z\ - .?MMMHbdbbodMMMMHMMMMMMMMMMMMMMMMMMMM\': - :MMMMMMMMMMM7MMMMb?6P**#MMMMMMMMMMMMMMM_ : - \MMMMMMMMMMMMb^MMMMMM? `*MMMM*"`MMMR<' . - -.1MMMMMMMMMMMMMb]M#"" 9MR' `?MMb \. : --MMMMMMMMMMMMMMMH##|` *&. |`*' .\ . --?""*MMMMMMMMMMMMM' ' |?b ,}" : -: MMMMMMMMMMH' `M_|M}r\? -. `MMMMMMMMM' `$_:`'"H -- TMMMMMMMM, '"``:: -: {MMMMMMMM| oH| .#M- - : `9MMMMMM' .MP . ,oMMT - . HMMMMP' `' ,MMMP - - `MMH' HH9* - '. ` ` .' - - . ' - ` . - .- - ` . .- - ' -==pHMMH##HH#""" -[H _..-:b&::&?&&##bo_ - ...?-#&9MMMMMMMMMMMMMMMHo_ - .. .1&#MMHMMMMMMMMMMMMMMMMMMMHo. - . .o/##R9MMMMMMMMMMMMMMMMMMMMMMMM?. - .- |MSd?|'`$?#HMMMMMMMMMMMMMMMMMMMMMH\ - - dMMMMHbd##oodMMMM#MMMMMMMMMMMMMMMMMH: - - JMMMMMMMMMMMMM7HMMMH$SR***MMMMMMMMMMMMb> - : {MMMMMMMMMMMMMMM`9MMMMMH' ``HMMM?"*MM[| : -- |MMMMMMMMMMMMMMMMM<MH*'' `MM' 'HM? |. -: `MMMMMMMMMMMMMMMMMM##H-' `#, ` |`? /| -. ?"""?HMMMMMMMMMMMMMH' " v& .}? -- |MMMMMMMMMMMP' `H:&H& -i `9MMMMMMMMMT `|?"? -: MMMMMMMMMH "`\ -: MMMMMMMMMH-.dH ,| - : ?MMMMMMM? {M' . .dT - . ?MMMMMR' `' ,MP - - `HMM#' .&* - '. ' `. - - . ' - `.. .- - -. .- - '-.==p##HMMHp&#""" -[H _v---:?&?:?&?&#b\_ - ..' i: #M$MMMMMMMMMMMMMHo_ - .. -]M#HMHMMMMMMMMMMMMMMMMMHo. - . ooP*&6&MMMMMMMMMMMMMMMMMMMMM?. - . - &Rbbd-/`?:##HMMMMMMMMMMMMMMMMMH? - - ,HMMMMM#od#boodMMMMHMMMMMMMMMMMMMMb - - iMMMMMMMMMMMMMMM[*MMMH&$R***MMMMMMMMMb - : |MMMMMMMMMMMMMMMMML"MMMMMM' ``MMMP"HMM: -. HMMMMMMMMMMMMMMMMMMb/MH"" `MR *M,| -: TMMMMMMMMMMMMMMMMMMMMd#&` `D. ?|\ -. `*"'"*HMMMMMMMMMMMMMMP' ' -d,J -: |MMMMMMMMMMMMP' ||M -M, ?MMMMMMMMMM| `\? -&| HMMMMMMMMM} `` -`L .MMMMMMMMMMP ,d| : - *. ?MMMMMMMF' .MP / - | TMMMMMM' `"' / - `. `MMMP' ./ - -. ` . - . . ' - - . .- - -\ ..- - '-..=p####HMH&=""" -[H _vo~^'':&b::d,#b\_ - ..`" `:v +9P]MMMMMMMMMMHo_ - ,- ?Mb#MMMMMMMMMMMMMMMMMHo. - . " ,ooM*&&&HMMMMMMMMMMMMMMMMHb. - . - 99Soo?|'`*?##HMMMMMMMMMMMMMH\ - - .HMMMMMM#od#boodMMMMHMMMMMMMMMMb - - :MMMMMMMMMMMMMMMM67HMMH&$R**HMMMMMb - : .MMMMMMMMMMMMMMMMMMM/HMMMMM| `9MM'HL -: {MMMMMMMMMMMMMMMMMMMM\MM*'' `H[ `9| -| `HMMMMMMMMMMMMMMMMMMMMb##| `F. :? -H `"*"'"`#MMMMMMMMMMMMMMM? ' k -M. MMMMMMMMMMMMM"' H -MMH. `HMMMMMMMMMM: | -&MM| `MMMMMMMMMM, - -`MM| dMMMMMMMMMM|.oH : - 9ML `HMMMMMMM? dH' - - Hi |MMMMMMP "' .' - T. `MMM#' - - `. ` .` - ` - - `.. . ..' - ... .- - '-. //######M#b~"" -[H _ooq=""''$b$_&?b\_ - .-`^" "'o |&M:MMMMMMMMHo_ - o/' -$Mb#MMMMMMMMMMMMMMHo. - /' .ooHP*&R&MMMMMMMMMMMMMM?. - .' `MRbod?|'`+?##9MMMMMMMMMH\ - .` .,MMMMMMH#od##obdMMMMHMMMMMMb - - ?MMMMMMMMMMMMMMMMM$HMMH$ZP*HMMb - ? |MMMMMMMMMMMMMMMMMMM|9MMMMP "M6\ -.- dMMMMMMMMMMMMMMMMMMMMb]M*' |R | -1| `HMMMMMMMMMMMMMMMMMMMMMd#| ?,: -MH, ``*""'"*#MMMMMMMMMMMMMM* '` -MM6_ |MMMMMMMMMMMMH" : -MMMMMb. "MMMMMMMMMMT - -&MMMMM' |MMMMMMMMMH ` -!MMMMb .HMMMMMMMMM+.?& : - TMMMM *MMMMMMMP dH' . : - 9MM' `MMMMMMP' "' . - 9ML `MMM#' - - `H ` : - `\. .' - `-\ . .- - ' ._ .-` - '-\. ,b#####p&**^` diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/interact.py b/lldb/third_party/Python/module/pexpect-4.6/tests/interact.py deleted file mode 100755 index a839e9502f9..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/interact.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -try: - # This allows coverage to measure code run in this process - import coverage - coverage.process_startup() -except ImportError: - pass - -from utils import no_coverage_env -import pexpect -import sys - - -def main(): - p = pexpect.spawn('{sys.executable} getch.py'.format(sys=sys), - env=no_coverage_env()) - - # defaults matches api - escape_character = chr(29) - encoding = None - - if len(sys.argv) > 1 and '--no-escape' in sys.argv: - escape_character = None - - if len(sys.argv) > 1 and '--utf8' in sys.argv: - encoding = 'utf8' - - p.interact(escape_character=escape_character) - - print("Escaped interact") - -if __name__ == '__main__': - main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/list100.py b/lldb/third_party/Python/module/pexpect-4.6/tests/list100.py deleted file mode 100644 index 3b2b6ec3581..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/list100.py +++ /dev/null @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- -print(list(range(100))) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/needs_kill.py b/lldb/third_party/Python/module/pexpect-4.6/tests/needs_kill.py deleted file mode 100755 index 810236bdad6..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/needs_kill.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python -"""This script can only be killed by SIGKILL.""" -import signal, time - -# Ignore interrupt, hangup and continue signals - only SIGKILL will work -signal.signal(signal.SIGINT, signal.SIG_IGN) -signal.signal(signal.SIGHUP, signal.SIG_IGN) -signal.signal(signal.SIGCONT, signal.SIG_IGN) - -print('READY') -while True: - time.sleep(10) -
\ No newline at end of file diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/pexpectTest.py b/lldb/third_party/Python/module/pexpect-4.6/tests/pexpectTest.py deleted file mode 100755 index 6839a2f7053..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/pexpectTest.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import time -import pexpect -import sys - -def getProcessResults(cmd, timeLimit=20): - ''' - executes 'cmd' as a child process and returns the child's output, - the duration of execution, and the process exit status. Aborts if - child process does not generate output for 'timeLimit' seconds. - ''' - output = "" - startTime = time.time() - child = pexpect.spawn(cmd, timeout=10) - child.logfile = sys.stdout - - while 1: - try: - # read_nonblocking will add to 'outout' one byte at a time - # newlines can show up as '\r\n' so we kill any '\r's which - # will mess up the formatting for the viewer - output += child.read_nonblocking(timeout=timeLimit).replace("\r","") - except pexpect.EOF as e: - print(str(e)) - # process terminated normally - break - except pexpect.TIMEOUT as e: - print(str(e)) - output += "\nProcess aborted by FlashTest after %s seconds.\n" % timeLimit - print(child.isalive()) - child.kill(9) - break - - endTime = time.time() - child.close(force=True) - - duration = endTime - startTime - exitStatus = child.exitstatus - - return (output, duration, exitStatus) - -cmd = "./ticker.py" - -result, duration, exitStatus = getProcessResults(cmd) - -print("result: %s" % result) -print("duration: %s" % duration) -print("exit-status: %s" % exitStatus) - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/CSIGNALTEST/test.c b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/CSIGNALTEST/test.c deleted file mode 100644 index 86bcc17fab5..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/CSIGNALTEST/test.c +++ /dev/null @@ -1,90 +0,0 @@ -/* I built this with "gcc -lutil test.c -otest" */ -#include <sys/types.h> /* include this before any other sys headers */ -#include <sys/wait.h> /* header for waitpid() and various macros */ -#include <signal.h> /* header for signal functions */ -#include <stdio.h> /* header for fprintf() */ -#include <unistd.h> /* header for fork() */ -#ifdef LINUX -#include <pty.h> -#else -#include <util.h> /* header for forkpty, compile with -lutil */ -#endif - -void sig_chld(int); /* prototype for our SIGCHLD handler */ - -int main() -{ - struct sigaction act; - int pid; - int fdm; - char slave_name [20]; - - - /* Assign sig_chld as our SIGCHLD handler. - We don't want to block any other signals in this example - We're only interested in children that have terminated, not ones - which have been stopped (eg user pressing control-Z at terminal). - Finally, make these values effective. If we were writing a real - application, we would save the old value instead of passing NULL. - */ - act.sa_handler = sig_chld; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_NOCLDSTOP; - if (sigaction(SIGCHLD, &act, NULL) < 0) - { - fprintf(stderr, "sigaction failed\n"); - return 1; - } - - /* Do the Fork thing. - */ - pid = forkpty (&fdm, slave_name, NULL, NULL); - /* pid = fork(); */ - - switch (pid) - { - case -1: - fprintf(stderr, "fork failed\n"); - return 1; - break; - - case 0: /* Child process. */ - printf ("This child output will cause trouble.\n"); - _exit(7); - break; - - default: /* Parent process. */ - sleep(1); - printf ("Child pid: %d\n", pid); - sleep(10); /* let child finish -- crappy way to avoid race. */ - break; - } - - return 0; -} - -void sig_chld(int signo) -{ - int status, wpid, child_val; - - printf ("In sig_chld signal handler.\n"); - - /* Wait for any child without blocking */ - wpid = waitpid (-1, & status, WNOHANG); - printf ("\tWaitpid found status for pid: %d\n", wpid); - if (wpid < 0) - { - fprintf(stderr, "\twaitpid failed\n"); - return; - } - printf("\tWaitpid status: %d\n", status); - - if (WIFEXITED(status)) /* did child exit normally? */ - { - child_val = WEXITSTATUS(status); - printf("\tchild exited normally with status %d\n", child_val); - } - printf ("End of sig_chld.\n"); -} - - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/README b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/README deleted file mode 100644 index d50f94cd620..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/README +++ /dev/null @@ -1,2 +0,0 @@ -These scripts are for checking how the underlying system behaves, not for -testing Pexpect itself.
\ No newline at end of file diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check.py b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check.py deleted file mode 100755 index b41755a9635..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -import signal -import os -import time -import pty - -def signal_handler (signum, frame): - print 'Signal handler called with signal:', signum - print 'signal.SIGCHLD=', signal.SIGKILL - -# First thing we do is set up a handler for SIGCHLD. -signal.signal (signal.SIGCHLD, signal.SIG_IGN) - -print 'PART 1 -- Test signal handling with empty pipe.' -# Create a child process for us to kill. -try: - pid, fd = pty.fork() -except Exception as e: - print str(e) - -if pid == 0: -# os.write (sys.stdout.fileno(), 'This is a test.\n This is a test.') - time.sleep(10000) - -print 'Sending SIGKILL to child pid:', pid -os.kill (pid, signal.SIGKILL) - -# SIGCHLD should interrupt sleep. -# Note that this is a race. -# It is possible that the signal handler will get called -# before we try to sleep, but this has not happened yet. -# But in that case we can only tell by order of printed output. -print 'Entering sleep...' -try: - time.sleep(10) -except: - print 'sleep was interrupted by signal.' - -# Just for fun let's see if the process is alive. -try: - os.kill(pid, 0) - print 'Child is alive. This is ambiguous because it may be a Zombie.' -except OSError as e: - print 'Child appears to be dead.' - -print 'PART 2 -- Test signal handling with full pipe.' -# Create a child process for us to kill. -try: - pid, fd = pty.fork() -except Exception as e: - print str(e) - -if pid == 0: - os.write (sys.stdout.fileno(), 'This is a test.\n This is a test.') - time.sleep(10000) - -print 'Sending SIGKILL to child pid:', pid -os.kill (pid, signal.SIGKILL) - -# SIGCHLD should interrupt sleep. -# Note that this is a race. -# It is possible that the signal handler will get called -# before we try to sleep, but this has not happened yet. -# But in that case we can only tell by order of printed output. -print 'Entering sleep...' -try: - time.sleep(10) -except: - print 'sleep was interrupted by signal.' - -# Just for fun let's see if the process is alive. -try: - os.kill(pid, 0) - print 'Child is alive. This is ambiguous because it may be a Zombie.' -except OSError as e: - print 'Child appears to be dead.' - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check2.py b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check2.py deleted file mode 100755 index 0a7d5f89ca8..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check2.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -import signal -import os -import time - -def signal_handler (signum, frame): - print 'Signal handler called with signal:', signum - print 'signal.SIGCHLD=', signal.SIGKILL - -# Create a child process for us to kill. -pid = os.fork() -if pid == 0: - time.sleep(10000) - -#signal.signal (signal.SIGCHLD, signal.SIG_IGN) -signal.signal (signal.SIGCHLD, signal_handler) - -print 'Sending SIGKILL to child pid:', pid -os.kill (pid, signal.SIGKILL) - -# SIGCHLD should interrupt sleep. -# Note that this is a race. -# It is possible that the signal handler will get called -# before we try to sleep, but this has not happened yet. -# But in that case we can only tell by order of printed output. -interrupted = 0 -try: - time.sleep(10) -except: - print 'sleep was interrupted by signal.' - interrupted = 1 - -if not interrupted: - print 'ERROR. Signal did not interrupt sleep.' -else: - print 'Signal interrupted sleep. This is good.' - -# Let's see if the process is alive. -try: - os.kill(pid, 0) - print 'Child is alive. This is ambiguous because it may be a Zombie.' -except OSError as e: - print 'Child appears to be dead.' - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_control_terminal.py b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_control_terminal.py deleted file mode 100755 index 9598fd7ca6b..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_control_terminal.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python - -import termios, fcntl, struct, os, sys - -def getwinsize(): - s = struct.pack("HHHH", 0, 0, 0, 0) - x = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, s) - rows, cols = struct.unpack("HHHH", x)[:2] - return rows, cols - -def setwinsize(r,c): - # Assume ws_xpixel and ws_ypixel are zero. - s = struct.pack("HHHH", r,c,0,0) - x = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSWINSZ, s) -print 'stdin tty:', os.ttyname(0) -print 'stdout tty:', os.ttyname(1) -print 'controlling terminal:', os.ctermid() -print 'winsize %d,%d' % getwinsize() -print 'ENDTEST' diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_handler.py b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_handler.py deleted file mode 100755 index c0633eb80e0..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_handler.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -import signal -import os -import time -import pty -import sys -import fcntl -import tty -GLOBAL_SIGCHLD_RECEIVED = 0 - -def nonblock (fd): - # if O_NDELAY is set read() returns 0 (ambiguous with EOF). - # if O_NONBLOCK is set read() returns -1 and sets errno to EAGAIN - original_flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0) - flags = original_flags | os.O_NONBLOCK - fcntl.fcntl(fd, fcntl.F_SETFL, flags) - return original_flags - -def signal_handler (signum, frame): - print '<HANDLER>' - global GLOBAL_SIGCHLD_RECEIVED - status = os.waitpid (-1, os.WNOHANG) - if status[0] == 0: - print 'No process for waitpid:', status - else: - print 'Status:', status - print 'WIFEXITED(status):', os.WIFEXITED(status[1]) - print 'WEXITSTATUS(status):', os.WEXITSTATUS(status[1]) - GLOBAL_SIGCHLD_RECEIVED = 1 - -def main (): - signal.signal (signal.SIGCHLD, signal_handler) - pid, fd = pty.fork() - if pid == 0: - os.write (sys.stdout.fileno(), 'This is a test.\nThis is a test.') - time.sleep(10000) - nonblock (fd) - tty.setraw(fd) #STDIN_FILENO) - print 'Sending SIGKILL to child pid:', pid - time.sleep(2) - os.kill (pid, signal.SIGKILL) - - print 'Entering to sleep...' - try: - time.sleep(2) - except: - print 'Sleep interrupted' - try: - os.kill(pid, 0) - print '\tChild is alive. This is ambiguous because it may be a Zombie.' - except OSError as e: - print '\tChild appears to be dead.' -# print str(e) - print - print 'Reading from master fd:', os.read (fd, 1000) - - - -if __name__ == '__main__': - main () diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_read.py b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_read.py deleted file mode 100755 index 9598aa765eb..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_read.py +++ /dev/null @@ -1,35 +0,0 @@ -import os - -filename = os.tmpnam() -print 'filename:', filename - -fd_out = os.open(filename, os.O_CREAT | os.O_WRONLY) -print 'fd_out:', fd_out -os.write (fd_out, 'This is a test.\n') -os.close(fd_out) -print -print 'testing read on good fd...' -fd_in = os.open (filename, os.O_RDONLY) -print 'fd_in:', fd_in -while 1: - data_in = os.read(fd_in, 1) - print 'data_in:', data_in - if data_in == '': - print 'data_in was empty' - break #sys.exit(1) -os.close(fd_in) -print -print -print 'testing read on closed fd...' -fd_in = os.open ('test_read.py', os.O_RDONLY) -print 'fd_in:', fd_in -while 1: - data_in = os.read(fd_in, 1) - print 'data_in:', data_in - if data_in == '': - print 'data_in was empty' - break -os.close(fd_in) -d = os.read(fd_in, 1) # fd_in should be closed now... -if s == '': - print 'd is empty. good.' diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_signals.py b/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_signals.py deleted file mode 100755 index d45bc8a3bd4..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/platform_checks/check_signals.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -import signal -import os -import time -import pty -import sys -GLOBAL_SIGCHLD_RECEIVED = 0 - -def signal_handler (signum, frame): - print '<HANDLER>' - global GLOBAL_SIGCHLD_RECEIVED - status = os.waitpid (-1, os.WNOHANG) - print 'WIFEXITED(status):', os.WIFEXITED(status) - print 'WEXITSTATUS(status):', os.WEXITSTATUS(status) - GLOBAL_SIGCHLD_RECEIVED = 1 - -def main (): -# sig_test ('SIG_IGN', 'ptyfork', 'yes') - sig_test ('handler', 'ptyfork', 'yes') -# sig_test ('SIG_IGN', 'ptyfork', 'no') -# sig_test ('handler', 'ptyfork', 'no') -# sig_test ('SIG_IGN', 'osfork', 'yes') -# sig_test ('handler', 'osfork', 'yes') -# sig_test ('SIG_IGN', 'osfork', 'no') -# sig_test ('handler', 'osfork', 'no') - -def sig_test (sig_handler_type, fork_type, child_output): - print 'Testing with:' - print '\tsig_handler_type:', sig_handler_type - print '\tfork_type:', fork_type - print '\tchild_output:', child_output - - if sig_handler_type == 'SIG_IGN': - signal.signal (signal.SIGCHLD, signal.SIG_IGN) - else: - signal.signal (signal.SIGCHLD, signal_handler) - pid = -1 - fd = -1 - if fork_type == 'ptyfork': - pid, fd = pty.fork() - else: - pid = os.fork() - - if pid == 0: - if child_output == 'yes': - os.write (sys.stdout.fileno(), 'This is a test.\nThis is a test.') - time.sleep(10000) - - #print 'Sending SIGKILL to child pid:', pid - time.sleep(2) - os.kill (pid, signal.SIGKILL) - - #print 'Entering to sleep...' - try: - time.sleep(2) - except: - pass - try: - os.kill(pid, 0) - print '\tChild is alive. This is ambiguous because it may be a Zombie.' - except OSError as e: - print '\tChild appears to be dead.' -# print str(e) - print - -if __name__ == '__main__': - main () diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/qa.py b/lldb/third_party/Python/module/pexpect-4.6/tests/qa.py deleted file mode 100755 index f50e3ed7726..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/qa.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import commands -import signal - -signal.signal(signal.SIGCHLD, signal.SIG_IGN) -print(commands.getoutput('/bin/ls -l')) - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/sigwinch_report.py b/lldb/third_party/Python/module/pexpect-4.6/tests/sigwinch_report.py deleted file mode 100755 index f10956ab1c9..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/sigwinch_report.py +++ /dev/null @@ -1,50 +0,0 @@ -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function - -import signal, time, struct, fcntl, termios, sys - -def getwinsize(): - '''This returns the window size of the child tty. - The return value is a tuple of (rows, cols). - ''' - if 'TIOCGWINSZ' in dir(termios): - TIOCGWINSZ = termios.TIOCGWINSZ - else: - TIOCGWINSZ = 1074295912 # Assume - s = struct.pack('HHHH', 0, 0, 0, 0) - x = fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ, s) - return struct.unpack('HHHH', x)[0:2] - -def handler(signum, frame): - print('signal') - sys.stdout.flush() - print('SIGWINCH:', getwinsize ()) - sys.stdout.flush() - -print("Initial Size:", getwinsize()) -print("setting handler for SIGWINCH") -signal.signal(signal.SIGWINCH, handler) -print("READY") - -while 1: - sys.stdout.flush() - time.sleep(1) - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/sleep_for.py b/lldb/third_party/Python/module/pexpect-4.6/tests/sleep_for.py deleted file mode 100755 index 902710576be..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/sleep_for.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -from __future__ import print_function - -import time -import sys - -def main(): - """ - This script sleeps for the number of seconds (float) specified by the - command line argument. - """ - if len(sys.argv) < 2: - print("Usage: %s seconds_to_sleep" % (sys.argv[0],)) - sys.exit(1) - timeout = float(sys.argv[1]) - print("READY") - time.sleep(timeout) - print("END") - -if __name__ == '__main__': - main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/swapcase_echo.py b/lldb/third_party/Python/module/pexpect-4.6/tests/swapcase_echo.py deleted file mode 100755 index aaac442dbaf..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/swapcase_echo.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import sys, time -while True: - x = raw_input () - time.sleep(1) # without this delay the test would fail about 75% of the time. Why? - print(x.swapcase()) - sys.stdout.flush() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py deleted file mode 100644 index 3425fd2110e..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_FSM.py +++ /dev/null @@ -1,34 +0,0 @@ -import io -import sys -import unittest -try: - import builtins -except ImportError: - import __builtin__ as builtins - -PY3 = (sys.version_info[0] >= 3) -input_name = 'input' if PY3 else 'raw_input' - -from pexpect import FSM - -class FSMTestCase(unittest.TestCase): - def test_run_fsm(self): - def _input(prompt): - return "167 3 2 2 * * * 1 - =" - orig_input = getattr(builtins, input_name) - orig_stdout = sys.stdout - setattr(builtins, input_name, _input) - sys.stdout = sio = (io.StringIO if PY3 else io.BytesIO)() - - try: - FSM.main() - finally: - setattr(builtins, input_name, orig_input) - sys.stdout = orig_stdout - - printed = sio.getvalue() - assert '2003' in printed, printed - - -if __name__ == '__main__': - unittest.main()
\ No newline at end of file diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_ansi.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_ansi.py deleted file mode 100755 index a9d445ed7de..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_ansi.py +++ /dev/null @@ -1,228 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from pexpect import ANSI -import unittest -from . import PexpectTestCase -import sys - -PY3 = (sys.version_info[0] >= 3) - -write_target = 'I\'ve got a ferret sticking up my nose. \n' +\ -'(He\'s got a ferret sticking up his nose.) \n' +\ -'How it got there I can\'t tell \n' +\ -'But now it\'s there it hurts like hell \n' +\ -'And what is more it radically affects my sense of smell. \n' +\ -'(His sense of smell.) ' - -write_text = 'I\'ve got a ferret sticking up my nose.\n' + \ -'(He\'s got a ferret sticking up his nose.)\n' + \ -'How it got there I can\'t tell\n' + \ -'But now it\'s there it hurts like hell\n' + \ -'And what is more it radically affects my sense of smell.\n' + \ -'(His sense of smell.)\n' + \ -'I can see a bare-bottomed mandril.\n' + \ -'(Slyly eyeing his other nostril.)\n' + \ -'If it jumps inside there too I really don\'t know what to do\n' + \ -'I\'ll be the proud posessor of a kind of nasal zoo.\n' + \ -'(A nasal zoo.)\n' + \ -'I\'ve got a ferret sticking up my nose.\n' + \ -'(And what is worst of all it constantly explodes.)\n' + \ -'"Ferrets don\'t explode," you say\n' + \ -'But it happened nine times yesterday\n' + \ -'And I should know for each time I was standing in the way.\n' + \ -'I\'ve got a ferret sticking up my nose.\n' + \ -'(He\'s got a ferret sticking up his nose.)\n' + \ -'How it got there I can\'t tell\n' + \ -'But now it\'s there it hurts like hell\n' + \ -'And what is more it radically affects my sense of smell.\n' + \ -'(His sense of smell.)' - -tetris_target=' XX XXXX XX \n' +\ -' XXXXXX XXXXXXXX XX \n' +\ -' XXXXXX XXXXXXXX XX \n' +\ -' XX XX XX XXXX XX \n' +\ -' XXXXXX XXXX XXXX XX \n' +\ -' XXXXXXXXXX XXXX XX \n' +\ -' XX XXXXXX XX XX \n' +\ -' XXXXXX XX XX \n' +\ -' XXXX XXXXXX XX XX \n' +\ -' XXXXXX XXXX XX XX \n' +\ -' XX XX XXXX XX XX \n' +\ -' XX XX XX XX XX \n' +\ -' XX XX XXXX XXXX XX \n' +\ -' XXXXXXXX XXXX XXXX XX \n' +\ -' XXXXXXXXXXXXXX XXXXXXXX \n' +\ -' XX XXXXXXXX XX XX \n' +\ -' XXXXXXXXXXXXXX XX XX \n' +\ -' XX XXXX XXXXXX XX \n' +\ -' XXXXXX XXXXXXXX \n' +\ -' XXXXXXXXXX XX XX \n' +\ -' XXXXXXXXXXXXXXXXXXXXXXXX \n' +\ -' \n' +\ -' J->LEFT K->ROTATE L->RIGHT SPACE->DROP P->PAUSE Q->QUIT \n' +\ -' ' - -torture_target='+--------------------------------------------------------------------------------+\n' +\ -'|a`opqrs` This is the `srqpo`a |\n' +\ -'|VT100 series Torture Test Demonstration. |\n' +\ -'|VT100 series Torture Test Demonstration. |\n' +\ -'|This is a normal line __________________________________________________y_ |\n' +\ -'|This is a bold line (normal unless the Advanced Video Option is installed) |\n' +\ -'|This line is underlined _ " " " " " " _y_ |\n' +\ -'|This is a blinking line _ " " " " " " _y_ |\n' +\ -'|This is inverse video _ (underlined if no AVO and cursor is underline) _y_ |\n' +\ -'|Normal gjpqy Underline Blink Underline+Blink gjpqy |\n' +\ -'|Bold gjpqy Underline Blink Underline+Blink gjpqy |\n' +\ -'|Inverse Underline Blink Underline+Blink |\n' +\ -'|Bold+Inverse Underline Blink Underline+Blink |\n' +\ -'|This is double width |\n' +\ -'|This is double height |\n' +\ -'|This is double height |\n' +\ -'|_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy |\n' +\ -'|_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy |\n' +\ -'|_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy |\n' +\ -'|`abcdefghijklmnopqrstuvwxyz{|}~ lqwqk |\n' +\ -'|`abcdefghijklmnopqrstuvwxyz{|}~ tqnqu |\n' +\ -'|`abcdefghijklmnopqrstuvwxyz{|}~ tqnqu |\n' +\ -'|`abcdefghijklmnopqrstuvwxyz{|}~ mqvqj |\n' +\ -'| This test created by Joe Smith, 8-May-85 |\n' +\ -'| |\n' +\ -'+--------------------------------------------------------------------------------+\n' - -class ansiTestCase (PexpectTestCase.PexpectTestCase): - def test_write (self): - s = ANSI.ANSI (6,65) - s.fill('.') - s.cursor_home() - for c in write_text: - s.write (c) - assert str(s) == write_target - - def test_torturet (self): - s = ANSI.ANSI (24,80) - with open('torturet.vt') as f: - sample_text = f.read() - for c in sample_text: - s.process (c) - assert s.pretty() == torture_target, 'processed: \n' + s.pretty() + '\nexpected:\n' + torture_target - - def test_tetris (self): - s = ANSI.ANSI (24,80) - with open('tetris.data') as f: - tetris_text = f.read() - for c in tetris_text: - s.process (c) - assert str(s) == tetris_target - - def test_lines(self): - s = ANSI.ANSI(5, 5) - s.write('a'*6 + '\n') - s.write('ab\bcd\n') - s.write('ab\rcd\n') - assert str(s) == ('aaaaa\n' - 'a \n' - 'acd \n' - 'cd \n' - ' ') - - def test_number_x(self): - """Test the FSM state used to handle more than 2 numeric parameters.""" - class TestANSI(ANSI.ANSI): - captured_memory = None - def do_sgr(self, fsm): - assert self.captured_memory is None - self.captured_memory = fsm.memory - - s = TestANSI(1, 20) - s.write('\x1b[0;1;32;45mtest') - assert str(s) == ('test ') - assert s.captured_memory is not None - assert s.captured_memory == [s, '0', '1', '32', '45'] - - def test_fsm_memory(self): - """Test the FSM stack/memory does not have numbers left on it - after some sequences with numbers are passed in.""" - s = ANSI.ANSI(1, 20) - s.write('\x1b[0;1;2;3m\x1b[4;5;6;7q\x1b[?8h\x1b[?9ltest') - assert str(s) == ('test ') - assert s.state.memory == [s] - - def test_utf8_bytes(self): - """Test that when bytes are passed in containing UTF-8 encoded - characters, where the encoding of each character consists of - multiple bytes, the characters are correctly decoded. - Incremental decoding is also tested.""" - s = ANSI.ANSI(2, 10, encoding='utf-8') - # This is the UTF-8 encoding of the UCS character "HOURGLASS" - # followed by the UTF-8 encoding of the UCS character - # "KEYBOARD". These characters can't be encoded in cp437 or - # latin-1. The "KEYBOARD" character is split into two - # separate writes. - s.write(b'\xe2\x8c\x9b') - s.write(b'\xe2\x8c') - s.write(b'\xa8') - if PY3: - assert str(s) == u'\u231b\u2328 \n ' - else: - assert unicode(s) == u'\u231b\u2328 \n ' - assert str(s) == b'\xe2\x8c\x9b\xe2\x8c\xa8 \n ' - assert s.dump() == u'\u231b\u2328 ' - assert s.pretty() == u'+----------+\n|\u231b\u2328 |\n| |\n+----------+\n' - assert s.get_abs(1, 1) == u'\u231b' - assert s.get_region(1, 1, 1, 5) == [u'\u231b\u2328 '] - - def test_unicode(self): - """Test passing in of a unicode string.""" - s = ANSI.ANSI(2, 10, encoding="utf-8") - s.write(u'\u231b\u2328') - if PY3: - assert str(s) == u'\u231b\u2328 \n ' - else: - assert unicode(s) == u'\u231b\u2328 \n ' - assert str(s) == b'\xe2\x8c\x9b\xe2\x8c\xa8 \n ' - assert s.dump() == u'\u231b\u2328 ' - assert s.pretty() == u'+----------+\n|\u231b\u2328 |\n| |\n+----------+\n' - assert s.get_abs(1, 1) == u'\u231b' - assert s.get_region(1, 1, 1, 5) == [u'\u231b\u2328 '] - - def test_decode_error(self): - """Test that default handling of decode errors replaces the - invalid characters.""" - s = ANSI.ANSI(2, 10, encoding="ascii") - s.write(b'\xff') # a non-ASCII character - # In unicode, the non-ASCII character is replaced with - # REPLACEMENT CHARACTER. - if PY3: - assert str(s) == u'\ufffd \n ' - else: - assert unicode(s) == u'\ufffd \n ' - assert str(s) == b'? \n ' - assert s.dump() == u'\ufffd ' - assert s.pretty() == u'+----------+\n|\ufffd |\n| |\n+----------+\n' - assert s.get_abs(1, 1) == u'\ufffd' - assert s.get_region(1, 1, 1, 5) == [u'\ufffd '] - - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ansiTestCase,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_async.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_async.py deleted file mode 100644 index 1cc32361fe2..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_async.py +++ /dev/null @@ -1,70 +0,0 @@ -try: - import asyncio -except ImportError: - asyncio = None - -import gc -import sys -import unittest - -import pexpect -from .PexpectTestCase import PexpectTestCase - -def run(coro): - return asyncio.get_event_loop().run_until_complete(coro) - -@unittest.skipIf(asyncio is None, "Requires asyncio") -class AsyncTests(PexpectTestCase): - def test_simple_expect(self): - p = pexpect.spawn('cat') - p.sendline('Hello asyncio') - coro = p.expect(['Hello', pexpect.EOF] , async_=True) - assert run(coro) == 0 - print('Done') - - def test_timeout(self): - p = pexpect.spawn('cat') - coro = p.expect('foo', timeout=1, async_=True) - with self.assertRaises(pexpect.TIMEOUT): - run(coro) - - p = pexpect.spawn('cat') - coro = p.expect(['foo', pexpect.TIMEOUT], timeout=1, async_=True) - assert run(coro) == 1 - - def test_eof(self): - p = pexpect.spawn('cat') - p.sendline('Hi') - coro = p.expect(pexpect.EOF, async_=True) - p.sendeof() - assert run(coro) == 0 - - p = pexpect.spawn('cat') - p.sendeof() - coro = p.expect('Blah', async_=True) - with self.assertRaises(pexpect.EOF): - run(coro) - - def test_expect_exact(self): - p = pexpect.spawn('%s list100.py' % sys.executable) - assert run(p.expect_exact(b'5', async_=True)) == 0 - assert run(p.expect_exact(['wpeok', b'11'], async_=True)) == 1 - assert run(p.expect_exact([b'foo', pexpect.EOF], async_=True)) == 1 - - def test_async_utf8(self): - p = pexpect.spawn('%s list100.py' % sys.executable, encoding='utf8') - assert run(p.expect_exact(u'5', async_=True)) == 0 - assert run(p.expect_exact([u'wpeok', u'11'], async_=True)) == 1 - assert run(p.expect_exact([u'foo', pexpect.EOF], async_=True)) == 1 - - def test_async_and_gc(self): - p = pexpect.spawn('%s sleep_for.py 1' % sys.executable, encoding='utf8') - assert run(p.expect_exact(u'READY', async_=True)) == 0 - gc.collect() - assert run(p.expect_exact(u'END', async_=True)) == 0 - - def test_async_and_sync(self): - p = pexpect.spawn('echo 1234', encoding='utf8', maxread=1) - assert run(p.expect_exact(u'1', async_=True)) == 0 - assert p.expect_exact(u'2') == 0 - assert run(p.expect_exact(u'3', async_=True)) == 0 diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_command_list_split.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_command_list_split.py deleted file mode 100755 index 370f46e5b49..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_command_list_split.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase - -class SplitCommandLineTestCase(PexpectTestCase.PexpectTestCase): - def testSplitSizes(self): - assert len(pexpect.split_command_line(r'')) == 0 - assert len(pexpect.split_command_line(r'one')) == 1 - assert len(pexpect.split_command_line(r'one two')) == 2 - assert len(pexpect.split_command_line(r'one two')) == 2 - assert len(pexpect.split_command_line(r'one two')) == 2 - assert len(pexpect.split_command_line(r'one\ one')) == 1 - assert len(pexpect.split_command_line('\'one one\'')) == 1 - assert len(pexpect.split_command_line(r'one\"one')) == 1 - assert len(pexpect.split_command_line(r'This\' is a\'\ test')) == 3 - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(SplitCommandLineTestCase,'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_constructor.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_constructor.py deleted file mode 100755 index 98c473ae584..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_constructor.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase - -class TestCaseConstructor(PexpectTestCase.PexpectTestCase): - def test_constructor (self): - '''This tests that the constructor will work and give - the same results for different styles of invoking __init__(). - This assumes that the root directory / is static during the test. - ''' - p1 = pexpect.spawn('uname -m -n -p -r -s -v') - p2 = pexpect.spawn('uname', ['-m', '-n', '-p', '-r', '-s', '-v']) - p1.expect(pexpect.EOF) - p2.expect(pexpect.EOF) - assert p1.before == p2.before - - def test_named_parameters (self): - '''This tests that named parameters work. - ''' - p = pexpect.spawn ('/bin/ls',timeout=10) - p = pexpect.spawn (timeout=10, command='/bin/ls') - p = pexpect.spawn (args=[], command='/bin/ls') - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCaseConstructor,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_ctrl_chars.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_ctrl_chars.py deleted file mode 100755 index 10d03dbc2af..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_ctrl_chars.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function - -import pexpect -import unittest -from . import PexpectTestCase -import time -import sys - -from ptyprocess import ptyprocess -ptyprocess._make_eof_intr() - -if sys.version_info[0] >= 3: - def byte(i): - return bytes([i]) -else: - byte = chr - -class TestCtrlChars(PexpectTestCase.PexpectTestCase): - - def test_control_chars(self): - '''This tests that we can send all 256 8-bit characters to a child - process.''' - child = pexpect.spawn('python getch.py', echo=False, timeout=5) - child.expect('READY') - for i in range(1, 256): - child.send(byte(i)) - child.expect ('%d<STOP>' % (i,)) - - # This needs to be last, as getch.py exits on \x00 - child.send(byte(0)) - child.expect('0<STOP>') - child.expect(pexpect.EOF) - assert not child.isalive() - assert child.exitstatus == 0 - - def test_sendintr (self): - child = pexpect.spawn('python getch.py', echo=False, timeout=5) - child.expect('READY') - child.sendintr() - child.expect(str(ord(ptyprocess._INTR)) + '<STOP>') - - child.send(byte(0)) - child.expect('0<STOP>') - child.expect(pexpect.EOF) - assert not child.isalive() - assert child.exitstatus == 0 - - def test_sendeof(self): - child = pexpect.spawn('python getch.py', echo=False, timeout=5) - child.expect('READY') - child.sendeof() - child.expect(str(ord(ptyprocess._EOF)) + '<STOP>') - - child.send(byte(0)) - child.expect('0<STOP>') - child.expect(pexpect.EOF) - assert not child.isalive() - assert child.exitstatus == 0 - - def test_bad_sendcontrol_chars (self): - '''This tests that sendcontrol will return 0 for an unknown char. ''' - - child = pexpect.spawn('python getch.py', echo=False, timeout=5) - child.expect('READY') - assert 0 == child.sendcontrol('1') - - def test_sendcontrol(self): - '''This tests that we can send all special control codes by name. - ''' - child = pexpect.spawn('python getch.py', echo=False, timeout=5) - child.expect('READY') - for ctrl in 'abcdefghijklmnopqrstuvwxyz': - assert child.sendcontrol(ctrl) == 1 - val = ord(ctrl) - ord('a') + 1 - child.expect_exact(str(val)+'<STOP>') - - # escape character - assert child.sendcontrol('[') == 1 - child.expect('27<STOP>') - assert child.sendcontrol('\\') == 1 - child.expect('28<STOP>') - # telnet escape character - assert child.sendcontrol(']') == 1 - child.expect('29<STOP>') - assert child.sendcontrol('^') == 1 - child.expect('30<STOP>') - # irc protocol uses this to underline ... - assert child.sendcontrol('_') == 1 - child.expect('31<STOP>') - # the real "backspace is delete" - assert child.sendcontrol('?') == 1 - child.expect('127<STOP>') - - # NUL, same as ctrl + ' ' - assert child.sendcontrol('@') == 1 - child.expect('0<STOP>') - child.expect(pexpect.EOF) - assert not child.isalive() - assert child.exitstatus == 0 - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCtrlChars,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_delay.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_delay.py deleted file mode 100644 index 1e4dba687df..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_delay.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -from . import PexpectTestCase -import pexpect - - -class TestCaseDelay(PexpectTestCase.PexpectTestCase): - """ - Tests for various delay attributes. - """ - def test_delaybeforesend(self): - """ - Test various values for delaybeforesend. - """ - p = pexpect.spawn("cat") - - p.delaybeforesend = 1 - p.sendline("line 1") - p.expect("line 1") - - p.delaybeforesend = 0.0 - p.sendline("line 2") - p.expect("line 2") - - p.delaybeforesend = None - p.sendline("line 3") - p.expect("line 3") - - def test_delayafterread(self): - """ - Test various values for delayafterread. - """ - p = pexpect.spawn("cat") - - p.delayafterread = 1 - p.sendline("line 1") - p.expect("line 1") - - p.delayafterread = 0.0 - p.sendline("line 2") - p.expect("line 2") - - p.delayafterread = None - p.sendline("line 3") - p.expect("line 3") diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_destructor.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_destructor.py deleted file mode 100755 index d27b6f6251e..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_destructor.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase -import gc -import platform -import time - -class TestCaseDestructor(PexpectTestCase.PexpectTestCase): - def test_destructor (self): - if platform.python_implementation() != 'CPython': - # Details of garbage collection are different on other implementations - return 'SKIP' - gc.collect() - time.sleep(3) - p1 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p2 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p3 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p4 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - fd_t1 = (p1.child_fd,p2.child_fd,p3.child_fd,p4.child_fd) - p1.expect(pexpect.EOF) - p2.expect(pexpect.EOF) - p3.expect(pexpect.EOF) - p4.expect(pexpect.EOF) - p1.kill(9) - p2.kill(9) - p3.kill(9) - p4.kill(9) - p1 = None - p2 = None - p3 = None - p4 = None - gc.collect() - time.sleep(3) # Some platforms are slow at gc... Solaris! - - p1 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p2 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p3 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p4 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - fd_t2 = (p1.child_fd,p2.child_fd,p3.child_fd,p4.child_fd) - p1.kill(9) - p2.kill(9) - p3.kill(9) - p4.kill(9) - del (p1) - del (p2) - del (p3) - del (p4) - gc.collect() - time.sleep(3) - - p1 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p2 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p3 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - p4 = pexpect.spawn('%s hello_world.py' % self.PYTHONBIN) - fd_t3 = (p1.child_fd,p2.child_fd,p3.child_fd,p4.child_fd) - - assert (fd_t1 == fd_t2 == fd_t3), "pty file descriptors not properly garbage collected (fd_t1,fd_t2,fd_t3)=(%s,%s,%s)" % (str(fd_t1),str(fd_t2),str(fd_t3)) - - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCaseDestructor,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_dotall.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_dotall.py deleted file mode 100755 index 68aef3f50b7..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_dotall.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -import re -from . import PexpectTestCase - -testdata = 'BEGIN\nHello world\nEND' -class TestCaseDotall(PexpectTestCase.PexpectTestCase): - def test_dotall (self): - p = pexpect.spawn('echo "%s"' % testdata) - i = p.expect ([b'BEGIN(.*)END', pexpect.EOF]) - assert i==0, 'DOTALL does not seem to be working.' - - def test_precompiled (self): - p = pexpect.spawn('echo "%s"' % testdata) - pat = re.compile(b'BEGIN(.*)END') # This overrides the default DOTALL. - i = p.expect ([pat, pexpect.EOF]) - assert i==1, 'Precompiled pattern to override DOTALL does not seem to be working.' - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCaseDotall,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_env.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_env.py deleted file mode 100755 index ecaaa4bea26..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_env.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2016, Martin Packman <martin.packman@canonical.com> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import contextlib -import os -import tempfile -import unittest - -import pexpect -from . import PexpectTestCase - - -@contextlib.contextmanager -def example_script(name, output='success'): - " helper to create a temporary shell script that tests can run " - tempdir = tempfile.mkdtemp(prefix='tmp-pexpect-test') - try: - script_path = os.path.join(tempdir, name) - with open(script_path, 'w') as f: - f.write('#!/bin/sh\necho "%s"' % (output,)) - try: - os.chmod(script_path, 0o755) - yield tempdir - finally: - os.remove(script_path) - finally: - os.rmdir(tempdir) - - -class TestCaseEnv(PexpectTestCase.PexpectTestCase): - " tests for the env argument to pexpect.spawn and pexpect.run " - - def test_run_uses_env(self): - " pexpect.run uses env argument when running child process " - script_name = 'run_uses_env.sh' - environ = {'PEXPECT_TEST_KEY': 'pexpect test value'} - with example_script(script_name, '$PEXPECT_TEST_KEY') as script_dir: - script = os.path.join(script_dir, script_name) - out = pexpect.run(script, env=environ) - self.assertEqual(out.rstrip(), b'pexpect test value') - - def test_spawn_uses_env(self): - " pexpect.spawn uses env argument when running child process " - script_name = 'spawn_uses_env.sh' - environ = {'PEXPECT_TEST_KEY': 'pexpect test value'} - with example_script(script_name, '$PEXPECT_TEST_KEY') as script_dir: - script = os.path.join(script_dir, script_name) - child = pexpect.spawn(script, env=environ) - out = child.readline() - child.expect(pexpect.EOF) - self.assertEqual(child.exitstatus, 0) - self.assertEqual(out.rstrip(), b'pexpect test value') - - def test_run_uses_env_path(self): - " pexpect.run uses binary from PATH when given in env argument " - script_name = 'run_uses_env_path.sh' - with example_script(script_name) as script_dir: - out = pexpect.run(script_name, env={'PATH': script_dir}) - self.assertEqual(out.rstrip(), b'success') - - def test_run_uses_env_path_over_path(self): - " pexpect.run uses PATH from env over os.environ " - script_name = 'run_uses_env_path_over_path.sh' - with example_script(script_name, output='failure') as wrong_dir: - with example_script(script_name) as right_dir: - orig_path = os.environ['PATH'] - os.environ['PATH'] = wrong_dir - try: - out = pexpect.run(script_name, env={'PATH': right_dir}) - finally: - os.environ['PATH'] = orig_path - self.assertEqual(out.rstrip(), b'success') - - -if __name__ == '__main__': - unittest.main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_expect.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_expect.py deleted file mode 100755 index 795518ab2fc..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_expect.py +++ /dev/null @@ -1,602 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import multiprocessing -import unittest -import subprocess -import time -import signal -import sys -import os - -import pexpect -from . import PexpectTestCase -from .utils import no_coverage_env - -# Many of these test cases blindly assume that sequential directory -# listings of the /bin directory will yield the same results. -# This may not be true, but seems adequate for testing now. -# I should fix this at some point. - -FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)]) -def hex_dump(src, length=16): - result=[] - for i in xrange(0, len(src), length): - s = src[i:i+length] - hexa = ' '.join(["%02X"%ord(x) for x in s]) - printable = s.translate(FILTER) - result.append("%04X %-*s %s\n" % (i, length*3, hexa, printable)) - return ''.join(result) - -def hex_diff(left, right): - diff = ['< %s\n> %s' % (_left, _right,) for _left, _right in zip( - hex_dump(left).splitlines(), hex_dump(right).splitlines()) - if _left != _right] - return '\n' + '\n'.join(diff,) - - -class ExpectTestCase (PexpectTestCase.PexpectTestCase): - - def test_expect_basic (self): - p = pexpect.spawn('cat', echo=False, timeout=5) - p.sendline (b'Hello') - p.sendline (b'there') - p.sendline (b'Mr. Python') - p.expect (b'Hello') - p.expect (b'there') - p.expect (b'Mr. Python') - p.sendeof () - p.expect (pexpect.EOF) - - def test_expect_exact_basic (self): - p = pexpect.spawn('cat', echo=False, timeout=5) - p.sendline (b'Hello') - p.sendline (b'there') - p.sendline (b'Mr. Python') - p.expect_exact (b'Hello') - p.expect_exact (b'there') - p.expect_exact (b'Mr. Python') - p.sendeof () - p.expect_exact (pexpect.EOF) - - def test_expect_ignore_case(self): - '''This test that the ignorecase flag will match patterns - even if case is different using the regex (?i) directive. - ''' - p = pexpect.spawn('cat', echo=False, timeout=5) - p.sendline (b'HELLO') - p.sendline (b'there') - p.expect (b'(?i)hello') - p.expect (b'(?i)THERE') - p.sendeof () - p.expect (pexpect.EOF) - - def test_expect_ignore_case_flag(self): - '''This test that the ignorecase flag will match patterns - even if case is different using the ignorecase flag. - ''' - p = pexpect.spawn('cat', echo=False, timeout=5) - p.ignorecase = True - p.sendline (b'HELLO') - p.sendline (b'there') - p.expect (b'hello') - p.expect (b'THERE') - p.sendeof () - p.expect (pexpect.EOF) - - def test_expect_order (self): - '''This tests that patterns are matched in the same order as given in the pattern_list. - - (Or does it? Doesn't it also pass if expect() always chooses - (one of the) the leftmost matches in the input? -- grahn) - ... agreed! -jquast, the buffer ptr isn't forwarded on match, see first two test cases - ''' - p = pexpect.spawn('cat', echo=False, timeout=5) - self._expect_order(p) - - def test_expect_order_exact (self): - '''Like test_expect_order(), but using expect_exact(). - ''' - p = pexpect.spawn('cat', echo=False, timeout=5) - p.expect = p.expect_exact - self._expect_order(p) - - def _expect_order (self, p): - p.sendline (b'1234') - p.sendline (b'abcd') - p.sendline (b'wxyz') - p.sendline (b'7890') - p.sendeof () - index = p.expect ([ - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF, - b'7890' ]) - assert index == 0, (index, p.before, p.after) - index = p.expect ([ - b'54321', - pexpect.TIMEOUT, - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF], timeout=5) - assert index == 3, (index, p.before, p.after) - index = p.expect ([ - b'54321', - pexpect.TIMEOUT, - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF], timeout=5) - assert index == 4, (index, p.before, p.after) - index = p.expect ([ - pexpect.EOF, - b'abcd', - b'wxyz', - b'7890' ]) - assert index == 3, (index, p.before, p.after) - - index = p.expect ([ - b'abcd', - b'wxyz', - b'7890', - pexpect.EOF]) - assert index == 3, (index, p.before, p.after) - - def test_expect_setecho_off(self): - '''This tests that echo may be toggled off. - ''' - p = pexpect.spawn('cat', echo=True, timeout=5) - try: - self._expect_echo_toggle(p) - except IOError: - if sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - raise - - def test_expect_setecho_off_exact(self): - p = pexpect.spawn('cat', echo=True, timeout=5) - p.expect = p.expect_exact - try: - self._expect_echo_toggle(p) - except IOError: - if sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - raise - - def test_waitnoecho(self): - " Tests setecho(False) followed by waitnoecho() " - p = pexpect.spawn('cat', echo=False, timeout=5) - try: - p.setecho(False) - p.waitnoecho() - except IOError: - if sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - raise - - def test_waitnoecho_order(self): - - ''' This tests that we can wait on a child process to set echo mode. - For example, this tests that we could wait for SSH to set ECHO False - when asking of a password. This makes use of an external script - echo_wait.py. ''' - - p1 = pexpect.spawn('%s echo_wait.py' % self.PYTHONBIN) - start = time.time() - try: - p1.waitnoecho(timeout=10) - except IOError: - if sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - raise - - - end_time = time.time() - start - assert end_time < 10 and end_time > 2, "waitnoecho did not set ECHO off in the expected window of time." - - # test that we actually timeout and return False if ECHO is never set off. - p1 = pexpect.spawn('cat') - start = time.time() - retval = p1.waitnoecho(timeout=4) - end_time = time.time() - start - assert end_time > 3, "waitnoecho should have waited longer than 2 seconds. retval should be False, retval=%d"%retval - assert retval==False, "retval should be False, retval=%d"%retval - - # This one is mainly here to test default timeout for code coverage. - p1 = pexpect.spawn('%s echo_wait.py' % self.PYTHONBIN) - start = time.time() - p1.waitnoecho() - end_time = time.time() - start - assert end_time < 10, "waitnoecho did not set ECHO off in the expected window of time." - - def test_expect_echo (self): - '''This tests that echo is on by default. - ''' - p = pexpect.spawn('cat', echo=True, timeout=5) - self._expect_echo(p) - - def test_expect_echo_exact (self): - '''Like test_expect_echo(), but using expect_exact(). - ''' - p = pexpect.spawn('cat', echo=True, timeout=5) - p.expect = p.expect_exact - self._expect_echo(p) - - def _expect_echo (self, p): - p.sendline (b'1234') # Should see this twice (once from tty echo and again from cat). - index = p.expect ([ - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF, - pexpect.TIMEOUT]) - assert index == 0, "index="+str(index)+"\n"+p.before - index = p.expect ([ - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF]) - assert index == 0, "index="+str(index) - - def _expect_echo_toggle(self, p): - p.sendline (b'1234') # Should see this twice (once from tty echo and again from cat). - index = p.expect ([ - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF, - pexpect.TIMEOUT]) - assert index == 0, "index="+str(index)+"\n"+p.before - index = p.expect ([ - b'1234', - b'abcd', - b'wxyz', - pexpect.EOF]) - assert index == 0, "index="+str(index) - p.setecho(0) # Turn off tty echo - p.waitnoecho() - p.sendline (b'abcd') # Now, should only see this once. - p.sendline (b'wxyz') # Should also be only once. - index = p.expect ([ - pexpect.EOF, - pexpect.TIMEOUT, - b'abcd', - b'wxyz', - b'1234']) - assert index == 2, "index="+str(index) - index = p.expect ([ - pexpect.EOF, - b'abcd', - b'wxyz', - b'7890']) - assert index == 2, "index="+str(index) - p.setecho(1) # Turn on tty echo - p.sendline (b'7890') # Should see this twice. - index = p.expect ([pexpect.EOF,b'abcd',b'wxyz',b'7890']) - assert index == 3, "index="+str(index) - index = p.expect ([pexpect.EOF,b'abcd',b'wxyz',b'7890']) - assert index == 3, "index="+str(index) - p.sendeof() - - def test_expect_index (self): - '''This tests that mixed list of regex strings, TIMEOUT, and EOF all - return the correct index when matched. - ''' - p = pexpect.spawn('cat', echo=False, timeout=5) - self._expect_index(p) - - def test_expect_index_exact (self): - '''Like test_expect_index(), but using expect_exact(). - ''' - p = pexpect.spawn('cat', echo=False, timeout=5) - p.expect = p.expect_exact - self._expect_index(p) - - def _expect_index (self, p): - p.sendline (b'1234') - index = p.expect ([b'abcd',b'wxyz',b'1234',pexpect.EOF]) - assert index == 2, "index="+str(index) - p.sendline (b'abcd') - index = p.expect ([pexpect.TIMEOUT,b'abcd',b'wxyz',b'1234',pexpect.EOF]) - assert index == 1, "index="+str(index)+str(p) - p.sendline (b'wxyz') - index = p.expect ([b'54321',pexpect.TIMEOUT,b'abcd',b'wxyz',b'1234',pexpect.EOF]) - assert index == 3, "index="+str(index) # Expect 'wxyz' - p.sendline (b'$*!@?') - index = p.expect ([b'54321',pexpect.TIMEOUT,b'abcd',b'wxyz',b'1234',pexpect.EOF], - timeout=1) - assert index == 1, "index="+str(index) # Expect TIMEOUT - p.sendeof () - index = p.expect ([b'54321',pexpect.TIMEOUT,b'abcd',b'wxyz',b'1234',pexpect.EOF]) - assert index == 5, "index="+str(index) # Expect EOF - - def test_expect (self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = pexpect.spawn('ls -l /bin') - the_new_way = b'' - while 1: - i = p.expect ([b'\n', pexpect.EOF]) - the_new_way = the_new_way + p.before - if i == 1: - break - the_new_way = the_new_way.rstrip() - the_new_way = the_new_way.replace(b'\r\n', b'\n' - ).replace(b'\r', b'\n').replace(b'\n\n', b'\n').rstrip() - the_old_way = the_old_way.replace(b'\r\n', b'\n' - ).replace(b'\r', b'\n').replace(b'\n\n', b'\n').rstrip() - assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way) - - def test_expect_exact (self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = pexpect.spawn('ls -l /bin') - the_new_way = b'' - while 1: - i = p.expect_exact ([b'\n', pexpect.EOF]) - the_new_way = the_new_way + p.before - if i == 1: - break - the_new_way = the_new_way.replace(b'\r\n', b'\n' - ).replace(b'\r', b'\n').replace(b'\n\n', b'\n').rstrip() - the_old_way = the_old_way.replace(b'\r\n', b'\n' - ).replace(b'\r', b'\n').replace(b'\n\n', b'\n').rstrip() - assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way) - p = pexpect.spawn('echo hello.?world') - i = p.expect_exact(b'.?') - self.assertEqual(p.before, b'hello') - self.assertEqual(p.after, b'.?') - - def test_expect_eof (self): - the_old_way = subprocess.Popen(args=['/bin/ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = pexpect.spawn('/bin/ls -l /bin') - p.expect(pexpect.EOF) # This basically tells it to read everything. Same as pexpect.run() function. - the_new_way = p.before - the_new_way = the_new_way.replace(b'\r\n', b'\n' - ).replace(b'\r', b'\n').replace(b'\n\n', b'\n').rstrip() - the_old_way = the_old_way.replace(b'\r\n', b'\n' - ).replace(b'\r', b'\n').replace(b'\n\n', b'\n').rstrip() - assert the_old_way == the_new_way, hex_diff(the_old_way, the_new_way) - - def test_expect_timeout (self): - p = pexpect.spawn('cat', timeout=5) - p.expect(pexpect.TIMEOUT) # This tells it to wait for timeout. - self.assertEqual(p.after, pexpect.TIMEOUT) - - def test_unexpected_eof (self): - p = pexpect.spawn('ls -l /bin') - try: - p.expect('_Z_XY_XZ') # Probably never see this in ls output. - except pexpect.EOF: - pass - else: - self.fail ('Expected an EOF exception.') - - def test_buffer_interface(self): - p = pexpect.spawn('cat', timeout=5) - p.sendline (b'Hello') - p.expect (b'Hello') - assert len(p.buffer) - p.buffer = b'Testing' - p.sendeof () - - def test_before_across_chunks(self): - # https://github.com/pexpect/pexpect/issues/478 - child = pexpect.spawn( - '''/bin/bash -c "openssl rand -base64 {} | head -500 | nl --number-format=rz --number-width=5 2>&1 ; echo 'PATTERN!!!'"'''.format(1024 * 1024 * 2), - searchwindowsize=128 - ) - child.expect(['PATTERN']) - assert len(child.before.splitlines()) == 500 - assert child.after == b'PATTERN' - assert child.buffer == b'!!!\r\n' - - def _before_after(self, p): - p.timeout = 5 - - p.expect(b'5') - self.assertEqual(p.after, b'5') - assert p.before.startswith(b'[0, 1, 2'), p.before - - p.expect(b'50') - self.assertEqual(p.after, b'50') - assert p.before.startswith(b', 6, 7, 8'), p.before[:20] - assert p.before.endswith(b'48, 49, '), p.before[-20:] - - p.expect(pexpect.EOF) - self.assertEqual(p.after, pexpect.EOF) - assert p.before.startswith(b', 51, 52'), p.before[:20] - assert p.before.endswith(b', 99]\r\n'), p.before[-20:] - - def test_before_after(self): - '''This tests expect() for some simple before/after things. - ''' - p = pexpect.spawn('%s -Wi list100.py' % self.PYTHONBIN, env=no_coverage_env()) - self._before_after(p) - - def test_before_after_exact(self): - '''This tests some simple before/after things, for - expect_exact(). (Grahn broke it at one point.) - ''' - p = pexpect.spawn('%s -Wi list100.py' % self.PYTHONBIN, env=no_coverage_env()) - # mangle the spawn so we test expect_exact() instead - p.expect = p.expect_exact - self._before_after(p) - - def _ordering(self, p): - p.timeout = 20 - p.expect(b'>>> ') - - p.sendline('list(range(4*3))') - self.assertEqual(p.expect([b'5,', b'5,']), 0) - p.expect(b'>>> ') - - p.sendline(b'list(range(4*3))') - self.assertEqual(p.expect([b'7,', b'5,']), 1) - p.expect(b'>>> ') - - p.sendline(b'list(range(4*3))') - self.assertEqual(p.expect([b'5,', b'7,']), 0) - p.expect(b'>>> ') - - p.sendline(b'list(range(4*5))') - self.assertEqual(p.expect([b'2,', b'12,']), 0) - p.expect(b'>>> ') - - p.sendline(b'list(range(4*5))') - self.assertEqual(p.expect([b'12,', b'2,']), 1) - - def test_ordering(self): - '''This tests expect() for which pattern is returned - when many may eventually match. I (Grahn) am a bit - confused about what should happen, but this test passes - with pexpect 2.1. - ''' - p = pexpect.spawn(self.PYTHONBIN) - self._ordering(p) - - def test_ordering_exact(self): - '''This tests expect_exact() for which pattern is returned - when many may eventually match. I (Grahn) am a bit - confused about what should happen, but this test passes - for the expect() method with pexpect 2.1. - ''' - p = pexpect.spawn(self.PYTHONBIN) - # mangle the spawn so we test expect_exact() instead - p.expect = p.expect_exact - self._ordering(p) - - def _greed(self, expect): - # End at the same point: the one with the earliest start should win - self.assertEqual(expect([b'3, 4', b'2, 3, 4']), 1) - - # Start at the same point: first pattern passed wins - self.assertEqual(expect([b'5,', b'5, 6']), 0) - - # Same pattern passed twice: first instance wins - self.assertEqual(expect([b'7, 8', b'7, 8, 9', b'7, 8']), 0) - - def _greed_read1(self, expect): - # Here, one has an earlier start and a later end. When processing - # one character at a time, the one that finishes first should win, - # because we don't know about the other match when it wins. - # If maxread > 1, this behaviour is currently undefined, although in - # most cases the one that starts first will win. - self.assertEqual(expect([b'1, 2, 3', b'2,']), 1) - - def test_greed(self): - p = pexpect.spawn(self.PYTHONBIN + ' list100.py') - self._greed(p.expect) - - p = pexpect.spawn(self.PYTHONBIN + ' list100.py', maxread=1) - self._greed_read1(p.expect) - - def test_greed_exact(self): - p = pexpect.spawn(self.PYTHONBIN + ' list100.py') - self._greed(p.expect_exact) - - p = pexpect.spawn(self.PYTHONBIN + ' list100.py', maxread=1) - self._greed_read1(p.expect_exact) - - def test_bad_arg(self): - p = pexpect.spawn('cat') - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect(1) - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect([1, b'2']) - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect_exact(1) - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect_exact([1, b'2']) - - def test_timeout_none(self): - p = pexpect.spawn('echo abcdef', timeout=None) - p.expect('abc') - p.expect_exact('def') - p.expect(pexpect.EOF) - - def test_signal_handling(self): - ''' - This tests the error handling of a signal interrupt (usually a - SIGWINCH generated when a window is resized), but in this test, we - are substituting an ALARM signal as this is much easier for testing - and is treated the same as a SIGWINCH. - - To ensure that the alarm fires during the expect call, we are - setting the signal to alarm after 1 second while the spawned process - sleeps for 2 seconds prior to sending the expected output. - ''' - def noop(x, y): - pass - signal.signal(signal.SIGALRM, noop) - - p1 = pexpect.spawn('%s sleep_for.py 2' % self.PYTHONBIN, timeout=5) - p1.expect('READY') - signal.alarm(1) - p1.expect('END') - - def test_stdin_closed(self): - ''' - Ensure pexpect continues to operate even when stdin is closed - ''' - class Closed_stdin_proc(multiprocessing.Process): - def run(self): - sys.__stdin__.close() - cat = pexpect.spawn('cat') - cat.sendeof() - cat.expect(pexpect.EOF) - - proc = Closed_stdin_proc() - proc.start() - proc.join() - assert proc.exitcode == 0 - - def test_stdin_stdout_closed(self): - ''' - Ensure pexpect continues to operate even when stdin and stdout is closed - ''' - class Closed_stdin_stdout_proc(multiprocessing.Process): - def run(self): - sys.__stdin__.close() - sys.__stdout__.close() - cat = pexpect.spawn('cat') - cat.sendeof() - cat.expect(pexpect.EOF) - - proc = Closed_stdin_stdout_proc() - proc.start() - proc.join() - assert proc.exitcode == 0 - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase, 'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_filedescriptor.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_filedescriptor.py deleted file mode 100755 index d9164e1d50b..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_filedescriptor.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -from pexpect import fdpexpect -import unittest -from . import PexpectTestCase -import os - -class ExpectTestCase(PexpectTestCase.PexpectTestCase): - def setUp(self): - print(self.id()) - PexpectTestCase.PexpectTestCase.setUp(self) - - def test_fd (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = fdpexpect.fdspawn (fd) - s.expect(b'This is the end of test data:') - s.expect(pexpect.EOF) - self.assertEqual(s.before, b' END\n') - - def test_maxread (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = fdpexpect.fdspawn (fd) - s.maxread = 100 - s.expect('2') - s.expect ('This is the end of test data:') - s.expect (pexpect.EOF) - self.assertEqual(s.before, b' END\n') - - def test_fd_isalive (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = fdpexpect.fdspawn(fd) - assert s.isalive() - os.close(fd) - assert not s.isalive(), "Should not be alive after close()" - - def test_fd_isatty (self): - fd = os.open ('TESTDATA.txt', os.O_RDONLY) - s = fdpexpect.fdspawn (fd) - assert not s.isatty() - s.close() - - def test_fileobj(self): - f = open('TESTDATA.txt', 'r') - s = fdpexpect.fdspawn(f) # Should get the fileno from the file handle - s.expect('2') - s.close() - assert not s.isalive() - s.close() # Smoketest - should be able to call this again - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase, 'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_interact.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_interact.py deleted file mode 100755 index 865353b7151..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_interact.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function -from __future__ import unicode_literals - -import os -import pexpect -import unittest -import sys -from . import PexpectTestCase - - -class InteractTestCase (PexpectTestCase.PexpectTestCase): - def setUp(self): - super(InteractTestCase, self).setUp() - self.env = env = os.environ.copy() - - # Ensure 'import pexpect' works in subprocess interact*.py - if 'PYTHONPATH' in env: - env['PYTHONPATH'] = os.pathsep.join((self.project_dir, - env['PYTHONPATH'])) - else: - env['PYTHONPATH'] = self.project_dir - - self.interact_py = ('{sys.executable} interact.py'.format(sys=sys)) - - def test_interact_escape(self): - " Ensure `escape_character' value exits interactive mode. " - p = pexpect.spawn(self.interact_py, timeout=5, env=self.env) - p.expect('READY') - p.sendcontrol(']') # chr(29), the default `escape_character' - # value of pexpect.interact(). - p.expect_exact('Escaped interact') - p.expect(pexpect.EOF) - assert not p.isalive() - assert p.exitstatus == 0 - - def test_interact_escape_None(self): - " Return only after Termination when `escape_character=None'. " - p = pexpect.spawn('{self.interact_py} --no-escape'.format(self=self), - timeout=5, env=self.env) - p.expect('READY') - p.sendcontrol(']') - p.expect('29<STOP>') - p.send('\x00') - if not os.environ.get('TRAVIS', None): - # on Travis-CI, we sometimes miss trailing stdout from the - # chain of child processes, not entirely sure why. So this - # is skipped on such systems. - p.expect('0<STOP>') - p.expect_exact('Escaped interact') - p.expect(pexpect.EOF) - assert not p.isalive() - assert p.exitstatus == 0 - - def test_interact_exit_unicode(self): - " Ensure subprocess receives utf8. " - p = pexpect.spawnu('{self.interact_py} --utf8'.format(self=self), - timeout=5, env=self.env) - p.expect('READY') - p.send('ɑ') # >>> map(ord, u'ɑ'.encode('utf8')) - p.expect('201<STOP>') # [201, 145] - p.expect('145<STOP>') - p.send('Β') # >>> map(ord, u'Β'.encode('utf8')) - p.expect('206<STOP>') # [206, 146] - p.expect('146<STOP>') - p.send('\x00') - if not os.environ.get('TRAVIS', None): - # on Travis-CI, we sometimes miss trailing stdout from the - # chain of child processes, not entirely sure why. So this - # is skipped on such systems. - p.expect('0<STOP>') - p.expect_exact('Escaped interact') - p.expect(pexpect.EOF) - assert not p.isalive() - assert p.exitstatus == 0 - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(InteractTestCase, 'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_isalive.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_isalive.py deleted file mode 100755 index cd79d09a4d3..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_isalive.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -import signal -import sys -import time -from . import PexpectTestCase - - -class IsAliveTestCase(PexpectTestCase.PexpectTestCase): - """Various tests for the running status of processes.""" - - def test_expect_wait(self): - """Ensure consistency in wait() and isalive().""" - p = pexpect.spawn('sleep 1') - assert p.isalive() - assert p.wait() == 0 - assert not p.isalive() - # In previous versions of ptyprocess/pexpect, calling wait() a second - # time would raise an exception, but not since v4.0 - assert p.wait() == 0 - - def test_expect_wait_after_termination(self): - """Ensure wait on a process terminated by kill -9.""" - p = pexpect.spawn('sleep 3') - assert p.isalive() - p.kill(9) - time.sleep(1) - - # when terminated, the exitstatus is None, but p.signalstatus - # and p.terminated reflects that the kill -9 nature. - assert p.wait() is None - assert p.signalstatus == 9 - assert p.terminated == True - assert not p.isalive() - - def test_signal_wait(self): - '''Test calling wait with a process terminated by a signal.''' - if not hasattr(signal, 'SIGALRM'): - return 'SKIP' - p = pexpect.spawn(sys.executable, ['alarm_die.py']) - p.wait() - assert p.exitstatus is None - self.assertEqual(p.signalstatus, signal.SIGALRM) - - def test_expect_isalive_dead_after_normal_termination (self): - p = pexpect.spawn('ls', timeout=15) - p.expect(pexpect.EOF) - assert not p.isalive() - - def test_expect_isalive_dead_after_SIGHUP(self): - p = pexpect.spawn('cat', timeout=5, ignore_sighup=False) - assert p.isalive() - force = False - if sys.platform.lower().startswith('sunos'): - # On Solaris (SmartOs), and only when executed from cron(1), SIGKILL - # is required to end the sub-process. This is done using force=True - force = True - assert p.terminate(force) == True - p.expect(pexpect.EOF) - assert not p.isalive() - - def test_expect_isalive_dead_after_SIGINT(self): - p = pexpect.spawn('cat', timeout=5) - assert p.isalive() - force = False - if sys.platform.lower().startswith('sunos'): - # On Solaris (SmartOs), and only when executed from cron(1), SIGKILL - # is required to end the sub-process. This is done using force=True - force = True - assert p.terminate(force) == True - p.expect(pexpect.EOF) - assert not p.isalive() - - def test_expect_isalive_dead_after_SIGKILL(self): - p = pexpect.spawn('cat', timeout=5) - assert p.isalive() - p.kill(9) - p.expect(pexpect.EOF) - assert not p.isalive() - - def test_forced_terminate(self): - p = pexpect.spawn(sys.executable, ['needs_kill.py']) - p.expect('READY') - assert p.terminate(force=True) == True - p.expect(pexpect.EOF) - assert not p.isalive() - -### Some platforms allow this. Some reset status after call to waitpid. -### probably not necessary, isalive() returns early when terminate is False. - def test_expect_isalive_consistent_multiple_calls (self): - '''This tests that multiple calls to isalive() return same value. - ''' - p = pexpect.spawn('cat') - assert p.isalive() - assert p.isalive() - p.sendeof() - p.expect(pexpect.EOF) - assert not p.isalive() - assert not p.isalive() - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(IsAliveTestCase, 'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_log.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_log.py deleted file mode 100755 index 4ad225697d8..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_log.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -import os -import tempfile -from . import PexpectTestCase - -# the program cat(1) may display ^D\x08\x08 when \x04 (EOF, Ctrl-D) is sent -_CAT_EOF = b'^D\x08\x08' - -class TestCaseLog(PexpectTestCase.PexpectTestCase): - - def test_log (self): - log_message = 'This is a test.' - filename = tempfile.mktemp() - mylog = open(filename, 'wb') - p = pexpect.spawn('echo', [log_message]) - p.logfile = mylog - p.expect(pexpect.EOF) - p.logfile = None - mylog.close() - with open(filename, 'rb') as f: - lf = f.read() - os.unlink(filename) - self.assertEqual(lf.rstrip(), log_message.encode('ascii')) - - def test_log_logfile_read (self): - log_message = 'This is a test.' - filename = tempfile.mktemp() - mylog = open(filename, 'wb') - p = pexpect.spawn('cat') - p.logfile_read = mylog - p.sendline(log_message) - p.sendeof() - p.expect(pexpect.EOF) - p.logfile = None - mylog.close() - with open(filename, 'rb') as f: - lf = f.read() - os.unlink (filename) - lf = lf.replace(_CAT_EOF, b'') - self.assertEqual(lf, b'This is a test.\r\nThis is a test.\r\n') - - def test_log_logfile_send (self): - log_message = b'This is a test.' - filename = tempfile.mktemp() - mylog = open (filename, 'wb') - p = pexpect.spawn('cat') - p.logfile_send = mylog - p.sendline(log_message) - p.sendeof() - p.expect (pexpect.EOF) - p.logfile = None - mylog.close() - with open(filename, 'rb') as f: - lf = f.read() - os.unlink(filename) - lf = lf.replace(b'\x04', b'') - self.assertEqual(lf.rstrip(), log_message) - - def test_log_send_and_received (self): - - '''The logfile should have the test message three time -- once for the - data we sent. Once for the data that cat echos back as characters are - typed. And once for the data that cat prints after we send a linefeed - (sent by sendline). ''' - - log_message = 'This is a test.' - filename = tempfile.mktemp() - mylog = open(filename, 'wb') - p = pexpect.spawn('cat') - p.logfile = mylog - p.sendline(log_message) - p.sendeof() - p.expect (pexpect.EOF) - p.logfile = None - mylog.close() - with open(filename, 'rb') as f: - lf = f.read() - os.unlink(filename) - lf = lf.replace(b'\x04', b'').replace(_CAT_EOF, b'') - self.assertEqual(lf, - b'This is a test.\nThis is a test.\r\nThis is a test.\r\n') - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCaseLog,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_misc.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_misc.py deleted file mode 100755 index 6052b6aee13..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_misc.py +++ /dev/null @@ -1,373 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import unittest -import sys -import re -import signal -import time -import tempfile -import os - -import pexpect -from . import PexpectTestCase - -# the program cat(1) may display ^D\x08\x08 when \x04 (EOF, Ctrl-D) is sent -_CAT_EOF = b'^D\x08\x08' - - -if (sys.version_info[0] >= 3): - def _u(s): - return s.decode('utf-8') -else: - def _u(s): - return s - - -class TestCaseMisc(PexpectTestCase.PexpectTestCase): - - def test_isatty(self): - " Test isatty() is True after spawning process on most platforms. " - child = pexpect.spawn('cat') - if not child.isatty() and sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - assert child.isatty() - - def test_isatty_poll(self): - " Test isatty() is True after spawning process on most platforms. " - child = pexpect.spawn('cat', use_poll=True) - if not child.isatty() and sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - assert child.isatty() - - def test_read(self): - " Test spawn.read by calls of various size. " - child = pexpect.spawn('cat') - child.sendline("abc") - child.sendeof() - self.assertEqual(child.read(0), b'') - self.assertEqual(child.read(1), b'a') - self.assertEqual(child.read(1), b'b') - self.assertEqual(child.read(1), b'c') - self.assertEqual(child.read(2), b'\r\n') - remaining = child.read().replace(_CAT_EOF, b'') - self.assertEqual(remaining, b'abc\r\n') - - def test_read_poll(self): - " Test spawn.read by calls of various size. " - child = pexpect.spawn('cat', use_poll=True) - child.sendline("abc") - child.sendeof() - self.assertEqual(child.read(0), b'') - self.assertEqual(child.read(1), b'a') - self.assertEqual(child.read(1), b'b') - self.assertEqual(child.read(1), b'c') - self.assertEqual(child.read(2), b'\r\n') - remaining = child.read().replace(_CAT_EOF, b'') - self.assertEqual(remaining, b'abc\r\n') - - def test_read_poll_timeout(self): - " Test use_poll properly times out " - child = pexpect.spawn('sleep 5', use_poll=True) - with self.assertRaises(pexpect.TIMEOUT): - child.expect(pexpect.EOF, timeout=1) - - def test_readline_bin_echo(self): - " Test spawn('echo'). " - # given, - child = pexpect.spawn('echo', ['alpha', 'beta']) - - # exercise, - assert child.readline() == b'alpha beta' + child.crlf - - def test_readline(self): - " Test spawn.readline(). " - # when argument 0 is sent, nothing is returned. - # Otherwise the argument value is meaningless. - child = pexpect.spawn('cat', echo=False) - child.sendline("alpha") - child.sendline("beta") - child.sendline("gamma") - child.sendline("delta") - child.sendeof() - assert child.readline(0) == b'' - assert child.readline().rstrip() == b'alpha' - assert child.readline(1).rstrip() == b'beta' - assert child.readline(2).rstrip() == b'gamma' - assert child.readline().rstrip() == b'delta' - child.expect(pexpect.EOF) - assert not child.isalive() - assert child.exitstatus == 0 - - def test_iter(self): - " iterating over lines of spawn.__iter__(). " - child = pexpect.spawn('cat', echo=False) - child.sendline("abc") - child.sendline("123") - child.sendeof() - # Don't use ''.join() because we want to test __iter__(). - page = b'' - for line in child: - page += line - page = page.replace(_CAT_EOF, b'') - assert page == b'abc\r\n123\r\n' - - def test_readlines(self): - " reading all lines of spawn.readlines(). " - child = pexpect.spawn('cat', echo=False) - child.sendline("abc") - child.sendline("123") - child.sendeof() - page = b''.join(child.readlines()).replace(_CAT_EOF, b'') - assert page == b'abc\r\n123\r\n' - child.expect(pexpect.EOF) - assert not child.isalive() - assert child.exitstatus == 0 - - def test_write(self): - " write a character and return it in return. " - child = pexpect.spawn('cat', echo=False) - child.write('a') - child.write('\r') - self.assertEqual(child.readline(), b'a\r\n') - - def test_writelines(self): - " spawn.writelines() " - child = pexpect.spawn('cat') - # notice that much like file.writelines, we do not delimit by newline - # -- it is equivalent to calling write(''.join([args,])) - child.writelines(['abc', '123', 'xyz', '\r']) - child.sendeof() - line = child.readline() - assert line == b'abc123xyz\r\n' - - def test_eof(self): - " call to expect() after EOF is received raises pexpect.EOF " - child = pexpect.spawn('cat') - child.sendeof() - with self.assertRaises(pexpect.EOF): - child.expect('the unexpected') - - def test_with(self): - "spawn can be used as a context manager" - with pexpect.spawn(sys.executable + ' echo_w_prompt.py') as p: - p.expect('<in >') - p.sendline(b'alpha') - p.expect(b'<out>alpha') - assert p.isalive() - - assert not p.isalive() - - def test_terminate(self): - " test force terminate always succeeds (SIGKILL). " - child = pexpect.spawn('cat') - child.terminate(force=1) - assert child.terminated - - def test_sighup(self): - " validate argument `ignore_sighup=True` and `ignore_sighup=False`. " - getch = sys.executable + ' getch.py' - child = pexpect.spawn(getch, ignore_sighup=True) - child.expect('READY') - child.kill(signal.SIGHUP) - for _ in range(10): - if not child.isalive(): - self.fail('Child process should not have exited.') - time.sleep(0.1) - - child = pexpect.spawn(getch, ignore_sighup=False) - child.expect('READY') - child.kill(signal.SIGHUP) - for _ in range(10): - if not child.isalive(): - break - time.sleep(0.1) - else: - self.fail('Child process should have exited.') - - def test_bad_child_pid(self): - " assert bad condition error in isalive(). " - expect_errmsg = re.escape("isalive() encountered condition where ") - child = pexpect.spawn('cat') - child.terminate(force=1) - # Force an invalid state to test isalive - child.ptyproc.terminated = 0 - try: - with self.assertRaisesRegexp(pexpect.ExceptionPexpect, - ".*" + expect_errmsg): - child.isalive() - finally: - # Force valid state for child for __del__ - child.terminated = 1 - - def test_bad_arguments_suggest_fdpsawn(self): - " assert custom exception for spawn(int). " - expect_errmsg = "maybe you want to use fdpexpect.fdspawn" - with self.assertRaisesRegexp(pexpect.ExceptionPexpect, - ".*" + expect_errmsg): - pexpect.spawn(1) - - def test_bad_arguments_second_arg_is_list(self): - " Second argument to spawn, if used, must be only a list." - with self.assertRaises(TypeError): - pexpect.spawn('ls', '-la') - - with self.assertRaises(TypeError): - # not even a tuple, - pexpect.spawn('ls', ('-la',)) - - def test_read_after_close_raises_value_error(self): - " Calling read_nonblocking after close raises ValueError. " - # as read_nonblocking underlies all other calls to read, - # ValueError should be thrown for all forms of read. - with self.assertRaises(ValueError): - p = pexpect.spawn('cat') - p.close() - p.read_nonblocking() - - with self.assertRaises(ValueError): - p = pexpect.spawn('cat') - p.close() - p.read() - - with self.assertRaises(ValueError): - p = pexpect.spawn('cat') - p.close() - p.readline() - - with self.assertRaises(ValueError): - p = pexpect.spawn('cat') - p.close() - p.readlines() - - def test_isalive(self): - " check isalive() before and after EOF. (True, False) " - child = pexpect.spawn('cat') - assert child.isalive() is True - child.sendeof() - child.expect(pexpect.EOF) - assert child.isalive() is False - - def test_bad_type_in_expect(self): - " expect() does not accept dictionary arguments. " - child = pexpect.spawn('cat') - with self.assertRaises(TypeError): - child.expect({}) - - def test_cwd(self): - " check keyword argument `cwd=' of pexpect.run() " - tmp_dir = os.path.realpath(tempfile.gettempdir()) - default = pexpect.run('pwd') - pwd_tmp = pexpect.run('pwd', cwd=tmp_dir).rstrip() - assert default != pwd_tmp - assert tmp_dir == _u(pwd_tmp) - - def _test_searcher_as(self, searcher, plus=None): - # given, - given_words = ['alpha', 'beta', 'gamma', 'delta', ] - given_search = given_words - if searcher == pexpect.searcher_re: - given_search = [re.compile(word) for word in given_words] - if plus is not None: - given_search = given_search + [plus] - search_string = searcher(given_search) - basic_fmt = '\n {0}: {1}' - fmt = basic_fmt - if searcher is pexpect.searcher_re: - fmt = '\n {0}: re.compile({1})' - expected_output = '{0}:'.format(searcher.__name__) - idx = 0 - for word in given_words: - expected_output += fmt.format(idx, "'{0}'".format(word)) - idx += 1 - if plus is not None: - if plus == pexpect.EOF: - expected_output += basic_fmt.format(idx, 'EOF') - elif plus == pexpect.TIMEOUT: - expected_output += basic_fmt.format(idx, 'TIMEOUT') - - # exercise, - assert search_string.__str__() == expected_output - - def test_searcher_as_string(self): - " check searcher_string(..).__str__() " - self._test_searcher_as(pexpect.searcher_string) - - def test_searcher_as_string_with_EOF(self): - " check searcher_string(..).__str__() that includes EOF " - self._test_searcher_as(pexpect.searcher_string, plus=pexpect.EOF) - - def test_searcher_as_string_with_TIMEOUT(self): - " check searcher_string(..).__str__() that includes TIMEOUT " - self._test_searcher_as(pexpect.searcher_string, plus=pexpect.TIMEOUT) - - def test_searcher_re_as_string(self): - " check searcher_re(..).__str__() " - self._test_searcher_as(pexpect.searcher_re) - - def test_searcher_re_as_string_with_EOF(self): - " check searcher_re(..).__str__() that includes EOF " - self._test_searcher_as(pexpect.searcher_re, plus=pexpect.EOF) - - def test_searcher_re_as_string_with_TIMEOUT(self): - " check searcher_re(..).__str__() that includes TIMEOUT " - self._test_searcher_as(pexpect.searcher_re, plus=pexpect.TIMEOUT) - - def test_nonnative_pty_fork(self): - " test forced self.__fork_pty() and __pty_make_controlling_tty " - # given, - class spawn_ourptyfork(pexpect.spawn): - def _spawn(self, command, args=[], preexec_fn=None, - dimensions=None): - self.use_native_pty_fork = False - pexpect.spawn._spawn(self, command, args, preexec_fn, - dimensions) - - # exercise, - p = spawn_ourptyfork('cat', echo=False) - # verify, - p.sendline('abc') - p.expect('abc') - p.sendeof() - p.expect(pexpect.EOF) - assert not p.isalive() - - def test_exception_tb(self): - " test get_trace() filters away pexpect/__init__.py calls. " - p = pexpect.spawn('sleep 1') - try: - p.expect('BLAH') - except pexpect.ExceptionPexpect as e: - # get_trace should filter out frames in pexpect's own code - tb = e.get_trace() - # exercise, - assert 'raise ' not in tb - assert 'pexpect/__init__.py' not in tb - else: - assert False, "Should have raised an exception." - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCaseMisc,'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_missing_command.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_missing_command.py deleted file mode 100755 index 92e47335e5a..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_missing_command.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase - -class MissingCommandTestCase (PexpectTestCase.PexpectTestCase): - def testMissingCommand(self): - try: - i = pexpect.spawn ('ZXQYQZX') - except Exception: - pass - else: - self.fail('Expected an Exception.') - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(MissingCommandTestCase,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_performance.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_performance.py deleted file mode 100755 index 63778af672f..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_performance.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import print_function - -import unittest, time, sys -import platform -import pexpect -import re -from . import PexpectTestCase - -# This isn't exactly a unit test, but it fits in nicely with the rest of the tests. - -class PerformanceTestCase (PexpectTestCase.PexpectTestCase): - - '''Testing the performance of expect, with emphasis on wading through long - inputs. ''' - - if sys.version_info[0] >= 3: - @staticmethod - def _iter_n(n): - s = 'for n in range(1, %d+1): print(n)' % n - return s.encode('ascii') - - else: - @staticmethod - def _iter_n(n): - return 'for n in range(1, %d+1): print(n)' % n - - def plain_range(self, n): - e = pexpect.spawn('python', timeout=100) - self.assertEqual(e.expect(b'>>>'), 0) - e.sendline(self._iter_n(n)) - self.assertEqual(e.expect(br'\.{3}'), 0) - e.sendline(b'') - self.assertEqual(e.expect([b'inquisition', '%d' % n]), 1) - - def window_range(self, n): - e = pexpect.spawn('python', timeout=100) - self.assertEqual(e.expect(b'>>>'), 0) - e.sendline(self._iter_n(n)) - self.assertEqual(e.expect(r'\.{3}'), 0) - e.sendline(b'') - self.assertEqual(e.expect([b'inquisition', '%d' % n], searchwindowsize=20), 1) - - def exact_range(self, n): - e = pexpect.spawn('python', timeout=100) - self.assertEqual(e.expect_exact([b'>>>']), 0) - e.sendline(self._iter_n(n)) - self.assertEqual(e.expect_exact([b'...']), 0) - e.sendline(b'') - self.assertEqual(e.expect_exact([b'inquisition', '%d' % n],timeout=520), 1) - - def ewin_range(self, n): - e = pexpect.spawn('python', timeout=100) - self.assertEqual(e.expect_exact([b'>>>']), 0) - e.sendline(self._iter_n(n)) - self.assertEqual(e.expect_exact([b'...']), 0) - e.sendline(b'') - self.assertEqual(e.expect_exact([b'inquisition', '%d' % n], searchwindowsize=20), 1) - - def faster_range(self, n): - e = pexpect.spawn('python', timeout=100) - self.assertEqual(e.expect(b'>>>'), 0) - e.sendline(('list(range(1, %d+1))' % n).encode('ascii')) - self.assertEqual(e.expect([b'inquisition', '%d' % n]), 1) - - def test_100000(self): - if platform.python_implementation() == 'PyPy': - raise unittest.SkipTest("This test fails on PyPy because of REPL differences") - print() - start_time = time.time() - self.plain_range (100000) - print("100000 calls to plain_range:", (time.time() - start_time)) - start_time = time.time() - self.window_range(100000) - print("100000 calls to window_range:", (time.time() - start_time)) - start_time = time.time() - self.exact_range (100000) - print("100000 calls to exact_range:", (time.time() - start_time)) - start_time = time.time() - self.ewin_range (100000) - print("100000 calls to ewin_range:", (time.time() - start_time)) - start_time = time.time() - self.faster_range(100000) - print("100000 calls to faster_range:", (time.time() - start_time)) - - def test_large_stdout_stream(self): - e = pexpect.spawn('openssl rand -base64 {}'.format(1024*1024*25), searchwindowsize=1000) - resp = e.expect(['Password:', pexpect.EOF, pexpect.TIMEOUT]) - assert resp == 1 # index 1 == EOF - -if __name__ == "__main__": - unittest.main() - -suite = unittest.makeSuite(PerformanceTestCase,'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_pickling.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_pickling.py deleted file mode 100644 index 6538677075a..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_pickling.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -import pickle -import unittest - -from pexpect import ExceptionPexpect - -class PickleTest(unittest.TestCase): - def test_picking(self): - e = ExceptionPexpect('Oh noes!') - clone = pickle.loads(pickle.dumps(e)) - self.assertEqual(e.value, clone.value) - -if __name__ == '__main__': - unittest.main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_popen_spawn.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_popen_spawn.py deleted file mode 100644 index fca7493d3be..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_popen_spawn.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import unittest -import subprocess - - -import pexpect -from pexpect.popen_spawn import PopenSpawn -from . import PexpectTestCase - - -class ExpectTestCase (PexpectTestCase.PexpectTestCase): - - def test_expect_basic(self): - p = PopenSpawn('cat', timeout=5) - p.sendline(b'Hello') - p.sendline(b'there') - p.sendline(b'Mr. Python') - p.expect(b'Hello') - p.expect(b'there') - p.expect(b'Mr. Python') - p.sendeof() - p.expect(pexpect.EOF) - - def test_expect_exact_basic(self): - p = PopenSpawn('cat', timeout=5) - p.sendline(b'Hello') - p.sendline(b'there') - p.sendline(b'Mr. Python') - p.expect_exact(b'Hello') - p.expect_exact(b'there') - p.expect_exact(b'Mr. Python') - p.sendeof() - p.expect_exact(pexpect.EOF) - - def test_expect(self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = PopenSpawn('ls -l /bin') - the_new_way = b'' - while 1: - i = p.expect([b'\n', pexpect.EOF]) - the_new_way = the_new_way + p.before - if i == 1: - break - the_new_way += b'\n' - the_new_way = the_new_way.rstrip() - assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way) - - def test_expect_exact(self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = PopenSpawn('ls -l /bin') - the_new_way = b'' - while 1: - i = p.expect_exact([b'\n', pexpect.EOF]) - the_new_way = the_new_way + p.before - if i == 1: - break - the_new_way += b'\n' - the_new_way = the_new_way.rstrip() - - assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way) - p = PopenSpawn('echo hello.?world') - i = p.expect_exact(b'.?') - self.assertEqual(p.before, b'hello') - self.assertEqual(p.after, b'.?') - - def test_expect_eof(self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = PopenSpawn('ls -l /bin') - # This basically tells it to read everything. Same as pexpect.run() - # function. - p.expect(pexpect.EOF) - the_new_way = p.before.rstrip() - assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way) - - def test_expect_timeout(self): - p = PopenSpawn('cat', timeout=5) - p.expect(pexpect.TIMEOUT) # This tells it to wait for timeout. - self.assertEqual(p.after, pexpect.TIMEOUT) - - def test_unexpected_eof(self): - p = PopenSpawn('ls -l /bin') - try: - p.expect('_Z_XY_XZ') # Probably never see this in ls output. - except pexpect.EOF: - pass - else: - self.fail('Expected an EOF exception.') - - def test_bad_arg(self): - p = PopenSpawn('cat') - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect(1) - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect([1, b'2']) - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect_exact(1) - with self.assertRaisesRegexp(TypeError, '.*must be one of'): - p.expect_exact([1, b'2']) - - def test_timeout_none(self): - p = PopenSpawn('echo abcdef', timeout=None) - p.expect('abc') - p.expect_exact('def') - p.expect(pexpect.EOF) - - def test_crlf(self): - p = PopenSpawn('echo alpha beta') - assert p.read() == b'alpha beta' + p.crlf - - def test_crlf_encoding(self): - p = PopenSpawn('echo alpha beta', encoding='utf-8') - assert p.read() == 'alpha beta' + p.crlf - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase, 'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_pxssh.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_pxssh.py deleted file mode 100644 index 5f82302ebeb..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_pxssh.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -import os -import tempfile -import unittest - -from pexpect import pxssh - -class SSHTestBase(unittest.TestCase): - def setUp(self): - self.orig_path = os.environ.get('PATH') - fakessh_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'fakessh')) - os.environ['PATH'] = fakessh_dir + \ - ((os.pathsep + self.orig_path) if self.orig_path else '') - - def tearDown(self): - if self.orig_path: - os.environ['PATH'] = self.orig_path - else: - del os.environ['PATH'] - -class PxsshTestCase(SSHTestBase): - def test_fake_ssh(self): - ssh = pxssh.pxssh() - #ssh.logfile_read = sys.stdout # DEBUG - ssh.login('server', 'me', password='s3cret') - ssh.sendline('ping') - ssh.expect('pong', timeout=10) - assert ssh.prompt(timeout=10) - ssh.logout() - - def test_wrong_pw(self): - ssh = pxssh.pxssh() - try: - ssh.login('server', 'me', password='wr0ng') - except pxssh.ExceptionPxssh: - pass - else: - assert False, 'Password should have been refused' - - def test_failed_set_unique_prompt(self): - ssh = pxssh.pxssh() - ssh.set_unique_prompt = lambda: False - try: - ssh.login('server', 'me', password='s3cret', - auto_prompt_reset=True) - except pxssh.ExceptionPxssh: - pass - else: - assert False, 'should have raised exception, pxssh.ExceptionPxssh' - - def test_connection_refused(self): - ssh = pxssh.pxssh() - try: - ssh.login('noserver', 'me', password='s3cret') - except pxssh.ExceptionPxssh: - pass - else: - assert False, 'should have raised exception, pxssh.ExceptionPxssh' - - def test_ssh_tunnel_string(self): - ssh = pxssh.pxssh(debug_command_string=True) - tunnels = { 'local': ['2424:localhost:22'],'remote': ['2525:localhost:22'], - 'dynamic': [8888] } - confirmation_strings = 0 - confirmation_array = ['-R 2525:localhost:22','-L 2424:localhost:22','-D 8888'] - string = ssh.login('server', 'me', password='s3cret', ssh_tunnels=tunnels) - for confirmation in confirmation_array: - if confirmation in string: - confirmation_strings+=1 - - if confirmation_strings!=len(confirmation_array): - assert False, 'String generated from tunneling is incorrect.' - - def test_remote_ssh_tunnel_string(self): - ssh = pxssh.pxssh(debug_command_string=True) - tunnels = { 'local': ['2424:localhost:22'],'remote': ['2525:localhost:22'], - 'dynamic': [8888] } - confirmation_strings = 0 - confirmation_array = ['-R 2525:localhost:22','-L 2424:localhost:22','-D 8888'] - string = ssh.login('server', 'me', password='s3cret', ssh_tunnels=tunnels, spawn_local_ssh=False) - for confirmation in confirmation_array: - if confirmation in string: - confirmation_strings+=1 - - if confirmation_strings!=len(confirmation_array): - assert False, 'String generated from remote tunneling is incorrect.' - - def test_ssh_config_passing_string(self): - ssh = pxssh.pxssh(debug_command_string=True) - (temp_file,config_path) = tempfile.mkstemp() - string = ssh.login('server', 'me', password='s3cret', spawn_local_ssh=False, ssh_config=config_path) - if not '-F '+config_path in string: - assert False, 'String generated from SSH config passing is incorrect.' - - def test_ssh_key_string(self): - ssh = pxssh.pxssh(debug_command_string=True) - confirmation_strings = 0 - confirmation_array = [' -A'] - string = ssh.login('server', 'me', password='s3cret', ssh_key=True) - for confirmation in confirmation_array: - if confirmation in string: - confirmation_strings+=1 - - if confirmation_strings!=len(confirmation_array): - assert False, 'String generated from forcing the SSH agent sock is incorrect.' - - confirmation_strings = 0 - (temp_file,ssh_key) = tempfile.mkstemp() - confirmation_array = [' -i '+ssh_key] - string = ssh.login('server', 'me', password='s3cret', ssh_key=ssh_key) - for confirmation in confirmation_array: - if confirmation in string: - confirmation_strings+=1 - - if confirmation_strings!=len(confirmation_array): - assert False, 'String generated from adding an SSH key is incorrect.' - - -if __name__ == '__main__': - unittest.main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_replwrap.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_replwrap.py deleted file mode 100644 index d0fe8e21753..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_replwrap.py +++ /dev/null @@ -1,114 +0,0 @@ -import platform -import unittest -import re -import os - -import pexpect -from pexpect import replwrap - -skip_pypy = "This test fails on PyPy because of REPL differences" - - -class REPLWrapTestCase(unittest.TestCase): - def setUp(self): - super(REPLWrapTestCase, self).setUp() - self.save_ps1 = os.getenv('PS1', r'\$') - self.save_ps2 = os.getenv('PS2', '>') - os.putenv('PS1', r'\$') - os.putenv('PS2', '>') - - def tearDown(self): - super(REPLWrapTestCase, self).tearDown() - os.putenv('PS1', self.save_ps1) - os.putenv('PS2', self.save_ps2) - - def test_bash(self): - bash = replwrap.bash() - res = bash.run_command("time") - assert 'real' in res, res - - def test_pager_as_cat(self): - " PAGER is set to cat, to prevent timeout in ``man sleep``. " - bash = replwrap.bash() - res = bash.run_command('man sleep', timeout=5) - assert 'SLEEP' in res, res - - def test_bash_env(self): - """env, which displays PS1=..., should not mess up finding the prompt. - """ - bash = replwrap.bash() - res = bash.run_command("env") - self.assertIn('PS1', res) - res = bash.run_command("echo $HOME") - assert res.startswith('/'), res - - def test_long_running_multiline(self): - " ensure the default timeout is used for multi-line commands. " - bash = replwrap.bash() - res = bash.run_command("echo begin\r\nsleep 2\r\necho done") - self.assertEqual(res.strip().splitlines(), ['begin', 'done']) - - def test_long_running_continuation(self): - " also ensure timeout when used within continuation prompts. " - bash = replwrap.bash() - # The two extra '\\' in the following expression force a continuation - # prompt: - # $ echo begin\ - # + ; - # $ sleep 2 - # $ echo done - res = bash.run_command("echo begin\\\n;sleep 2\r\necho done") - self.assertEqual(res.strip().splitlines(), ['begin', 'done']) - - def test_multiline(self): - bash = replwrap.bash() - res = bash.run_command("echo '1 2\n3 4'") - self.assertEqual(res.strip().splitlines(), ['1 2', '3 4']) - - # Should raise ValueError if input is incomplete - try: - bash.run_command("echo '5 6") - except ValueError: - pass - else: - assert False, "Didn't raise ValueError for incomplete input" - - # Check that the REPL was reset (SIGINT) after the incomplete input - res = bash.run_command("echo '1 2\n3 4'") - self.assertEqual(res.strip().splitlines(), ['1 2', '3 4']) - - def test_existing_spawn(self): - child = pexpect.spawn("bash", timeout=5, echo=False, encoding='utf-8') - repl = replwrap.REPLWrapper(child, re.compile('[$#]'), - "PS1='{0}' PS2='{1}' " - "PROMPT_COMMAND=''") - - res = repl.run_command("echo $HOME") - assert res.startswith('/'), res - - def test_python(self): - if platform.python_implementation() == 'PyPy': - raise unittest.SkipTest(skip_pypy) - - p = replwrap.python() - res = p.run_command('4+7') - assert res.strip() == '11' - - res = p.run_command('for a in range(3): print(a)\n') - assert res.strip().splitlines() == ['0', '1', '2'] - - def test_no_change_prompt(self): - if platform.python_implementation() == 'PyPy': - raise unittest.SkipTest(skip_pypy) - - child = pexpect.spawn('python', echo=False, timeout=5, encoding='utf-8') - # prompt_change=None should mean no prompt change - py = replwrap.REPLWrapper(child, u">>> ", prompt_change=None, - continuation_prompt=u"... ") - assert py.prompt == ">>> " - - res = py.run_command("for a in range(3): print(a)\n") - assert res.strip().splitlines() == ['0', '1', '2'] - -if __name__ == '__main__': - unittest.main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_repr.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_repr.py deleted file mode 100644 index ac337160d7e..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_repr.py +++ /dev/null @@ -1,37 +0,0 @@ -""" Test __str__ methods. """ -import pexpect - -from . import PexpectTestCase - - -class TestCaseMisc(PexpectTestCase.PexpectTestCase): - - def test_str_spawnu(self): - """ Exercise spawnu.__str__() """ - # given, - p = pexpect.spawnu('cat') - # exercise, - value = str(p) - # verify - assert isinstance(value, str) - - def test_str_spawn(self): - """ Exercise spawn.__str__() """ - # given, - p = pexpect.spawn('cat') - # exercise, - value = str(p) - # verify - assert isinstance(value, str) - - def test_str_before_spawn(self): - """ Exercise derived spawn.__str__() """ - # given, - child = pexpect.spawn(None, None) - child.read_nonblocking = lambda size, timeout: b'' - try: - child.expect('alpha', timeout=0.1) - except pexpect.TIMEOUT as e: - str(e) # Smoketest - else: - assert False, 'TIMEOUT exception expected. No exception raised.' diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_run.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_run.py deleted file mode 100755 index 1b3c92ff602..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_run.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -import subprocess -import tempfile -import sys -import os -from . import PexpectTestCase - -unicode_type = str if pexpect.PY3 else unicode - - -def timeout_callback(values): - if values["event_count"] > 3: - return 1 - return 0 - - -def function_events_callback(values): - try: - previous_echoed = (values["child_result_list"][-1] - .decode().split("\n")[-2].strip()) - if previous_echoed.endswith("stage-1"): - return "echo stage-2\n" - elif previous_echoed.endswith("stage-2"): - return "echo stage-3\n" - elif previous_echoed.endswith("stage-3"): - return "exit\n" - else: - raise Exception("Unexpected output {0}".format(previous_echoed)) - except IndexError: - return "echo stage-1\n" - - -class RunFuncTestCase(PexpectTestCase.PexpectTestCase): - runfunc = staticmethod(pexpect.run) - cr = b'\r' - empty = b'' - prep_subprocess_out = staticmethod(lambda x: x) - - def setUp(self): - fd, self.rcfile = tempfile.mkstemp() - os.write(fd, b'PS1=GO: \n') - os.close(fd) - super(RunFuncTestCase, self).setUp() - - def tearDown(self): - os.unlink(self.rcfile) - super(RunFuncTestCase, self).tearDown() - - def test_run_exit(self): - (data, exitstatus) = self.runfunc('python exit1.py', withexitstatus=1) - assert exitstatus == 1, "Exit status of 'python exit1.py' should be 1." - - def test_run(self): - the_old_way = subprocess.Popen( - args=['uname', '-m', '-n'], - stdout=subprocess.PIPE - ).communicate()[0].rstrip() - - (the_new_way, exitstatus) = self.runfunc( - 'uname -m -n', withexitstatus=1) - the_new_way = the_new_way.replace(self.cr, self.empty).rstrip() - - self.assertEqual(self.prep_subprocess_out(the_old_way), the_new_way) - self.assertEqual(exitstatus, 0) - - def test_run_callback(self): - # TODO it seems like this test could block forever if run fails... - events = {pexpect.TIMEOUT: timeout_callback} - self.runfunc("cat", timeout=1, events=events) - - def test_run_bad_exitstatus(self): - (the_new_way, exitstatus) = self.runfunc( - 'ls -l /najoeufhdnzkxjd', withexitstatus=1) - assert exitstatus != 0 - - def test_run_event_as_string(self): - events = [ - # second match on 'abc', echo 'def' - ('abc\r\n.*GO:', 'echo "def"\n'), - # final match on 'def': exit - ('def\r\n.*GO:', 'exit\n'), - # first match on 'GO:' prompt, echo 'abc' - ('GO:', 'echo "abc"\n') - ] - - (data, exitstatus) = pexpect.run( - 'bash --rcfile {0}'.format(self.rcfile), - withexitstatus=True, - events=events, - timeout=10) - assert exitstatus == 0 - - def test_run_event_as_function(self): - events = [ - ('GO:', function_events_callback) - ] - - (data, exitstatus) = pexpect.run( - 'bash --rcfile {0}'.format(self.rcfile), - withexitstatus=True, - events=events, - timeout=10) - assert exitstatus == 0 - - def test_run_event_as_method(self): - events = [ - ('GO:', self._method_events_callback) - ] - - (data, exitstatus) = pexpect.run( - 'bash --rcfile {0}'.format(self.rcfile), - withexitstatus=True, - events=events, - timeout=10) - assert exitstatus == 0 - - def test_run_event_typeerror(self): - events = [('GO:', -1)] - with self.assertRaises(TypeError): - pexpect.run('bash --rcfile {0}'.format(self.rcfile), - withexitstatus=True, - events=events, - timeout=10) - - def _method_events_callback(self, values): - try: - previous_echoed = (values["child_result_list"][-1].decode() - .split("\n")[-2].strip()) - if previous_echoed.endswith("foo1"): - return "echo foo2\n" - elif previous_echoed.endswith("foo2"): - return "echo foo3\n" - elif previous_echoed.endswith("foo3"): - return "exit\n" - else: - raise Exception("Unexpected output {0!r}" - .format(previous_echoed)) - except IndexError: - return "echo foo1\n" - - -class RunUnicodeFuncTestCase(RunFuncTestCase): - runfunc = staticmethod(pexpect.runu) - cr = b'\r'.decode('ascii') - empty = b''.decode('ascii') - prep_subprocess_out = staticmethod(lambda x: x.decode('utf-8', 'replace')) - - def test_run_unicode(self): - if pexpect.PY3: - char = chr(254) # þ - pattern = '<in >' - else: - char = unichr(254) # analysis:ignore - pattern = '<in >'.decode('ascii') - - def callback(values): - if values['event_count'] == 0: - return char + '\n' - else: - return True # Stop the child process - - output = pexpect.runu(sys.executable + ' echo_w_prompt.py', - env={'PYTHONIOENCODING': 'utf-8'}, - events={pattern: callback}) - assert isinstance(output, unicode_type), type(output) - assert ('<out>' + char) in output, output - -if __name__ == '__main__': - unittest.main() diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_run_out_of_pty.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_run_out_of_pty.py deleted file mode 100755 index 309014761df..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_run_out_of_pty.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase - -class ExpectTestCase(PexpectTestCase.PexpectTestCase): - # This takes too long to run and isn't all that interesting of a test. - def OFF_test_run_out_of_pty (self): - '''This assumes that the tested platform has < 10000 pty devices. - This test currently does not work under Solaris. - Under Solaris it runs out of file descriptors first and - ld.so starts to barf: - ld.so.1: pt_chmod: fatal: /usr/lib/libc.so.1: Too many open files - ''' - plist=[] - for count in range (0,10000): - try: - plist.append (pexpect.spawn('ls -l')) - except pexpect.ExceptionPexpect: - for c in range (0, count): - plist[c].close() - return - except Exception: - err = sys.exc_info()[1] - self.fail ('Expected ExceptionPexpect. ' + str(err)) - self.fail ('Could not run out of pty devices. This may be OK.') - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase,'test') - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_screen.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_screen.py deleted file mode 100755 index 2429e57a90a..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_screen.py +++ /dev/null @@ -1,287 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import sys - -from pexpect import screen -import unittest -from . import PexpectTestCase - -PY3 = (sys.version_info[0] >= 3) - -fill1_target='XXXXXXXXXX\n' + \ -'XOOOOOOOOX\n' + \ -'XO::::::OX\n' + \ -'XO:oooo:OX\n' + \ -'XO:o..o:OX\n' + \ -'XO:o..o:OX\n' + \ -'XO:oooo:OX\n' + \ -'XO::::::OX\n' + \ -'XOOOOOOOOX\n' + \ -'XXXXXXXXXX' -fill2_target = 'XXXXXXXXXXX\n' + \ -'XOOOOOOOOOX\n' + \ -'XO:::::::OX\n' + \ -'XO:ooooo:OX\n' + \ -'XO:o...o:OX\n' + \ -'XO:o.+.o:OX\n' + \ -'XO:o...o:OX\n' + \ -'XO:ooooo:OX\n' + \ -'XO:::::::OX\n' + \ -'XOOOOOOOOOX\n' + \ -'XXXXXXXXXXX' -put_target = '\\.3.5.7.9/\n' + \ -'.........2\n' + \ -'3.........\n' + \ -'.........4\n' + \ -'5...\\/....\n' + \ -'..../\\...6\n' + \ -'7.........\n' + \ -'.........8\n' + \ -'9.........\n' + \ -'/2.4.6.8.\\' -scroll_target = '\\.3.5.7.9/\n' + \ -'\\.3.5.7.9/\n' + \ -'\\.3.5.7.9/\n' + \ -'\\.3.5.7.9/\n' + \ -'5...\\/....\n' + \ -'..../\\...6\n' + \ -'/2.4.6.8.\\\n' + \ -'/2.4.6.8.\\\n' + \ -'/2.4.6.8.\\\n' + \ -'/2.4.6.8.\\' -insert_target = 'ZXZZZZZZXZ\n' +\ -'.........2\n' +\ -'3.........\n' +\ -'.........4\n' +\ -'Z5...\\/...\n' +\ -'..../Z\\...\n' +\ -'7.........\n' +\ -'.........8\n' +\ -'9.........\n' +\ -'ZZ/2.4.6ZZ' -get_region_target = ['......', '.\\/...', './\\...', '......'] - -unicode_box_unicode_result = u'\u2554\u2557\n\u255A\u255D' -unicode_box_pretty_result = u'''\ -+--+ -|\u2554\u2557| -|\u255A\u255D| -+--+ -''' -unicode_box_ascii_bytes_result = b'??\n??' -unicode_box_cp437_bytes_result = b'\xc9\xbb\n\xc8\xbc' -unicode_box_utf8_bytes_result = b'\xe2\x95\x94\xe2\x95\x97\n\xe2\x95\x9a\xe2\x95\x9d' - -class screenTestCase (PexpectTestCase.PexpectTestCase): - def make_screen_with_put (self): - s = screen.screen(10,10) - s.fill ('.') - for r in range (1,s.rows + 1): - if r % 2: - s.put_abs (r, 1, str(r)) - else: - s.put_abs (r, s.cols, str(r)) - for c in range (1,s.cols + 1): - if c % 2: - s.put_abs (1, c, str(c)) - else: - s.put_abs (s.rows, c, str(c)) - s.put_abs(1,1, '\\') - s.put_abs(1,s.cols, '/') - s.put_abs(s.rows,1,'/') - s.put_abs(s.rows, s.cols, '\\') - s.put_abs(5,5,'\\') - s.put_abs(5,6,'/') - s.put_abs(6,5,'/') - s.put_abs(6,6,'\\') - return s - - def test_fill (self): - s = screen.screen (10,10) - s.fill_region (10,1,1,10,'X') - s.fill_region (2,2,9,9,'O') - s.fill_region (8,8,3,3,':') - s.fill_region (4,7,7,4,'o') - s.fill_region (6,5,5,6,'.') - assert str(s) == fill1_target - - s = screen.screen (11,11) - s.fill_region (1,1,11,11,'X') - s.fill_region (2,2,10,10,'O') - s.fill_region (9,9,3,3,':') - s.fill_region (4,8,8,4,'o') - s.fill_region (7,5,5,7,'.') - s.fill_region (6,6,6,6,'+') - assert str(s) == fill2_target - def test_put (self): - s = self.make_screen_with_put() - assert str(s) == put_target - def test_get_region (self): - s = self.make_screen_with_put() - r = s.get_region (4,4,7,9) - assert r == get_region_target - - def test_cursor_save (self): - s = self.make_screen_with_put() - s.cursor_home (5,5) - c = s.get() - s.cursor_save() - s.cursor_home() - s.cursor_forward() - s.cursor_down() - s.cursor_unsave() - assert s.cur_r == 5 and s.cur_c == 5 - assert c == s.get() - def test_scroll (self): - s = self.make_screen_with_put() - s.scroll_screen_rows (1,4) - s.scroll_down(); s.scroll_down(); s.scroll_down() - s.scroll_down(); s.scroll_down(); s.scroll_down() - s.scroll_screen_rows (7,10) - s.scroll_up(); s.scroll_up(); s.scroll_up() - s.scroll_up(); s.scroll_up(); s.scroll_up() - assert str(s) == scroll_target - def test_insert (self): - s = self.make_screen_with_put() - s.insert_abs (10,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (10,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (1,1,'Z') - s.insert_abs (5,1,'Z') - s.insert_abs (6,6,'Z') - s.cursor_home (1,1) # Also test relative insert. - s.insert ('Z') - s.insert ('Z') - s.insert ('Z') - s.insert ('Z') - s.insert_abs (1,8,'X') - s.insert_abs (1,2,'X') - s.insert_abs (10,9,'Z') - s.insert_abs (10,9,'Z') - assert str(s) == insert_target - - def make_screen_with_box_unicode(self, *args, **kwargs): - '''Creates a screen containing a box drawn using double-line - line drawing characters. The characters are fed in as - unicode. ''' - s = screen.screen (2,2,*args,**kwargs) - s.put_abs (1,1,u'\u2554') - s.put_abs (1,2,u'\u2557') - s.put_abs (2,1,u'\u255A') - s.put_abs (2,2,u'\u255D') - return s - - def make_screen_with_box_cp437(self, *args, **kwargs): - '''Creates a screen containing a box drawn using double-line - line drawing characters. The characters are fed in as - CP437. ''' - s = screen.screen (2,2,*args,**kwargs) - s.put_abs (1,1,b'\xc9') - s.put_abs (1,2,b'\xbb') - s.put_abs (2,1,b'\xc8') - s.put_abs (2,2,b'\xbc') - return s - - def make_screen_with_box_utf8(self, *args, **kwargs): - '''Creates a screen containing a box drawn using double-line - line drawing characters. The characters are fed in as - UTF-8. ''' - s = screen.screen (2,2,*args,**kwargs) - s.put_abs (1,1,b'\xe2\x95\x94') - s.put_abs (1,2,b'\xe2\x95\x97') - s.put_abs (2,1,b'\xe2\x95\x9a') - s.put_abs (2,2,b'\xe2\x95\x9d') - return s - - def test_unicode_ascii (self): - # With the default encoding set to ASCII, we should still be - # able to feed in unicode strings and get them back out: - s = self.make_screen_with_box_unicode('ascii') - if PY3: - assert str(s) == unicode_box_unicode_result - else: - assert unicode(s) == unicode_box_unicode_result - # And we should still get something for Python 2 str(), though - # it might not be very useful - str(s) - - assert s.pretty() == unicode_box_pretty_result - - def test_decoding_errors(self): - # With strict error handling, it should reject bytes it can't decode - with self.assertRaises(UnicodeDecodeError): - self.make_screen_with_box_cp437('ascii', 'strict') - - # replace should turn them into unicode replacement characters, U+FFFD - s = self.make_screen_with_box_cp437('ascii', 'replace') - expected = u'\ufffd\ufffd\n\ufffd\ufffd' - if PY3: - assert str(s) == expected - else: - assert unicode(s) == expected - - def test_unicode_cp437 (self): - # Verify decoding from and re-encoding to CP437. - s = self.make_screen_with_box_cp437('cp437','strict') - if PY3: - assert str(s) == unicode_box_unicode_result - else: - assert unicode(s) == unicode_box_unicode_result - assert str(s) == unicode_box_cp437_bytes_result - assert s.pretty() == unicode_box_pretty_result - - def test_unicode_utf8 (self): - # Verify decoding from and re-encoding to UTF-8. - s = self.make_screen_with_box_utf8('utf-8','strict') - if PY3: - assert str(s) == unicode_box_unicode_result - else: - assert unicode(s) == unicode_box_unicode_result - assert str(s) == unicode_box_utf8_bytes_result - assert s.pretty() == unicode_box_pretty_result - - def test_no_bytes(self): - s = screen.screen(2, 2, encoding=None) - s.put_abs(1, 1, u'A') - s.put_abs(2, 2, u'D') - - with self.assertRaises(TypeError): - s.put_abs(1, 2, b'B') - - if PY3: - assert str(s) == u'A \n D' - else: - assert unicode(s) == u'A \n D' - # This will still work if it's limited to ascii - assert str(s) == b'A \n D' - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(screenTestCase,'test') - - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_socket.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_socket.py deleted file mode 100644 index 21648f4a0f6..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_socket.py +++ /dev/null @@ -1,270 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -from pexpect import fdpexpect -import unittest -from . import PexpectTestCase -import multiprocessing -import os -import signal -import socket -import time -import errno - - -class SocketServerError(Exception): - pass - - -class ExpectTestCase(PexpectTestCase.PexpectTestCase): - - def setUp(self): - print(self.id()) - PexpectTestCase.PexpectTestCase.setUp(self) - self.host = '127.0.0.1' - self.port = 49152 + 10000 - self.motd = b"""\ ------------------------------------------------------------------------------- -* Welcome to the SOCKET UNIT TEST code! * ------------------------------------------------------------------------------- -* * -* This unit test code is our best effort at testing the ability of the * -* pexpect library to handle sockets. We need some text to test buffer size * -* handling. * -* * -* A page is 1024 bytes or 1K. 80 x 24 = 1920. So a standard terminal window * -* contains more than one page. We actually want more than a page for our * -* tests. * -* * -* This is the twelfth line, and we need 24. So we need a few more paragraphs.* -* We can keep them short and just put lines between them. * -* * -* The 80 x 24 terminal size comes from the ancient past when computers were * -* only able to display text in cuneiform writing. * -* * -* The cunieform writing system used the edge of a reed to make marks on clay * -* tablets. * -* * -* It was the forerunner of the style of handwriting used by doctors to write * -* prescriptions. Thus the name: pre (before) script (writing) ion (charged * -* particle). * ------------------------------------------------------------------------------- -""".replace(b'\n', b'\n\r') + b"\r\n" - self.prompt1 = b'Press Return to continue:' - self.prompt2 = b'Rate this unit test>' - self.prompt3 = b'Press X to exit:' - self.enter = b'\r\n' - self.exit = b'X\r\n' - self.server_up = multiprocessing.Event() - self.server_process = multiprocessing.Process(target=self.socket_server, args=(self.server_up,)) - self.server_process.daemon = True - self.server_process.start() - counter = 0 - while not self.server_up.is_set(): - time.sleep(0.250) - counter += 1 - if counter > (10 / 0.250): - raise SocketServerError("Could not start socket server") - - def tearDown(self): - os.kill(self.server_process.pid, signal.SIGINT) - self.server_process.join(timeout=5.0) - PexpectTestCase.PexpectTestCase.tearDown(self) - - def socket_server(self, server_up): - sock = None - try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - sock.bind((self.host, self.port)) - sock.listen(5) - server_up.set() - while True: - (conn, addr) = sock.accept() - conn.send(self.motd) - conn.send(self.prompt1) - result = conn.recv(1024) - if result != self.enter: - break - conn.send(self.prompt2) - result = conn.recv(1024) - if result != self.enter: - break - conn.send(self.prompt3) - result = conn.recv(1024) - if result.startswith(self.exit[0]): - conn.shutdown(socket.SHUT_RDWR) - conn.close() - except KeyboardInterrupt: - pass - if sock is not None: - try: - sock.shutdown(socket.SHUT_RDWR) - sock.close() - except socket.error: - pass - exit(0) - - def socket_fn(self, timed_out, all_read): - result = 0 - try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock, timeout=10) - # Get all data from server - session.read_nonblocking(size=4096) - all_read.set() - # This read should timeout - session.read_nonblocking(size=4096) - except pexpect.TIMEOUT: - timed_out.set() - result = errno.ETIMEDOUT - exit(result) - - def test_socket(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10) - session.expect(self.prompt1) - self.assertEqual(session.before, self.motd) - session.send(self.enter) - session.expect(self.prompt2) - session.send(self.enter) - session.expect(self.prompt3) - session.send(self.exit) - session.expect(pexpect.EOF) - self.assertEqual(session.before, b'') - - def test_socket_with_write(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10) - session.expect(self.prompt1) - self.assertEqual(session.before, self.motd) - session.write(self.enter) - session.expect(self.prompt2) - session.write(self.enter) - session.expect(self.prompt3) - session.write(self.exit) - session.expect(pexpect.EOF) - self.assertEqual(session.before, b'') - - def test_not_int(self): - with self.assertRaises(pexpect.ExceptionPexpect): - session = fdpexpect.fdspawn('bogus', timeout=10) - - def test_not_file_descriptor(self): - with self.assertRaises(pexpect.ExceptionPexpect): - session = fdpexpect.fdspawn(-1, timeout=10) - - def test_timeout(self): - with self.assertRaises(pexpect.TIMEOUT): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock, timeout=10) - session.expect(b'Bogus response') - - def test_interrupt(self): - timed_out = multiprocessing.Event() - all_read = multiprocessing.Event() - test_proc = multiprocessing.Process(target=self.socket_fn, args=(timed_out, all_read)) - test_proc.daemon = True - test_proc.start() - while not all_read.is_set(): - time.sleep(1.0) - os.kill(test_proc.pid, signal.SIGWINCH) - while not timed_out.is_set(): - time.sleep(1.0) - test_proc.join(timeout=5.0) - self.assertEqual(test_proc.exitcode, errno.ETIMEDOUT) - - def test_multiple_interrupts(self): - timed_out = multiprocessing.Event() - all_read = multiprocessing.Event() - test_proc = multiprocessing.Process(target=self.socket_fn, args=(timed_out, all_read)) - test_proc.daemon = True - test_proc.start() - while not all_read.is_set(): - time.sleep(1.0) - while not timed_out.is_set(): - os.kill(test_proc.pid, signal.SIGWINCH) - time.sleep(1.0) - test_proc.join(timeout=5.0) - self.assertEqual(test_proc.exitcode, errno.ETIMEDOUT) - - def test_maxread(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10) - session.maxread = 1100 - session.expect(self.prompt1) - self.assertEqual(session.before, self.motd) - session.send(self.enter) - session.expect(self.prompt2) - session.send(self.enter) - session.expect(self.prompt3) - session.send(self.exit) - session.expect(pexpect.EOF) - self.assertEqual(session.before, b'') - - def test_fd_isalive(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10) - assert session.isalive() - sock.close() - assert not session.isalive(), "Should not be alive after close()" - - def test_fd_isalive_poll(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10, use_poll=True) - assert session.isalive() - sock.close() - assert not session.isalive(), "Should not be alive after close()" - - def test_fd_isatty(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10) - assert not session.isatty() - session.close() - - def test_fd_isatty_poll(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock.fileno(), timeout=10, use_poll=True) - assert not session.isatty() - session.close() - - def test_fileobj(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((self.host, self.port)) - session = fdpexpect.fdspawn(sock, timeout=10) # Should get the fileno from the socket - session.expect(self.prompt1) - session.close() - assert not session.isalive() - session.close() # Smoketest - should be able to call this again - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(ExpectTestCase, 'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_timeout_pattern.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_timeout_pattern.py deleted file mode 100755 index 5f610ef03ed..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_timeout_pattern.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -from __future__ import with_statement # bring 'with' stmt to py25 -import pexpect -import unittest -from . import PexpectTestCase -import sys - -class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase): - def test_matches_exp_timeout (self): - '''This tests that we can raise and catch TIMEOUT. - ''' - try: - raise pexpect.TIMEOUT("TIMEOUT match test") - except pexpect.TIMEOUT: - pass - #print "Correctly caught TIMEOUT when raising TIMEOUT." - else: - self.fail('TIMEOUT not caught by an except TIMEOUT clause.') - - def test_pattern_printout (self): - '''Verify that a TIMEOUT returns the proper patterns it is trying to match against. - Make sure it is returning the pattern from the correct call.''' - try: - p = pexpect.spawn('cat') - p.sendline('Hello') - p.expect('Hello') - p.expect('Goodbye',timeout=5) - except pexpect.TIMEOUT: - assert p.match_index == None - else: - self.fail("Did not generate a TIMEOUT exception.") - - def test_exp_timeout_notThrown (self): - '''Verify that a TIMEOUT is not thrown when we match what we expect.''' - try: - p = pexpect.spawn('cat') - p.sendline('Hello') - p.expect('Hello') - except pexpect.TIMEOUT: - self.fail("TIMEOUT caught when it shouldn't be raised because we match the proper pattern.") - - def test_stacktraceMunging (self): - '''Verify that the stack trace returned with a TIMEOUT instance does not contain references to pexpect.''' - try: - p = pexpect.spawn('cat') - p.sendline('Hello') - p.expect('Goodbye',timeout=5) - except pexpect.TIMEOUT: - err = sys.exc_info()[1] - if err.get_trace().count("pexpect/__init__.py") != 0: - self.fail("The TIMEOUT get_trace() referenced pexpect.py. " - "It should only reference the caller.\n" + err.get_trace()) - - def test_correctStackTrace (self): - '''Verify that the stack trace returned with a TIMEOUT instance correctly handles function calls.''' - def nestedFunction (spawnInstance): - spawnInstance.expect("junk", timeout=3) - - try: - p = pexpect.spawn('cat') - p.sendline('Hello') - nestedFunction(p) - except pexpect.TIMEOUT: - err = sys.exc_info()[1] - if err.get_trace().count("nestedFunction") == 0: - self.fail("The TIMEOUT get_trace() did not show the call " - "to the nestedFunction function.\n" + str(err) + "\n" - + err.get_trace()) - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(Exp_TimeoutTestCase,'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_unicode.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_unicode.py deleted file mode 100644 index 9b5b988a497..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_unicode.py +++ /dev/null @@ -1,187 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import platform -import tempfile -import sys -import time - -import pexpect -import unittest -from . import PexpectTestCase - -# the program cat(1) may display ^D\x08\x08 when \x04 (EOF, Ctrl-D) is sent -_CAT_EOF = '^D\x08\x08' - -class UnicodeTests(PexpectTestCase.PexpectTestCase): - def test_expect_basic (self): - p = pexpect.spawnu('cat') - p.sendline('Hello') - p.sendline('there') - p.sendline('Mr. þython') # þ is more like th than p, but never mind - p.expect('Hello') - p.expect('there') - p.expect('Mr. þython') - p.sendeof () - p.expect (pexpect.EOF) - - def test_expect_exact_basic (self): - p = pexpect.spawnu('cat') - p.sendline('Hello') - p.sendline('there') - p.sendline('Mr. þython') - p.expect_exact('Hello') - p.expect_exact('there') - p.expect_exact('Mr. þython') - p.sendeof() - p.expect_exact (pexpect.EOF) - - def test_expect_setecho_toggle(self): - '''This tests that echo may be toggled off. - ''' - p = pexpect.spawnu('cat', timeout=5) - try: - self._expect_echo_toggle_off(p) - except IOError: - if sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - raise - self._expect_echo_toggle_on(p) - - def test_expect_echo_exact (self): - '''Like test_expect_echo(), but using expect_exact(). - ''' - p = pexpect.spawnu('cat', timeout=5) - p.expect = p.expect_exact - self._expect_echo(p) - - def test_expect_setecho_toggle_exact(self): - p = pexpect.spawnu('cat', timeout=5) - p.expect = p.expect_exact - try: - self._expect_echo_toggle_off(p) - except IOError: - if sys.platform.lower().startswith('sunos'): - if hasattr(unittest, 'SkipTest'): - raise unittest.SkipTest("Not supported on this platform.") - return 'skip' - raise - self._expect_echo_toggle_on(p) - - def _expect_echo (self, p): - p.sendline('1234') # Should see this twice (once from tty echo and again from cat). - index = p.expect (['1234', 'abcdé', 'wxyz', pexpect.EOF, pexpect.TIMEOUT]) - assert index == 0, (index, p.before) - index = p.expect (['1234', 'abcdé', 'wxyz', pexpect.EOF]) - assert index == 0, index - - def _expect_echo_toggle_off(self, p): - p.setecho(0) # Turn off tty echo - p.waitnoecho() - p.sendline('abcdé') # Now, should only see this once. - p.sendline('wxyz') # Should also be only once. - index = p.expect ([pexpect.EOF,pexpect.TIMEOUT, 'abcdé', 'wxyz', '1234']) - assert index == 2, index - index = p.expect ([pexpect.EOF, 'abcdé', 'wxyz', '7890']) - assert index == 2, index - - def _expect_echo_toggle_on(self, p): - p.setecho(1) # Turn on tty echo - time.sleep(0.2) # there is no waitecho() ! - p.sendline('7890') # Should see this twice. - index = p.expect ([pexpect.EOF, 'abcdé', 'wxyz', '7890']) - assert index == 3, index - index = p.expect ([pexpect.EOF, 'abcdé', 'wxyz', '7890']) - assert index == 3, index - p.sendeof() - - def test_log_unicode(self): - msg = "abcΩ÷" - filename_send = tempfile.mktemp() - filename_read = tempfile.mktemp() - p = pexpect.spawnu('cat') - if platform.python_version_tuple() < ('3', '0', '0'): - import codecs - def open(fname, mode, **kwargs): - if 'newline' in kwargs: - del kwargs['newline'] - return codecs.open(fname, mode, **kwargs) - else: - import io - open = io.open - - p.logfile_send = open(filename_send, 'w', encoding='utf-8') - p.logfile_read = open(filename_read, 'w', encoding='utf-8') - p.sendline(msg) - p.sendeof() - p.expect(pexpect.EOF) - p.close() - p.logfile_send.close() - p.logfile_read.close() - - # ensure the 'send' log is correct, - with open(filename_send, 'r', encoding='utf-8') as f: - self.assertEqual(f.read(), msg + '\n\x04') - - # ensure the 'read' log is correct, - with open(filename_read, 'r', encoding='utf-8', newline='') as f: - output = f.read().replace(_CAT_EOF, '') - self.assertEqual(output, (msg + '\r\n')*2 ) - - - def test_spawn_expect_ascii_unicode(self): - # A bytes-based spawn should be able to handle ASCII-only unicode, for - # backwards compatibility. - p = pexpect.spawn('cat') - p.sendline('Camelot') - p.expect('Camelot') - - p.sendline('Aargh') - p.sendline('Aårgh') - p.expect_exact('Aargh') - - p.sendeof() - p.expect(pexpect.EOF) - - def test_spawn_send_unicode(self): - # A bytes-based spawn should be able to send arbitrary unicode - p = pexpect.spawn('cat') - p.sendline('3½') - p.sendeof() - p.expect(pexpect.EOF) - - def test_spawn_utf8_incomplete(self): - # This test case ensures correct incremental decoding, which - # otherwise fails when the stream inspected by os.read() - # does not align exactly at a utf-8 multibyte boundary: - # UnicodeDecodeError: 'utf8' codec can't decode byte 0xe2 in - # position 0: unexpected end of data - p = pexpect.spawnu('cat', maxread=1) - p.sendline('▁▂▃▄▅▆▇█') - p.sendeof() - p.expect('▁▂▃▄▅▆▇█') - - def test_readline_bin_echo(self): - # Test using readline() with spawnu objects. pexpect 3.2 had threw - # a TypeError when concatenating a bytestring to a unicode type. - - # given, - child = pexpect.spawnu('echo', ['input', ]) - - # exercise, - assert child.readline() == 'input' + child.crlf - - def test_unicode_argv(self): - """ Ensure a program can be executed with unicode arguments. """ - p = pexpect.spawn(u'echo ǝpoɔıun', timeout=5, encoding='utf8') - p.expect(u'ǝpoɔıun') - p.expect(pexpect.EOF) - assert not p.isalive() - assert p.exitstatus == 0 - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(UnicodeTests, 'test') diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_which.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_which.py deleted file mode 100644 index 15a8944153d..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_which.py +++ /dev/null @@ -1,291 +0,0 @@ -# -*- coding: utf-8 -*- -import subprocess -import tempfile -import shutil -import errno -import os - -import pexpect -from . import PexpectTestCase - -import pytest - - -class TestCaseWhich(PexpectTestCase.PexpectTestCase): - " Tests for pexpect.which(). " - - def test_which_finds_ls(self): - " which() can find ls(1). " - exercise = pexpect.which("ls") - assert exercise is not None - assert exercise.startswith('/') - - def test_path_from_env(self): - " executable found from optional env argument " - bin_name = 'pexpect-test-path-from-env' - tempdir = tempfile.mkdtemp() - try: - bin_path = os.path.join(tempdir, bin_name) - with open(bin_path, 'w') as f: - f.write('# test file not to be run') - try: - os.chmod(bin_path, 0o700) - found_path = pexpect.which(bin_name, env={'PATH': tempdir}) - finally: - os.remove(bin_path) - self.assertEqual(bin_path, found_path) - finally: - os.rmdir(tempdir) - - def test_os_defpath_which(self): - " which() finds an executable in $PATH and returns its abspath. " - - bin_dir = tempfile.mkdtemp() - temp_obj = tempfile.NamedTemporaryFile( - suffix=u'.sh', prefix=u'ǝpoɔıun-', - dir=bin_dir, delete=False) - bin_path = temp_obj.name - fname = os.path.basename(temp_obj.name) - save_path = os.environ['PATH'] - save_defpath = os.defpath - - try: - # setup - os.environ['PATH'] = '' - os.defpath = bin_dir - with open(bin_path, 'w') as fp: - pass - - # given non-executable, - os.chmod(bin_path, 0o400) - - # exercise absolute and relative, - assert pexpect.which(bin_path) is None - assert pexpect.which(fname) is None - - # given executable, - os.chmod(bin_path, 0o700) - - # exercise absolute and relative, - assert pexpect.which(bin_path) == bin_path - assert pexpect.which(fname) == bin_path - - finally: - # restore, - os.environ['PATH'] = save_path - os.defpath = save_defpath - - # destroy scratch files and folders, - if os.path.exists(bin_path): - os.unlink(bin_path) - if os.path.exists(bin_dir): - os.rmdir(bin_dir) - - def test_path_search_which(self): - " which() finds an executable in $PATH and returns its abspath. " - fname = 'gcc' - bin_dir = tempfile.mkdtemp() - bin_path = os.path.join(bin_dir, fname) - save_path = os.environ['PATH'] - try: - # setup - os.environ['PATH'] = bin_dir - with open(bin_path, 'w') as fp: - pass - - # given non-executable, - os.chmod(bin_path, 0o400) - - # exercise absolute and relative, - assert pexpect.which(bin_path) is None - assert pexpect.which(fname) is None - - # given executable, - os.chmod(bin_path, 0o700) - - # exercise absolute and relative, - assert pexpect.which(bin_path) == bin_path - assert pexpect.which(fname) == bin_path - - finally: - # restore, - os.environ['PATH'] = save_path - - # destroy scratch files and folders, - if os.path.exists(bin_path): - os.unlink(bin_path) - if os.path.exists(bin_dir): - os.rmdir(bin_dir) - - def test_which_follows_symlink(self): - " which() follows symlinks and returns its path. " - fname = 'original' - symname = 'extra-crispy' - bin_dir = tempfile.mkdtemp() - bin_path = os.path.join(bin_dir, fname) - sym_path = os.path.join(bin_dir, symname) - save_path = os.environ['PATH'] - try: - # setup - os.environ['PATH'] = bin_dir - with open(bin_path, 'w') as fp: - pass - os.chmod(bin_path, 0o400) - os.symlink(bin_path, sym_path) - - # should not be found because symlink points to non-executable - assert pexpect.which(symname) is None - - # but now it should -- because it is executable - os.chmod(bin_path, 0o700) - assert pexpect.which(symname) == sym_path - - finally: - # restore, - os.environ['PATH'] = save_path - - # destroy scratch files, symlinks, and folders, - if os.path.exists(sym_path): - os.unlink(sym_path) - if os.path.exists(bin_path): - os.unlink(bin_path) - if os.path.exists(bin_dir): - os.rmdir(bin_dir) - - def test_which_should_not_match_folders(self): - " Which does not match folders, even though they are executable. " - # make up a path and insert a folder that is 'executable', a naive - # implementation might match (previously pexpect versions 3.2 and - # sh versions 1.0.8, reported by @lcm337.) - fname = 'g++' - bin_dir = tempfile.mkdtemp() - bin_dir2 = os.path.join(bin_dir, fname) - save_path = os.environ['PATH'] - try: - os.environ['PATH'] = bin_dir - os.mkdir(bin_dir2, 0o755) - # should not be found because it is not executable *file*, - # but rather, has the executable bit set, as a good folder - # should -- it should not be returned because it fails isdir() - exercise = pexpect.which(fname) - assert exercise is None - - finally: - # restore, - os.environ['PATH'] = save_path - # destroy scratch folders, - for _dir in (bin_dir2, bin_dir,): - if os.path.exists(_dir): - os.rmdir(_dir) - - def test_which_should_match_other_group_user(self): - " which() returns executables by other, group, and user ownership. " - # create an executable and test that it is found using which() for - # each of the 'other', 'group', and 'user' permission bits. - fname = 'g77' - bin_dir = tempfile.mkdtemp() - bin_path = os.path.join(bin_dir, fname) - save_path = os.environ['PATH'] - try: - # setup - os.environ['PATH'] = bin_dir - - # an interpreted script requires the ability to read, - # whereas a binary program requires only to be executable. - # - # to gain access to a binary program, we make a copy of - # the existing system program echo(1). - bin_echo = None - for pth in ('/bin/echo', '/usr/bin/echo'): - if os.path.exists(pth): - bin_echo = pth - break - bin_which = None - for pth in ('/bin/which', '/usr/bin/which'): - if os.path.exists(pth): - bin_which = pth - break - if not bin_echo or not bin_which: - pytest.skip('needs `echo` and `which` binaries') - shutil.copy(bin_echo, bin_path) - isroot = os.getuid() == 0 - for should_match, mode in ( - # note that although the file may have matching 'group' or - # 'other' executable permissions, it is *not* executable - # because the current uid is the owner of the file -- which - # takes precedence - (False, 0o000), # ----------, no - (isroot, 0o001), # ---------x, no - (isroot, 0o010), # ------x---, no - (True, 0o100), # ---x------, yes - (False, 0o002), # --------w-, no - (False, 0o020), # -----w----, no - (False, 0o200), # --w-------, no - (isroot, 0o003), # --------wx, no - (isroot, 0o030), # -----wx---, no - (True, 0o300), # --wx------, yes - (False, 0o004), # -------r--, no - (False, 0o040), # ----r-----, no - (False, 0o400), # -r--------, no - (isroot, 0o005), # -------r-x, no - (isroot, 0o050), # ----r-x---, no - (True, 0o500), # -r-x------, yes - (False, 0o006), # -------rw-, no - (False, 0o060), # ----rw----, no - (False, 0o600), # -rw-------, no - (isroot, 0o007), # -------rwx, no - (isroot, 0o070), # ----rwx---, no - (True, 0o700), # -rwx------, yes - (isroot, 0o4001), # ---S-----x, no - (isroot, 0o4010), # ---S--x---, no - (True, 0o4100), # ---s------, yes - (isroot, 0o4003), # ---S----wx, no - (isroot, 0o4030), # ---S-wx---, no - (True, 0o4300), # --ws------, yes - (isroot, 0o2001), # ------S--x, no - (isroot, 0o2010), # ------s---, no - (True, 0o2100), # ---x--S---, yes - - ): - mode_str = '{0:0>4o}'.format(mode) - - # given file mode, - os.chmod(bin_path, mode) - - # exercise whether we may execute - can_execute = True - try: - subprocess.Popen(fname).wait() == 0 - except OSError as err: - if err.errno != errno.EACCES: - raise - # permission denied - can_execute = False - - assert should_match == can_execute, ( - should_match, can_execute, mode_str) - - # exercise whether which(1) would match - proc = subprocess.Popen((bin_which, fname), - env={'PATH': bin_dir}, - stdout=subprocess.PIPE) - bin_which_match = bool(not proc.wait()) - assert should_match == bin_which_match, ( - should_match, bin_which_match, mode_str) - - # finally, exercise pexpect's which(1) matches - # the same. - pexpect_match = bool(pexpect.which(fname)) - - assert should_match == pexpect_match == bin_which_match, ( - should_match, pexpect_match, bin_which_match, mode_str) - - finally: - # restore, - os.environ['PATH'] = save_path - - # destroy scratch files and folders, - if os.path.exists(bin_path): - os.unlink(bin_path) - if os.path.exists(bin_dir): - os.rmdir(bin_dir) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/test_winsize.py b/lldb/third_party/Python/module/pexpect-4.6/tests/test_winsize.py deleted file mode 100755 index be16773b756..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/test_winsize.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' -import pexpect -import unittest -from . import PexpectTestCase -import time - -class TestCaseWinsize(PexpectTestCase.PexpectTestCase): - - def test_initial_winsize(self): - """ Assert initial window dimension size (24, 80). """ - p = pexpect.spawn('{self.PYTHONBIN} sigwinch_report.py' - .format(self=self), timeout=3) - # default size by PtyProcess class is 24 rows by 80 columns. - p.expect_exact('Initial Size: (24, 80)') - p.close() - - def test_initial_winsize_by_dimension(self): - """ Assert user-parameter window dimension size is initial. """ - p = pexpect.spawn('{self.PYTHONBIN} sigwinch_report.py' - .format(self=self), timeout=3, - dimensions=(40, 100)) - p.expect_exact('Initial Size: (40, 100)') - p.close() - - def test_setwinsize(self): - """ Ensure method .setwinsize() sends signal caught by child. """ - p = pexpect.spawn('{self.PYTHONBIN} sigwinch_report.py' - .format(self=self), timeout=3) - # Note that we must await the installation of the child process' - # signal handler, - p.expect_exact('READY') - p.setwinsize(19, 84) - p.expect_exact('SIGWINCH: (19, 84)') - p.close() - -if __name__ == '__main__': - unittest.main() - -suite = unittest.makeSuite(TestCaseWinsize,'test') - - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/tetris.data b/lldb/third_party/Python/module/pexpect-4.6/tests/tetris.data deleted file mode 100644 index 06b6ce6ed2f..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/tetris.data +++ /dev/null @@ -1,3 +0,0 @@ -[2J -[24;1H J->LEFT K->ROTATE L->RIGHT SPACE->DROP P->PAUSE Q->QUIT -[1;28HXX[1;36HXXXXXXXX[1;50HXX[2;28HXX[2;50HXX[3;28HXX[3;50HXX[4;28HXX[4;50HXX[5;28HXX[5;50HXX[6;28HXX[6;50HXX[7;28HXX[7;50HXX[8;28HXX[8;50HXX[9;28HXX[9;50HXX[10;28HXX[10;50HXX[11;28HXX[11;50HXX[12;28HXX[12;50HXX[13;28HXX[13;50HXX[14;28HXX[14;50HXX[15;28HXX[15;50HXX[16;28HXX[16;50HXX[17;28HXX[17;50HXX[18;28HXX[18;50HXX[19;28HXX[19;50HXX[20;28HXX[20;50HXX[21;28HXXXXXXXXXXXXXXXXXXXXXXXX[1;36H [2;36HXXXXXXXX[21;50HXX[2;36H [3;36HXXXXXXXX[21;50HXX[3;36H [4;36HXXXXXXXX[21;50HXX[4;36H [5;36HXXXXXXXX[21;50HXX[5;34HXX[5;42H [21;50HXX[5;34H [6;34HXXXXXXXX[21;50HXX[6;32HXX[6;40H [21;50HXX[6;30HXX[6;38H [21;50HXX[6;30H [7;30HXXXXXXXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[7;30H [8;30HXXXXXXXX[21;50HXX[8;30H [20;30HXXXXXXXX[21;50HXX[1;36HXXXXXX[2;36HXX[21;50HXX[1;36H [2;38HXXXX[3;36HXX[21;50HXX[2;36H [2;42HXX[3;36H XX[21;50HXX[2;38H [3;40HXXXX[4;38HXX[21;50HXX[3;38H [3;44HXX[4;38H XX[21;50HXX[3;40H [3;46HXX[4;40H XX[21;50HXX[3;42H [3;48HXX[4;42H XX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[3;44H [4;46HXXXX[5;44HXX[21;50HXX[4;44H [5;46HXXXX[6;44HXX[21;50HXX[5;44H [6;44H [19;44HXXXXXX[20;44HXX[21;50HXX[1;36HXXXXXX[2;36HXX[21;50HXX[1;36H [2;38HXXXX[3;36HXX[21;50HXX[2;36H [2;42HXX[3;36H XX[21;50HXX[2;38H [2;44HXX[3;38H XX[21;50HXX[2;40H [3;42HXXXX[4;40HXX[21;50HXX[2;42HXX[3;40H [3;44H [4;40H XXXX[21;50HXX[2;42H XX[3;40HXX[3;44HXX[4;42H [21;50HXX[2;44H [3;40H [4;40HXXXXXX[21;50HXX[3;44H [4;40H [17;44HXX[18;40HXXXXXX[21;50HXX[1;36HXXXX[21;50HXX[1;36H [1;40HXX[2;36HXXXX[21;50HXX[1;36HXX[1;40H [2;34HXX[2;38H [21;50HXX[1;36H [2;34H [2;38HXX[3;34HXXXX[21;50HXX[2;34HXX[2;38H [3;32HXX[3;36H [21;50HXX[2;32HXX[2;36H [3;30HXX[3;34H [21;50HXX[21;50HXX[2;32H [3;30H [3;34HXX[4;30HXXXX[21;50HXX[21;50HXX[3;32H [4;30H [18;32HXXXX[19;30HXXXX[21;50HXX[1;36HXXXXXX[2;36HXX[21;50HXX[1;36H [1;42HXX[2;36H XX[21;50HXX[1;38H [2;40HXXXX[3;38HXX[21;50HXX[2;38H [2;44HXX[3;38H XX[21;50HXX[2;40H [2;46HXX[3;40H XX[21;50HXX[2;42H [2;48HXX[3;42H XX[21;50HXX[2;44H [3;46HXXXX[4;44HXX[21;50HXX[21;50HXX[21;50HXX[3;44H [4;44H [15;44HXXXXXX[16;44HXX[21;50HXX[1;36HXXXXXXXX[21;50HXX[1;34HXX[1;42H [21;50HXX[1;34H [2;34HXXXXXXXX[21;50HXX[2;32HXX[2;40H [21;50HXX[2;30HXX[2;38H [21;50HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[2;30H [3;30HXXXXXXXX[21;50HXX[3;30H [17;30HXXXXXXXX[21;50HXX[1;38HXXXX[21;50HXX[1;38H [16;36HXXXX[17;38HXXXX[21;50HXX[21;50HXX[1;36HXXXX[21;50HXX[1;36H [1;40HXX[21;50HXX[2;38HXXXX[21;50HXX[1;38H [1;42HXX[2;38H [2;42HXX[21;50HXX[1;40H [1;44HXX[2;40H [2;44HXX[21;50HXX[1;42H [1;46HXX[2;42H [2;46HXX[21;50HXX[1;44H [3;44HXXXX[21;50HXX[2;44H [3;44H [13;44HXXXX[14;44HXXXX[21;50HXX[1;36HXXXXXX[2;40HXX[21;50HXX[1;34HXX[1;40H [2;38HXX [21;50HXX[1;34H [2;34HXXXX[3;38HXX[21;50HXX[2;32HXX[2;38H [3;36HXX [21;50HXX[2;30HXX[2;36H [3;34HXX [21;50HXX[21;50HXX[21;50HXX[21;50HXX[2;30H [3;34H [15;30HXXXXXX[16;34HXX[21;50HXX[1;36HXXXXXXXX[21;50HXX[1;36H [1;44HXX[21;50HXX[1;38H [2;38HXXXXXXXX[21;50HXX[1;40HXX[2;38H [2;42H [3;40HXX[4;40HXX[21;50HXX[1;40H [5;40HXX[21;50HXX[2;40H [3;38HXX[3;42HXXXX[4;40H [5;40H [21;50HXX[2;40HXX[3;38H [3;42H [4;40HXX[5;40HXX[21;50HXX[2;40H [6;40HXX[21;50HXX[3;40H [4;40H [5;40H [6;40H [13;40HXX[14;40HXX[15;40HXX[16;40HXX[21;50HXX[1;36HXXXXXX[2;38HXX[21;50HXX[1;34HXX[1;40H [2;36HXX [21;50HXX[1;32HXX[1;38H [2;34HXX [21;50HXX[1;32H [21;50HXX[1;36H [2;36HXX[3;34HXX[21;50HXX[1;32HXX [2;32HXX[2;36H [3;32HXX [21;50HXX[2;30HXX[3;32H [21;50HXX[1;32H [2;30H [2;34H [3;30HXXXXXX[21;50HXX[2;32H [3;30H [13;32HXX[14;30HXXXXXX[21;50HXX[1;36HXXXXXXXX[21;50HXX[1;36H [1;44HXX[21;50HXX[1;38H [1;42H [2;40HXX[3;40HXX[21;50HXX[1;40H XX[2;40H XX[3;40H XX[21;50HXX[4;42HXX[21;50HXX[1;42H [2;40HXX[2;44HXXXX[3;42H [4;42H [21;50HXX[2;40H [2;48HXX[21;50HXX[1;44HXX[2;42H [2;46H [3;44HXX[4;44HXX[21;50HXX[1;44H [5;44HXX[21;50HXX[2;44H [3;44H [4;44H [5;44H [9;44HXX[10;44HXX[11;44HXX[12;44HXX[21;50HXX[1;36HXXXXXX[2;36HXX[21;50HXX[1;36H [1;40H [2;36H XXXX[21;50HXX[1;36HXX [2;36HXX[2;40H [21;50HXX[1;34HXX[1;38HXX[2;36H [21;50HXX[1;34H [2;34HXXXXXX[21;50HXX[1;36HXX [2;32HXX[2;38H [21;50HXX[1;32HXXXX [2;32H [2;36H [3;34HXX[21;50HXX[1;30HXX[1;34H [2;32HXX [3;32HXX [21;50HXX[1;30H [2;30HXX[4;32HXX[21;50HXX[2;30H [3;32H [4;32H [10;30HXXXX[11;32HXX[12;32HXX[21;50HXX[1;36HXXXXXX[2;40HXX[21;50HXX[1;36H [1;40H [2;38HXX [21;50HXX[1;36HXX[1;40HXX[2;38H [21;50HXX[1;38H [2;36HXXXXXX[21;50HXX[1;36H XX[2;36H [2;40H [3;36HXXXX[21;50HXX[1;38H [2;38H [3;36H [13;38HXX[14;38HXX[15;36HXXXX[21;50HXX[1;36HXXXXXX[2;36HXX[21;50HXX[1;36H [1;42HXX[2;36H XX[21;50HXX[1;38H [2;40HXXXX[3;38HXX[21;50HXX[1;40HXX[2;38H [2;42H [3;38H XXXX[21;50HXX[1;40H XX[2;40H XX[3;40H [3;44HXX[21;50HXX[1;42H XX[2;40HXX[2;44HXX[3;42H [21;50HXX[1;44H XX[2;40H [2;46HXX[21;50HXX[1;46H [2;42H [3;42HXXXXXX[21;50HXX[2;42HXXXX [3;42H [3;46H [4;44HXX[21;50HXX[2;42H [3;44H [4;44H [6;42HXXXX[7;44HXX[8;44HXX[21;50HXX[1;38HXXXX[21;50HXX[1;36HXX[1;40H [2;36HXX[21;50HXX[1;34HXX[1;38H [2;34HXX [21;50HXX[1;34H [2;36HXX[3;34HXX[21;50HXX[1;34HXX[2;34H [2;38HXX[3;34H [21;50HXX[1;32HXX[1;36H [2;34HXX[2;38H [21;50HXX[1;32H [2;32HXX[2;36H [3;32HXX[21;50HXX[1;32HXX [2;30HXX[2;34H [3;30HXX [21;50HXX[1;32H [2;30H [3;32HXX[4;30HXX[21;50HXX[2;32H [3;30H [4;30H [7;32HXX[8;30HXXXX[9;30HXX[21;50HXX[1;36HXXXX[21;50HXX[21;50HXX[1;36H [1;40HXX[21;50HXX[21;50HXX[2;38HXXXX[21;50HXX[1;38H [1;42HXX[2;38H [2;42HXX[21;50HXX[21;50HXX[1;40H [1;44HXX[2;40H [2;44HXX[21;50HXX[21;50HXX[1;42H [3;42HXXXX[21;50HXX[2;42H [3;42H [4;42HXXXX[5;42HXXXX[21;50HXX[1;36HXXXX[21;50HXX[1;36H [1;40HXX[2;40HXX[21;50HXX[1;36HXX[1;40H [2;40H [21;50HXX[1;36H [1;40HXX[2;40HXX[21;50HXX[1;40H [2;38HXX[3;40HXX[21;50HXX[1;38H [2;38H [3;40H [10;38HXX[11;38HXXXX[12;40HXX[21;50HXX[1;36HXXXXXX[2;40HXX[21;50HXX[1;36H [2;40H [9;36HXXXXXX[10;40HXX[21;50HXX[21;50HXX[1;38HXXXX[21;50HXX[1;36HXX[1;40H [2;36HXX[21;50HXX[1;34HXX[1;38H [2;34HXX [21;50HXX[1;34H [2;36HXX[3;34HXX[21;50HXX[1;34HXX[2;34H [2;38HXX[3;34H [21;50HXX[1;32HXX[1;36H [2;34HXX[2;38H [21;50HXX[1;32H [2;34H [6;32HXXXX[7;34HXXXX[21;50HXX[1;36HXXXXXX[2;40HXX[21;50HXX[1;36H [1;42HXX[2;40H XX[21;50HXX[1;38H [1;42H [2;40HXX [21;50HXX[1;40H XX[2;40H XX[21;50HXX[1;40HXX[1;44HXX[2;42H [21;50HXX[1;42H [2;40HXXXXXX[21;50HXX[1;40H XX[2;40H [2;46HXX[21;50HXX[1;42H XX[2;42H [2;46H [3;42HXXXX[21;50HXX[21;50HXX[1;38HXXXX[21;50HXX[1;36HXX[1;40H [2;36HXX[21;50HXX[1;36H [2;38HXX[3;36HXX[21;50HXX[1;36HXX [2;34HXX[2;38H [3;34HXX [21;50HXX[1;34HXX[2;34H [2;38HXX[3;34H [21;50HXX[1;32HXX[1;36H [2;34HXX[2;38H [21;50HXX[1;32H [2;32HXX[2;36H [3;32HXX[21;50HXX[1;34H [2;32H [3;34HXX[4;32HXX[21;50HXX[2;32HXX [3;30HXX[3;34H [4;30HXX [21;50HXX[2;32H [3;30H [4;30H XX[5;30HXXXX[6;30HXX[21;50HXX[1;36HXXXXXX[2;40HXX[21;50HXX[1;36H [1;42HXX[2;40H XX[21;50HXX[1;38H [1;42H [2;40HXX [21;50HXX[1;40H XX[2;40H XX[21;50HXX[21;50HXX[1;38HXXXX[21;50HXX[21;50HXX[1;36HXX[1;40H [2;36HXX[21;50HXX[1;36H [2;36H [4;38HXX[5;36HXXXX[6;36HXX[21;50HXX[1;36HXXXX[21;50HXX[21;50HXX[1;34HXX[1;38H [21;50HXX[2;34HXXXX[21;50HXX[21;50HXX[1;32HXX[1;36H [2;32HXX[2;36H [21;50HXX[21;50HXX[1;30HXX[1;34H [2;30HXX[2;34H [21;50HXX[1;30H [3;30HXXXX[21;50HXX[21;50HXX[1;36HXXXX[21;50HXX[1;36H [1;40HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[2;38HXXXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[1;38H [3;38HXXXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX[21;50HXX diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/ticker.py b/lldb/third_party/Python/module/pexpect-4.6/tests/ticker.py deleted file mode 100755 index 5ecc1c21be0..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/ticker.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -''' -PEXPECT LICENSE - - This license is approved by the OSI and FSF as GPL-compatible. - http://opensource.org/licenses/isc-license.txt - - Copyright (c) 2012, Noah Spurrier <noah@noah.org> - PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY - PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE - COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -''' - -import time, sys - -for i in range(5): - print "tick" - time.sleep(1) - -sys.exit(0) diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/torturet.vt b/lldb/third_party/Python/module/pexpect-4.6/tests/torturet.vt deleted file mode 100644 index 65f965b505d..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/torturet.vt +++ /dev/null @@ -1,61 +0,0 @@ -\<>[H[1;2;3;4qPrEM1\[?4h[0m -[H[J[7m#6(0a`opqrs`(B This is the (0`srqpo`a(B[1m -#3VT100 series Torture Test Demonstration. -#4VT100 series Torture Test Demonstration. -#6[1;5m Watch the blinking lights [4;24r[0m -[0q[1q[0q[2q[0q[3q[0q[4q[0q -[0q[1q[0q[2q[0q[3q[0q[4q[0q -[0q[1q[0q[2q[0q[3q[0q[4q[0q -PrEM0\[4;1H[J[24;1H - -This file is a VT100-series Torture Test. It demonstrates all the visual -attributes of the VT100 terminal. - -The top line is double-width/single-height with inverse-video line-drawing -characters. The 2nd and 3rd lines are double-width/double-height in bold -inverse video. They also show the limited scrolling region. - -The remaining lines will show NORMAL, BOLD, BLINK, INVERSE, and all 16 -combinations of those 4 attributes. They show that there is a difference -between an underscore character and the underline attribute, and that -lower-case decenders go below the underline. - -A window pane is drawn in the lower right to show how the line-drawing set -can be used. At the lower left is the character set double-wide/double-high -to show the dot-matrix used. Upper-case characters are 8 by 7 in a 10 by 10 -character cell, with 1 blank row on top and 2 on the bottom. The underline -attribute uses the first bottom blank row, lower-case decenders use both. - - - -[0mThis is a normal line __________________________________________________y_ -[1mThis is a bold line (normal unless the Advanced Video Option is installed) -[0;4mThis line is underlined _ " " " " " " _y_ -[0;5mThis is a blinking line _ " " " " " " _y_ -[0;7mThis is inverse video _ (underlined if no AVO and cursor is underline) _y_ -[0mNormal gjpqy [4mUnderline[0;0m [5m Blink [4mUnderline+Blink gjpqy[0m -[1mBold gjpqy [4mUnderline[0;1m [5m Blink [4mUnderline+Blink gjpqy[0m -[7mInverse [4mUnderline[0;7m [5m Blink [4mUnderline+Blink[0;7m -[1mBold+Inverse [4mUnderline[0;1;7m [5m Blink [4mUnderline+Blink[0m -PrEM1\[A -#6This is double [1mwidth[0m -#3This is double [1mheight[0m -#4This is double [1mheight[0m -#6[7;4m_[0;7mABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy -#3[7;4m_[0;7mABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy -#4[7;4m_[0;7mABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ioy[3A -[0m[CA[CC[CE[CG[CI[CK[CM[CO[CQ[CS[CU[CW[CY[C0[C2[C4[C6[C8[Ci[Cy -[4m_[0m[CB[CD[CF[CH[CJ[CL[CN[CP[CR[CT[CV[CX[CZ[C1[C3[C5[C7[C9[Co -[4m_[0m[CB[CD[CF[CH[CJ[CL[CN[CP[CR[CT[CV[CX[CZ[C1[C3[C5[C7[C9[Co -(0#6[7m`abcdefghijklmnopqrstuvwxyz{|}~[0m lqwqk -#3[7m`abcdefghijklmnopqrstuvwxyz{|}~[0m tqnqu -#4[7m`abcdefghijklmnopqrstuvwxyz{|}~[0m tqnqu[3A[0m -[Ca[Cc[Ce[Cg[Ci[Ck[Cm[Co[Cq[Cs[Cu[Cw[Cy[C{[C} -`[Cb[Cd[Cf[Ch[Cj[Cl[Cn[Cp[Cr[Ct[Cv[Cx[Cz[C|[C~ -`[Cb[Cd[Cf[Ch[Cj[Cl[Cn[Cp[Cr[Ct[Cv[Cx[Cz[C|[C~(B -#6[7m`abcdefghijklmnopqrstuvwxyz{|}~(0[0m mqvqj[A(B -[0m[Ca[Cc[Ce[Cg[Ci[Ck[Cm[Co[Cq[Cs[Cu[Cw[Cy[C{[C} -PrEM0\ $PrEM0 works on GIGI [A[1;7m - This test created by Joe Smith, 8-May-85 [0m -[1;r[22;1H - diff --git a/lldb/third_party/Python/module/pexpect-4.6/tests/utils.py b/lldb/third_party/Python/module/pexpect-4.6/tests/utils.py deleted file mode 100644 index dcd3aa017da..00000000000 --- a/lldb/third_party/Python/module/pexpect-4.6/tests/utils.py +++ /dev/null @@ -1,7 +0,0 @@ -import os - -def no_coverage_env(): - "Return a copy of os.environ that won't trigger coverage measurement." - env = os.environ.copy() - env.pop('COV_CORE_SOURCE', None) - return env
\ No newline at end of file |