RESOLVED INVALID 164344
Add TCP client to DumpRenderTree and WebKitTestRunner for on device testing
https://bugs.webkit.org/show_bug.cgi?id=164344
Summary Add TCP client to DumpRenderTree and WebKitTestRunner for on device testing
Jonathan Bedard
Reported 2016-11-02 15:30:49 PDT
In order to test on device, a TCP connection will be opened between device and host. This adds the TCP client which will run on the device. This TCP client redirects standard out and standard error to the TCP connection and sends it's received data to standard in. If the server is not properly initialized, the normal handles for standard out, standard error and standard in will be used.
Attachments
Patch (49.06 KB, patch)
2016-11-02 16:41 PDT, Jonathan Bedard
no flags
Patch (49.14 KB, patch)
2016-11-03 09:13 PDT, Jonathan Bedard
no flags
Patch (50.24 KB, patch)
2016-11-03 10:20 PDT, Jonathan Bedard
no flags
Archive of layout-test-results from ews103 for mac-yosemite (838.62 KB, application/zip)
2016-11-03 13:34 PDT, Build Bot
no flags
Patch (50.24 KB, patch)
2016-11-03 14:29 PDT, Jonathan Bedard
no flags
Patch (50.25 KB, patch)
2016-11-03 16:01 PDT, Jonathan Bedard
no flags
Patch (50.81 KB, patch)
2016-11-04 09:38 PDT, Jonathan Bedard
no flags
Patch (50.90 KB, patch)
2016-11-04 10:29 PDT, Jonathan Bedard
no flags
Patch (51.42 KB, patch)
2016-11-04 14:33 PDT, Jonathan Bedard
no flags
Patch (51.72 KB, patch)
2016-11-07 08:00 PST, Jonathan Bedard
no flags
Patch (51.79 KB, patch)
2016-11-07 09:15 PST, Jonathan Bedard
no flags
Patch (52.16 KB, patch)
2016-11-07 10:27 PST, Jonathan Bedard
no flags
Patch (51.10 KB, patch)
2016-11-14 12:44 PST, Jonathan Bedard
no flags
Jonathan Bedard
Comment 1 2016-11-02 15:33:53 PDT
https://bugs.webkit.org/show_bug.cgi?id=164338 contains the server associated with this client. Note that this patch does not use the TCP client, it simply implements it.
Jonathan Bedard
Comment 2 2016-11-02 16:41:30 PDT
Jonathan Bedard
Comment 3 2016-11-03 09:13:10 PDT
Jonathan Bedard
Comment 4 2016-11-03 10:20:05 PDT
WebKit Commit Bot
Comment 5 2016-11-03 10:23:16 PDT
Attachment 293772 [details] did not pass style-queue: ERROR: Tools/WebKitTestRunner/CMakeLists.txt:38: No trailing spaces [whitespace/trailing] [5] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 6 2016-11-03 13:34:25 PDT
Comment on attachment 293772 [details] Patch Attachment 293772 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2456149 New failing tests: inspector/sampling-profiler/call-frame-with-dom-functions.html
Build Bot
Comment 7 2016-11-03 13:34:28 PDT
Created attachment 293795 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Jonathan Bedard
Comment 8 2016-11-03 14:29:28 PDT
Jonathan Bedard
Comment 9 2016-11-03 16:01:51 PDT
Jonathan Bedard
Comment 10 2016-11-04 09:38:13 PDT
Jonathan Bedard
Comment 11 2016-11-04 10:29:32 PDT
Jonathan Bedard
Comment 12 2016-11-04 14:33:07 PDT
WebKit Commit Bot
Comment 13 2016-11-04 14:35:55 PDT
Attachment 293930 [details] did not pass style-queue: ERROR: Tools/TestRunnerShared/PipingServer.cpp:35: socklen_t is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jonathan Bedard
Comment 14 2016-11-07 08:00:53 PST
WebKit Commit Bot
Comment 15 2016-11-07 08:02:42 PST
Attachment 294062 [details] did not pass style-queue: ERROR: Tools/TestRunnerShared/PipingServer.cpp:34: socklen_t is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jonathan Bedard
Comment 16 2016-11-07 09:15:20 PST
WebKit Commit Bot
Comment 17 2016-11-07 09:17:59 PST
Attachment 294065 [details] did not pass style-queue: ERROR: Tools/TestRunnerShared/PipingServer.cpp:34: socklen_t is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jonathan Bedard
Comment 18 2016-11-07 10:27:28 PST
WebKit Commit Bot
Comment 19 2016-11-07 10:28:46 PST
Attachment 294067 [details] did not pass style-queue: ERROR: Tools/TestRunnerShared/PipingServer.cpp:34: socklen_t is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 1 in 18 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jonathan Bedard
Comment 20 2016-11-10 14:14:03 PST
Comment on attachment 294067 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=294067&action=review > Tools/WebKitTestRunner/TestController.cpp:-1087 > - Typo here has been noted > Tools/WebKitTestRunner/TestController.cpp:-1115 > - Typo here has been noted
Radar WebKit Bug Importer
Comment 21 2016-11-10 14:16:48 PST
Daniel Bates
Comment 22 2016-11-11 09:58:10 PST
Comment on attachment 294067 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=294067&action=review > Tools/TestRunnerShared/PipingServer.cpp:235 > +static LoggingTCPPipe* singlePtr(nullptr); > + > +LoggingTCPPipe& LoggingTCPPipe::singleton() > +{ > + if (!isInitialized()) > + initialize(); > + return *singlePtr; > +} This is weird. I suggest that DRT/WTR manage the singleton LoggingTCPPipe. > Tools/TestRunnerShared/PipingServer.cpp:239 > +#if OS(UNIX) Can we separate out the UNIX and Windows implementations into separate files similar to what we do in WebCore/platform? > Tools/TestRunnerShared/PipingServer.cpp:257 > + int portVal = 5000 + getpid() % 5000; Can you explain this? How did you pick the number 5000? Maybe a better name is basePort? > Tools/TestRunnerShared/PipingServer.cpp:297 > + memset(m_threads, 0, sizeof(std::thread*)*3); Can we use std::array and remove the need for zeroing out this memory? > Tools/TestRunnerShared/PipingServer.cpp:310 > + delete m_stdout; > + delete m_stderr; > + delete m_stdin; > + delete m_stdoutSocket; > + delete m_stderrSocket; > + delete m_stdinSocket; Can we use std::unique_ptr and remove the need for these deletes? > Tools/TestRunnerShared/PipingServer.cpp:337 > + m_threads[s_stdoutThread] = new std::thread(LoggingTCPPipe::stdoutLoop); > + m_threads[s_stderrThread] = new std::thread(LoggingTCPPipe::stderrLoop); Can we wrap these raw pointers in std::unique_ptr? > Tools/TestRunnerShared/PipingServer.cpp:380 > +#define TYPE_TAG 8 What is the purpose of this variable? Can we come up with a more descriptive name? How did you pick the value 8? > Tools/TestRunnerShared/TestingSocket.cpp:133 > + size_t len = strlen(name); > + m_name = new char[len + 1]; > + memset(m_name, 0, len + 1); > + memcpy(m_name, name, len); Can we use std::string and avoid this? > Tools/TestRunnerShared/TestingSocket.cpp:138 > + strcpy(m_address.sun_path, m_name); strncpy? > Tools/TestRunnerShared/TestingSocket.h:59 > + inline FILE* file() { return m_target; } > + inline FILE* original() { return m_original; } > + inline bool isEnabled() const { return m_enabled; } The keyword inline is not necessary. Inline C++ member functions are inlined by definition. > Tools/TestRunnerShared/TestingSocket.h:68 > +class TCPTestingSocket : public TestingSocket { Can we come up with a more descriptive name for this? I am unclear of the purpose of this class. From talking with you this class is only used for Windows. Maybe we should state that in its name? > Tools/TestRunnerShared/TestingSocket.h:88 > +class UnixTestingSocket : public TestingSocket { Can we come up with a more descriptive name for this? I am unclear of the purpose of this class. > Tools/TestRunnerShared/TestingSocket.h:96 > + char* m_name; Can we use std::string? > Tools/WebKitTestRunner/Options.cpp:47 > + , tcpAddress("127.0.0.1") This is OK as-is. Is there an API we can use to determine the local loopback address? > Tools/WebKitTestRunner/Options.cpp:177 > + Is this intentional? > Tools/WebKitTestRunner/Options.h:51 > + int tcpPort; Would it make sense to use an unsigned integer for the TCP port? How do we behave if a person passes a negative port number? > Tools/WebKitTestRunner/TestController.cpp:1126 > + fflush(stderr); Normally stderr has the property that it auto flushes. Maybe this no longer makes sense when using TCP sockets. > Tools/WebKitTestRunner/ios/mainIOS.mm:72 > + NSString *docs_dir = [paths objectAtIndex:0]; Variables names should be written in CamelCase as opposed to using underscores to separate words in a name.
Jonathan Bedard
Comment 23 2016-11-14 12:44:31 PST
WebKit Commit Bot
Comment 24 2016-11-14 12:47:02 PST
Attachment 294731 [details] did not pass style-queue: ERROR: Tools/TestRunnerShared/LoggingTCPPipe.cpp:34: socklen_t is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Tools/TestRunnerShared/InternalFileSocket.cpp:34: socklen_t is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Daniel Bates
Comment 25 2016-11-14 14:43:31 PST
Comment on attachment 294731 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=294731&action=review > Tools/ChangeLog:16 > + (runTestingServerLoop): Added â#quitâ command to exit application gracefully, flush stdout and stderr every loop. Quotes are not being encoded correctly at least in PrettyPatch. We should explain why we need to add a quit command given that the current setup worked without this. > Tools/ChangeLog:21 > + (WTR::InternalFileSocket::FileSide::FileSide): "Client side" of the local socket, which swaps the provided FILE* with a FILE* referenceing a local socket. referenceing => referencing > Tools/TestRunnerShared/InternalFileSocket.cpp:70 > + memset((char*)&m_address, 0, sizeof(m_address)); > + m_address.sun_family = AF_UNIX; How did you decide to build up m_address here as opposed to in ::open()? > Tools/TestRunnerShared/InternalFileSocket.cpp:71 > + strncpy(m_address.sun_path, m_name.c_str(), 108); 108 is is the wrong size of the sun_path field on OS X per unix(4). Regardless, we should use sizeof(m_address.sun_path) to let the compiler compute the correct size of this field instead of hardcoding a size. > Tools/TestRunnerShared/InternalFileSocket.cpp:103 > + m_socket = socket(AF_UNIX, SOCK_STREAM, 0); Is there a named constant that we can use for protocol 0? Or can we add a comment? > Tools/TestRunnerShared/InternalFileSocket.cpp:152 > + memset((char*)&m_address, 0, sizeof(m_address)); > + m_address.sun_family = AF_UNIX; How did you decide to build up m_address here as opposed to in ::open()? > Tools/TestRunnerShared/InternalFileSocket.cpp:153 > + strncpy(m_address.sun_path, m_name.c_str(), 108); 108 is is the wrong size of the sun_path field on OS X per unix(4). Regardless, we should use sizeof(m_address.sun_path) to let the compiler compute the correct size of this field instead of hardcoding a size.
Jonathan Bedard
Comment 26 2016-12-15 13:42:01 PST
Using a different approach.
Note You need to log in before you can comment on or make changes to this bug.