Commit Graph

30 Commits

Author SHA1 Message Date
Chaoren Lin 2ce7627807 Fix compilation error and cleanup in ThreadStateCoordinatorTest
llvm-svn: 227932
2015-02-03 01:51:54 +00:00
Tamas Berghammer 8cd5f6f41b Cleanup do-gtest.py
* Add comments
* Refactor output manipulation (cleanup + minor bug fixes)
* Add better error reporting on test failure

llvm-svn: 226907
2015-01-23 11:02:28 +00:00
Vince Harron db93444f26 Print out the full output of gtest
This patch fixes a bug that prevented all gtest output from being
displayed.

Submitted for Tamas Berghammer

llvm-svn: 226477
2015-01-19 18:18:24 +00:00
Vince Harron 81f0746cac Fixed Linux build error in gtest
llvm-svn: 226471
2015-01-19 17:31:22 +00:00
Vince Harron 014bb7da79 Add Socket::Get[Remote/Local]IpAddress and unit tests
Differential Revision: http://reviews.llvm.org/D6917

llvm-svn: 226234
2015-01-16 00:47:08 +00:00
Vince Harron e6c5dcf512 UriParser - fixed potential buffer overrun
Switched from ::strtoul to StringConvert::ToUInt32
Changed port output parameter to be -1 if port is unspecified

llvm-svn: 226204
2015-01-15 20:57:01 +00:00
Vince Harron e38b24a72b Got C++ unit tests running on Linux again
llvm-svn: 225604
2015-01-11 09:42:12 +00:00
Vince Harron 3218c0fb94 Adds UriParser::Parse and unit tests
This can be used to parse URIs passed to 'platform connect'

Differential Revision: http://reviews.llvm.org/D6858

llvm-svn: 225317
2015-01-06 23:38:24 +00:00
Vince Harron 6eddf8df2a Added StringExtractor::DecodeHexU8 && GetHexBytesAvail
DecodeHexU8 returns a decoded hex character pair, returns -1 if a
valid hex pair is not available.

GetHexBytesAvail decodes all available hex pairs.

llvm-svn: 223081
2014-12-01 22:19:33 +00:00
Vince Harron e5a9eaaaed StringExtractor unit tests
Unit tests to cover StringExtractor in advance of minor new
functionality & minor refactor

llvm-svn: 223080
2014-12-01 22:10:15 +00:00
Todd Fiala 7aafc4a5ff thread state coordinator: fixed bug in thread running state book-keeping.
Adds a test to verify that a thread resume request marks the thread as running
after doing the resume callback.  This test fails without the corresponding
ThreadStateCoordinator.cpp change.

Fixes the code where that state was not maintained.

llvm-svn: 219412
2014-10-09 17:00:55 +00:00
Todd Fiala 9c08576389 Fix stale comments in new tests.
Dang.

llvm-svn: 218901
2014-10-02 19:48:30 +00:00
Todd Fiala b72209102f thread state coordinator: add tests and impl to error on creation/death issues.
Added tests and impl to make sure the following errors are reported:
* Notifying a created thread that we are already tracking.
* Notifying a thread death for a thread we don't know about.

llvm-svn: 218900
2014-10-02 19:44:32 +00:00
Todd Fiala 325111bcc6 thread state coordinator: added simpler deferred stop notification method.
Now that ThreadStateCoordinator errors out on threads in unexpected states,
it has enough information to know which threads need stop requests fired
when we want to do a deferred callback on a thread's behalf.  This change
adds a new method, CallAfterRunningThreadsStop(...), which no longer
takes a set of thread ids that require stop requests.  It's much harder
to misuse this method and (with newer error logic) it's harder to
correctly use the original method.  Expect the original method that takes
the set of thread ids to stop to disappear in the near future.

Adds several tests for CallAfterRunningThreadsStop().

llvm-svn: 218897
2014-10-02 19:03:06 +00:00
Todd Fiala 755be7f86a Fix up stale comments from last change.
llvm-svn: 218873
2014-10-02 14:44:33 +00:00
Todd Fiala 404e370892 thread state coordinator: requesting resume now signals error appropriately.
Added tests to verify that the coordinator signals an error if
the given thread to resume is unknown, and if the thread is through to
be running already.

Modified resume handling code to match tests.

llvm-svn: 218872
2014-10-02 14:41:15 +00:00
Todd Fiala 4bb603b2aa gtest runner: now always does a clean step after running.
* Checks for any 'clean' arg, setting clean-only mode.
* If clean-only mode, skip the make.
* Adds the equivalent of os.devnull in a way that supports the file-like 'write' operation.
* Uses a null sysout/syserr for the clean step so we don't see noise from cleaning.
* Now always runs the clean step after a real test run so we don't have cruft left over after a test run.

llvm-svn: 218871
2014-10-02 14:07:46 +00:00
Todd Fiala ebcf42cdec thread state coordinator: added error callbacks, cleaned up tests.
ThreadStateCoordinator changes:
* Most commands that run in the queue now take an error handler that
  will be called with an error string if an error occurs during processing.
  Errors generally stop the operation in progress.  The errors are checked
  at time of execution.  This is intended to help flush out ptrace/waitpid/state management
  issues as quickly as possible.

* Threads now must be known to the coordinator before stops can be reported,
  resumes can be requested, thread deaths can be reported, or deferred stop
  notifications can be made.  Failure to know the thread will cause the coordinator
  to call the error callback for the event being processed.  Threads are introduced
  to the system by the NotifyThreadCreate method.
  
* The NotifyThreadCreate method now takes the initial state of the thread being
  introduces to the system.  We no longer just assume the thread is running.
  
The test cases were cleaned up, too:
* A gtest test fixture is now used, which allows creating less verbose helper
  methods that setup common pieces of callback code for some method invocations.
  Net result: the tests are simpler to read and shorter to write.

llvm-svn: 218833
2014-10-01 21:40:45 +00:00
Todd Fiala 1f67ded0b2 thread state coordinator: add additional assert missing from previous test check-in.
llvm-svn: 218686
2014-09-30 17:00:52 +00:00
Todd Fiala f8d929dc82 thread state coordinator: add test to be explicit about resume behavior in presence of deferred stop notification still pending.
There is a state transition that seems potentially buggy that I am capturing and
logging here, and including an explicit test to demonstrate expected behavior.  See new test
for detailed description.  Added logging around this area since, if we hit it, we
may have a usage bug, or a new state transition we really need to investigate.

This is around this scenario:
Thread C deferred stop notification awaiting thread A and thread B to stop.
Thread A stops.
Thread A requests resume.
Thread B stops.

Here we will explicitly signal the deferred stop notification after thread B
stops even though thread A is now resumed.  Copious logging happens here.

llvm-svn: 218683
2014-09-30 16:56:28 +00:00
Todd Fiala e2109e7323 thread state coordinator: added a thread resume request and related tests.
The thread resume block is executed in the normal flow of thread
state queued event processing.  The tests verify that it is executed
when we track the thread to be stopped and skipped when we track
it to already be running.

llvm-svn: 218638
2014-09-29 22:57:05 +00:00
Todd Fiala 424723b281 thread state coordinator: add exec reset support, remove empty virtual destructors.
Also added a test for the reset handling.  The reset/state clearing happens
as a processed queue event.  The only diff vs. standard processing is that
the exec clears the queue before queueing the activity to clear internal state.
i.e. once we get an exec, we really stop doing any other queue-based activity.

llvm-svn: 218629
2014-09-29 21:45:21 +00:00
Todd Fiala 55a02a7478 thread state coordinator: added new thread support.
A new thread arriving while a pending signal notification
is outstanding will (1) add the new thread to the list of
stops expected before the deferred signal notification is
fired, (2) send a stop request for the new thread, and
(3) track the new thread as currently running.

llvm-svn: 218578
2014-09-28 06:50:47 +00:00
Todd Fiala ef5dbf55c8 thread state coordinator: added thread death support and more tests.
Tested two pending stops before notification, where one of the pending stop
requirements was already known to be stopped.

Tested pending thread stop before notification, then reporting thread with
pending stop died and verifies pending notification is made.

llvm-svn: 218559
2014-09-27 01:58:13 +00:00
Todd Fiala 9dd7334d69 thread state coordinator: added test for notify after two pending thread stops.
Glad I did - caught a bug where the auto variable was not a reference
to a set and instead was a copy.  I need to review rules on that!

llvm-svn: 218558
2014-09-27 01:11:17 +00:00
Todd Fiala e9c9e7070e thread state coordinator: handle when prerequisite pending stop is already stopped.
Change includes new gtest and functionality.

llvm-svn: 218555
2014-09-26 23:42:53 +00:00
Todd Fiala 80bef312b5 gtest: tweaked test runner to fix an extra comma, added more tdd-based thread coordinator behavior.
Starting to flesh out the thread state coordinator class that will be used
by Linux/llgs.

llvm-svn: 218537
2014-09-26 19:08:00 +00:00
Todd Fiala 4dcb6aded2 gtest: modified Xcode integration so gtest assert/expect failure now shows error content in the error marker at the line of failure.
This change modifies the python test runner to combine lines starting with a
failure report including up to 3 more lines, terminated by the next
"[  FAILED  ]" line.  These are all emitted on the same line as the file:line
indication, which allows Xcode's failure marker code to pick it up and display
it along with the error badge in the Xcode editor window.  Makes for a nice
gtest development experience.

llvm-svn: 218518
2014-09-26 12:58:25 +00:00
Todd Fiala f3a3fc5120 gtest: remove recursive make, add python driver + Xcode error hook-up.
This change does the following:
* Removes the gtest/Makefile recursive-make-based calling strategy
  for gtest execution.
* Adds the gtest/do-gtest.py call script.
  - This handles finding and calling the Makefiles that really
    run tests.
  - This script also transforms the test output into something
    that Xcode can place a failure marker on when a test fails.
* Modifies the Xcode external build command target for gtest.
  It now calls the gtest/do-gtest.py script.

There is still room for improvement on Xcode integration of
do-gtest.py.  Essentially the next several lines of error reporting
from the gtest output should be coalesced into a single line so that
Xcode can tell more about the error directly in the editor.  Right now
it just puts a red mark and says "failure" but doesn't give any
details.

llvm-svn: 218470
2014-09-25 22:12:33 +00:00
Todd Fiala b3185e710e Fixup gtest layout, add Linux ThreadStateCoordinator.cpp.
This change does the following:
* Remove test/c++/...
* Add gtest.
* Add gtest/unittest directory for unittesting individual classes.
* Add an initial Plugins/Process?linux/ThreadStateCoordinatorTest.cpp.
  - currently failing a test (intentional).
  - added a bare-bones ThreadStateCoordinator.cpp to Plugins/Process/Linux,
    more soon. Just enough to prove out running gtest on Ubuntu and MacOSX.
* Added recursive make machinery so that doing a 'make' in gtest/ is
  sufficient to kick off the existing test several directories down.
  - Caveat - I currently short circuit from gtest/unittest/Makefile directly to
    the one and only gtest/unittest/Plugins/Process/Linux directory.  We'll need
    to add the intervening layers.  I haven't done this yet since to fix the
    Xcode test failure correspondence, I may need to add a python layer which
    might just handle the directory crawling.
* Added an Xcode project to the lldb workspace for gtest.
  - Runs the recursive make system in gtest/Makefile.
  - Default target is 'test'.  test and clean are supported.
  - Currently does not support test failure file/line correspondence.
    Requires a bit of text transformation to hook that up.

llvm-svn: 218460
2014-09-25 19:25:07 +00:00