private void TestLineTerminated() { var line = _currentTestLine.ToString(); var match = TestChunkRegex.Match(line.Replace("(lldb) ", "")); int verifyUriLen; // The format of each test line from debug log is |<chunk length>|<chunk>|<endchar> // Uri got (made up) scheme `unotests://`, and the length is prepended to // verify that no characters have been inserted in the middle of the uri, // which unfortunately sometimes happen when using ios-deploy. if (match.Success && int.TryParse(match.Groups["len"].Value, out verifyUriLen) && match.Groups["chunk"].Value.Length == verifyUriLen) { if (match.Value != _lastMatch) { _currentMessage.Append(match.Groups["chunk"]); if (match.Groups["endchar"].Value == ";") { var uri = new Uri(_currentMessage.ToString()); _testRun.EventOccured(HttpUtility.ParseQueryString(uri.Query)); _currentMessage.Clear(); } _lastMatch = match.Value; } if (Log.Default.Level >= LogLevel.VeryVerbose) { _wrapped.Write(line); } else { // We always seem to get an empty extra line following // every output from log on ios-deploy. // // This is not critical, but quite annoying, so we'll // avoid printing those. (except when using -vv) _silenceNextEmptyLine = true; } } else { if (line != "\n" || !_silenceNextEmptyLine) { _wrapped.Write(line); } _silenceNextEmptyLine = false; } _currentTestLine.Clear(); }
void WorkerThread() { try { var sortedRequests = new SortedList <int, NameValueCollection>(); int expectedSequenceId = 0; while (!_testRun.IsFinished() && !_terminate.WaitOne(0)) { NameValueCollection request; while (_pendingRequests.TryDequeue(out request)) { int sequenceId = int.Parse(request.Get("sequenceId")); sortedRequests.Add(sequenceId, request); } while (sortedRequests.TryGetValue(expectedSequenceId, out request)) { _testRun.EventOccured(request); sortedRequests.Remove(expectedSequenceId++); } } _idle.Set(); if (!_pendingRequests.IsEmpty || sortedRequests.Count > 0) { throw new Exception("TestRun finished, but there's still pending requests!"); } } catch (Exception e) { _testRun.ErrorOccured(e); } }