+2012-01-26 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r105935 and r105954.
+ http://trac.webkit.org/changeset/105935
+ http://trac.webkit.org/changeset/105954
+ https://bugs.webkit.org/show_bug.cgi?id=77080
+
+ test-webkitpy is still broken (Requested by abarth on
+ #webkit).
+
+ * Scripts/test-webkitpy:
+ * Scripts/webkitpy/common/system/executive_unittest.py:
+ (never_ending_command):
+ (ExecutiveTest.test_run_command_args_type):
+ (ExecutiveTest.test_run_command_with_unicode):
+ (ExecutiveTest.test_running_pids):
+ * Scripts/webkitpy/common/system/fileutils.py:
+ (make_stdout_binary):
+ * Scripts/webkitpy/test/cat.py:
+ (command_arguments):
+ (main):
+ * Scripts/webkitpy/test/cat_unittest.py:
+ (CatTest):
+ (CatTest.assert_cat):
+ (CatTest.test_basic):
+ (CatTest.test_no_newline):
+ (CatTest.test_unicode):
+ (CatTest.test_as_command):
+ * Scripts/webkitpy/test/echo.py:
+ (command_arguments):
+ (main):
+ * Scripts/webkitpy/test/echo_unittest.py:
+ (EchoTest):
+ (EchoTest.test_basic):
+ (EchoTest.test_no_newline):
+ (EchoTest.test_unicode):
+ (EchoTest.test_argument_order):
+ (EchoTest.test_empty_arguments):
+ (EchoTest.test_no_arguments):
+ (EchoTest.test_as_command):
+
2012-01-26 Gabor Rapcsanyi <rgabor@webkit.org>
[GTK] Detect cross-compilation in webkitdirs.pm to not generate gtkdoc
if __name__ == "__main__":
- webkit_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+ webkit_root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
# FIXME: We should probably test each package separately to avoid naming conflicts.
dirs = [
from webkitpy.common.system.executive import Executive, ScriptError
from webkitpy.common.system.filesystem_mock import MockFileSystem
+from webkitpy.test import cat, echo
class ScriptErrorTest(unittest.TestCase):
return ['yes']
-def command_line(cmd, *args):
- return [sys.executable, __file__, '--' + cmd] + list(args)
-
-
-def script_dir():
- return os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
-
-
class ExecutiveTest(unittest.TestCase):
- def setUp(self):
- # We need this so that we can launch 'python executive_unittests.py' directly (to test
- # actually spawning subprocesses) and have 'from webkitpy...' imports work reliably.
- self.orig_pythonpath = os.environ.get('PYTHONPATH')
- os.environ['PYTHONPATH'] = script_dir()
-
- def tearDown(self):
- if self.orig_pythonpath is not None:
- os.environ['PYTHONPATH'] = self.orig_pythonpath
- else:
- del os.environ['PYTHONPATH']
def assert_interpreter_for_content(self, intepreter, content):
fs = MockFileSystem()
executive = Executive()
self.assertRaises(AssertionError, executive.run_command, "echo")
self.assertRaises(AssertionError, executive.run_command, u"echo")
- executive.run_command(command_line('echo', 'foo'))
- executive.run_command(tuple(command_line('echo', 'foo')))
+ executive.run_command(echo.command_arguments('foo'))
+ executive.run_command(tuple(echo.command_arguments('foo')))
def test_run_command_with_unicode(self):
"""Validate that it is safe to pass unicode() objects
executive = Executive()
- output = executive.run_command(command_line('cat'), input=unicode_tor_input)
+ output = executive.run_command(cat.command_arguments(), input=unicode_tor_input)
self.assertEquals(output, unicode_tor_output)
- output = executive.run_command(command_line('echo', unicode_tor_input))
+ output = executive.run_command(echo.command_arguments("-n", unicode_tor_input))
self.assertEquals(output, unicode_tor_output)
- output = executive.run_command(command_line('echo', unicode_tor_input), decode_output=False)
+ output = executive.run_command(echo.command_arguments("-n", unicode_tor_input), decode_output=False)
self.assertEquals(output, encoded_tor)
# Make sure that str() input also works.
- output = executive.run_command(command_line('cat'), input=encoded_tor, decode_output=False)
+ output = executive.run_command(cat.command_arguments(), input=encoded_tor, decode_output=False)
self.assertEquals(output, encoded_tor)
# FIXME: We should only have one run* method to test
- output = executive.run_and_throw_if_fail(command_line('echo', unicode_tor_input), quiet=True)
+ output = executive.run_and_throw_if_fail(echo.command_arguments("-n", unicode_tor_input), quiet=True)
self.assertEquals(output, unicode_tor_output)
- output = executive.run_and_throw_if_fail(command_line('echo', unicode_tor_input), quiet=True, decode_output=False)
+ output = executive.run_and_throw_if_fail(echo.command_arguments("-n", unicode_tor_input), quiet=True, decode_output=False)
self.assertEquals(output, encoded_tor)
def test_kill_process(self):
executive = Executive()
pids = executive.running_pids()
self.assertTrue(os.getpid() in pids)
-
-
-def main(platform, stdin, stdout, cmd, args):
- if platform == 'win32' and hasattr(stdout, 'fileno'):
- import msvcrt
- msvcrt.setmode(stdout.fileno(), os.O_BINARY)
- if cmd == '--cat':
- stdout.write(stdin.read())
- elif cmd == '--echo':
- stdout.write(' '.join(args))
- return 0
-
-if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '--echo'):
- sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:]))
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+
+
+def make_stdout_binary():
+ """Puts sys.stdout into binary mode (on platforms that have a distinction
+ between text and binary mode)."""
+ if sys.platform != 'win32' or not hasattr(sys.stdout, 'fileno'):
+ return
+ import msvcrt
+ import os
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os.path
+import sys
+
+# Add WebKitTools/Scripts to the path to ensure we can find webkitpy.
+sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+
+from webkitpy.common.system import fileutils
+
+
+def command_arguments(*args):
+ return [sys.executable, __file__] + list(args)
+
+
+def main():
+ fileutils.make_stdout_binary()
+ sys.stdout.write(sys.stdin.read())
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import StringIO
+import os.path
+import sys
+import unittest
+
+from webkitpy.common.system import executive, outputcapture
+from webkitpy.test import cat
+
+
+class CatTest(outputcapture.OutputCaptureTestCaseBase):
+ def assert_cat(self, input):
+ saved_stdin = sys.stdin
+ sys.stdin = StringIO.StringIO(input)
+ cat.main()
+ self.assertStdout(input)
+ sys.stdin = saved_stdin
+
+ def test_basic(self):
+ self.assert_cat('foo bar baz\n')
+
+ def test_no_newline(self):
+ self.assert_cat('foo bar baz')
+
+ def test_unicode(self):
+ self.assert_cat(u'WebKit \u2661 Tor Arne Vestb\u00F8!')
+
+ def test_as_command(self):
+ input = 'foo bar baz\n'
+ output = executive.Executive().run_command(cat.command_arguments(), input=input)
+ self.assertEqual(input, output)
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os.path
+import sys
+
+# Add WebKitTools/Scripts to the path to ensure we can find webkitpy.
+sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+
+from webkitpy.common.system import fileutils
+
+
+def command_arguments(*args):
+ return [sys.executable, __file__] + list(args)
+
+
+def main(args=None):
+ if args is None:
+ args = sys.argv[1:]
+
+ fileutils.make_stdout_binary()
+
+ print_newline = True
+ if len(args) and args[0] == '-n':
+ print_newline = False
+ del args[0]
+ sys.stdout.write(' '.join(args))
+ if print_newline:
+ sys.stdout.write('\n')
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())
+# Copyright (C) 2010 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os.path
+import sys
+import unittest
+
+from webkitpy.common.system import executive, outputcapture
+from webkitpy.test import echo
+
+
+class EchoTest(outputcapture.OutputCaptureTestCaseBase):
+ def test_basic(self):
+ echo.main(['foo', 'bar', 'baz'])
+ self.assertStdout('foo bar baz\n')
+
+ def test_no_newline(self):
+ echo.main(['-n', 'foo', 'bar', 'baz'])
+ self.assertStdout('foo bar baz')
+
+ def test_unicode(self):
+ echo.main([u'WebKit \u2661', 'Tor Arne', u'Vestb\u00F8!'])
+ self.assertStdout(u'WebKit \u2661 Tor Arne Vestb\u00F8!\n')
+
+ def test_argument_order(self):
+ echo.main(['foo', '-n', 'bar'])
+ self.assertStdout('foo -n bar\n')
+
+ def test_empty_arguments(self):
+ old_argv = sys.argv
+ sys.argv = ['echo.py', 'foo', 'bar', 'baz']
+ echo.main([])
+ self.assertStdout('\n')
+ sys.argv = old_argv
+
+ def test_no_arguments(self):
+ old_argv = sys.argv
+ sys.argv = ['echo.py', 'foo', 'bar', 'baz']
+ echo.main()
+ self.assertStdout('foo bar baz\n')
+ sys.argv = old_argv
+
+ def test_as_command(self):
+ output = executive.Executive().run_command(echo.command_arguments('foo', 'bar', 'baz'))
+ self.assertEqual(output, 'foo bar baz\n')