Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] Use correct test result for adb hosts (#1365)
Certain deployment targets require us to fix up an external storage path before we can pull it via adb (see `ToAdbPath()` comments for more details). We should only attempt to fix up this path *after* writing our test result, as our application context will not recognize it as a valid file path. Fixes the following error: Error: System.IO.DirectoryNotFoundException: Could not find a part of the path "/mnt/shell/emulated/0/Android/data/Xamarin.Android.Bcl_Tests/files/Documents/TestResults.xUnit.xml". at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00177] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/corlib/System.IO/FileStream.cs:223 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/corlib/System.IO/FileStream.cs:106 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean useAsync) [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/corlib/System.IO/FileStream.cs:101 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool) at System.Xml.XmlWriterSettings.CreateWriter (System.String outputFileName) [0x00051] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlWriterSettings.cs:464 at System.Xml.XmlWriter.Create (System.String outputFileName, System.Xml.XmlWriterSettings settings) [0x0000a] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlWriter.cs:610 at Xamarin.Android.UnitTests.XUnit.XUnitTestRunner.WriteResultsToFile () at Xamarin.Android.UnitTests.TestInstrumentation`1[TRunner].RunTests (Android.OS.Bundle& results) at Xamarin.Android.UnitTests.TestInstrumentation`1[TRunner].OnStart () UNHANDLED EXCEPTION: Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown. at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152 at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <1c16e67a812b475a9ae6b6e26eed9097>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0005d] in <1c16e67a812b475a9ae6b6e26eed9097>:0 at Android.App.Instrumentation.Finish (Android.App.Result resultCode, Android.OS.Bundle results) [0x0003a] in /Users/builder/data/lanes/5945/28b08da2/source/monodroid/external/xamarin-android/src/Mono.Android/obj/Release/android-27/mcw/Android.App.Instrumentation.cs:1366 at Xamarin.Android.UnitTests.TestInstrumentation`1[TRunner].OnStart () at Android.App.Instrumentation.n_OnStart (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in /Users/builder/data/lanes/5945/28b08da2/source/monodroid/external/xamarin-android/src/Mono.Android/obj/Release/android-27/mcw/Android.App.Instrumentation.cs:1729 at (wrapper dynamic-method) System.Object.60d1c0b0-3a21-410a-9b3a-12e201b965fe(intptr,intptr) --- End of managed Java.Lang.NullPointerException stack trace --- java.lang.NullPointerException at android.app.Instrumentation.finish(Instrumentation.java:213) at md58bfc2187967f55be2f50e366b0d6b91f.TestInstrumentation_1.n_onStart(Native Method) at md58bfc2187967f55be2f50e366b0d6b91f.TestInstrumentation_1.onStart(TestInstrumentation_1.java:35) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1792)
- Loading branch information