Граф коммитов

18 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 55837e3d80
[xharness] Handle Process.HasExited throwing exceptions. (#5239)
Apparently Process.HasExited may throw exceptions, so handle those gracefully
(by ignoring them completely):

    Unhandled Exception:
     System.AggregateException: One or more errors occurred. (No process is associated with this object.) ---> System.InvalidOperationException: No process is associated with this object.
       at System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) [0x00018] in <d012d9eca6d14975a47488863de2f4c6>:0
       at System.Diagnostics.Process.get_HasExited () [0x0000b] in <d012d9eca6d14975a47488863de2f4c6>:0
       at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.get_HasExited()
       at xharness.Process_Extensions+<>c__DisplayClass2_0.<RunAsync>b__2 () [0x00001] in <285dbdcf9e034cd496a3fef953fac640>:0
       at System.Threading.CancellationToken.ActionToActionObjShunt (System.Object obj) [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationCallbackInfo.ExecutionContextCallback (System.Object obj) [0x00007] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationCallbackInfo.ExecuteCallback () [0x00024] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.CancellationCallbackCoreWork (System.Threading.CancellationCallbackCoreWorkArguments args) [0x00042] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers (System.Boolean throwOnFirstException) [0x000c0] in <96207d0baa204f48a53ad6be05f5ecba>:0
        --- End of inner exception stack trace ---
       at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers (System.Boolean throwOnFirstException) [0x00132] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.NotifyCancellation (System.Boolean throwOnFirstException) [0x0005f] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.Cancel (System.Boolean throwOnFirstException) [0x00006] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.Cancel () [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at xharness.AppRunner+<>c__DisplayClass73_0.<RunAsync>b__0 (System.Object v) [0x00029] in <285dbdcf9e034cd496a3fef953fac640>:0
       at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
     ---> (Inner Exception #0) System.InvalidOperationException: No process is associated with this object.
       at System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) [0x00018] in <d012d9eca6d14975a47488863de2f4c6>:0
       at System.Diagnostics.Process.get_HasExited () [0x0000b] in <d012d9eca6d14975a47488863de2f4c6>:0
       at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.get_HasExited()
       at xharness.Process_Extensions+<>c__DisplayClass2_0.<RunAsync>b__2 () [0x00001] in <285dbdcf9e034cd496a3fef953fac640>:0
       at System.Threading.CancellationToken.ActionToActionObjShunt (System.Object obj) [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationCallbackInfo.ExecutionContextCallback (System.Object obj) [0x00007] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationCallbackInfo.ExecuteCallback () [0x00024] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.CancellationCallbackCoreWork (System.Threading.CancellationCallbackCoreWorkArguments args) [0x00042] in <96207d0baa204f48a53ad6be05f5ecba>:0
       at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers (System.Boolean throwOnFirstException) [0x000c0] in <96207d0baa204f48a53ad6be05f5ecba>:0 <---
2018-12-07 15:07:21 +01:00
Rolf Bjarne Kvinge 544925738d
[xharness] Implement Process.WaitForExitAsync and use it instead of creating background threads. (#5207)
Using fewer threads is always good.
2018-11-30 16:49:03 +01:00
Rolf Bjarne Kvinge 8a81607279
[xharness] No need to spawn to kill, when we can just P/Invoke the corresponding function. (#5199)
* [xharness] No need to spawn to kill, when we can just P/Invoke the corresponding function.

* Revert accidental changes.
2018-11-29 19:36:04 +01:00
Rolf Bjarne Kvinge ae13240b20
[xharness] Don't recursively print diagnostics for processes when printing diagnostics times out in the first place. Fixes maccore#1163. (#5198)
Recursively printing diagnostics can leave us with _many_ lldb processes, each
pretty much hanging, and the system overloaded, which, in the worst case
scenario, would require a hard reboot.

Most commonly the "only" thing that happens is an OutOfMemoryException when
the OS eventually tells xharness NO to launching new processes.

Fixes https://github.com/xamarin/maccore/issues/1163.
2018-11-29 16:33:57 +01:00
Rolf Bjarne Kvinge fc9b799b86
[xharness] Improve logging of launched processes to not log the same information twice. (#4061)
Also log any added/changed/removed environment variables for launched
processes (compared to xharness itself).
2018-05-10 07:43:44 +02:00
Rolf Bjarne Kvinge f23bd79eff [xharness] Timestamp install logs. (#2825)
* [xharness] Simplify code a bit.

Logs are TextWriters by themselves, so no need to get a StreamWriter to pass
to API that takes TextWriter, when we can just pass the log instance itself.

This makes it possible to timestamp external process output (because
Log.Timestamp is honored instead of bypassed).

* [xharness] Timestamp install logs.

So that we get exact numbers of how long it takes to install on watch (and if
the watch installation stalls, or just times out because it takes too long).
2017-10-02 17:36:41 +02:00
Rolf Bjarne Kvinge 622af84e72 [xharness] Always wait for processes to exit, even if they're killed. Fixes #57846. (#2823)
Always wait for processes to exit, even if they're killed.

Also make absolutely sure that we can safely handle any exception when getting
the ExitCode, no matter what.

https://bugzilla.xamarin.com/show_bug.cgi?id=57846
2017-10-02 12:06:57 +02:00
Sebastien Pouliot 05eb96d0a7 Merge branch 'xcode9' into xcode9-master-merge 2017-09-15 11:05:30 -04:00
Rolf Bjarne Kvinge 433a77f441 [xharness] Don't show verbose diagnostics when killing the device log capture process. (#2282)
Killing this process is normal, so no diagnostics is needed (it only ends up
confusing because it looks like something crashed or timed out).
2017-07-03 07:14:00 +02:00
Timothy Risi 25468bf617 Merge Quote methods into a single class instead of multiple versions (#2153) 2017-06-06 12:32:25 -08:00
Rolf Bjarne Kvinge d672fbf9dd [xharness] Don't wait forever for output streams to end. (#2122)
Sometimes streams won't write null when done, which means that if we wait
indefinitely for this to happen, we'll effectively deadlock.

Instead have a 1s timeout, after which we consider that we've captured
everything we need.

Example: https://jenkins.mono-project.com/job/xamarin-macios-pr-builder/3771/Test_Report/
(the test run hangs waiting for the mtouch tests, which finished pretty much instantly).
2017-05-24 21:04:18 +02:00
Rolf Bjarne Kvinge fe8b6916f0 [xharness] Show better info in process list. (#1365) 2016-12-19 15:18:07 +01:00
Rolf Bjarne Kvinge 1f81e38a1f [jenkins] Try to show a backtrace for processes that time out. (#1358) 2016-12-16 12:24:08 +01:00
Rolf Bjarne Kvinge 15b25359c6 [xharness] Determine additional tests to run based on the modified files in a pull request. (#1166)
Example log output when bumping mono:

> Found 1 modified file(s) in the pull request #1161.
>     external/mono
> Enabled 'mtouch' tests because the modified file 'external/mono' matches prefix 'external/mono'
> Enabled 'mmp' tests because the modified file 'external/mono' matches prefix 'external/mono'
> Enabled 'bcl' tests because the modified file 'external/mono' matches prefix 'external/mono'
> Found 1 label(s) in the pull request #1161: cla-already-signed

Or when changing the static registrar:

> Found 1 modified file(s) in the pull request #1164.
>     tools/common/StaticRegistrar.cs
> Enabled 'mtouch' tests because the modified file 'tools/common/StaticRegistrar.cs' matches prefix 'tools/common'
> Enabled 'mmp' tests because the modified file 'tools/common/StaticRegistrar.cs' matches prefix 'tools/common'
> Found 2 label(s) in the pull request #1164: cla-already-signed, run-mmp-tests
> Enabled 'mmp' tests because the label 'run-mmp-tests' is set.
2016-11-14 10:43:35 +01:00
Rolf Bjarne Kvinge 85d94face2 [xharness] Improve logging.
Make sure as much as possible is written to the logs, and not stdout.

Also copy an extra 1024 bytes when fetching the system log (and continue
capturing a while after stopped, since there may be unflushed system log
data in memory).
2016-06-28 13:04:52 +02:00
Rolf Bjarne Kvinge c355cf91be [xharness] Refactor how we do simulator configuration.
Split out the code to prepare the simulator from the AppRunner class,
which is now just handling the logic required for each test run.

This way it's easier to handle simulator preparation for multiple
test runs with the same simulator.

Also revamp logging to avoid printing directly to the console, but
instead use the logging classes that permit redirecting logging
to a file. This makes the html report show better logging.
2016-06-28 13:04:47 +02:00
Rolf Bjarne Kvinge d9bf0e1728 [xharness] Add support for building and running mac tests on jenkins. 2016-06-15 10:51:14 -07:00
Rolf Bjarne Kvinge d135612f59 [tests] Implement support in xharness for running the simulator tests grouped by simulator, and write out an html report. 2016-06-15 10:51:14 -07:00