diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2017-03-08 14:48:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-08 14:48:28 +0300 |
commit | 2c9e4379c9dd433375bb9bd9fc3aa4cf65f37a03 (patch) | |
tree | 0db8d8fa9e99d6a019d074e0d4ea4b43608b34e1 /mcs/class/System.Windows.Forms | |
parent | ed12a1d4da5c8a6224e2e25bb6b57e45e822352c (diff) |
[ci] Check if X server is available before running WinForms tests (#4477)
This should hopefully "fix" the mass fails in the WinForms
tests we sometimes see in CI.
We're using the simplest WinForms code that invokes the XplatUI
and causes the X connection to be established, if this fails
then something is seriously wrong and we skip the WinForms tests.
Diffstat (limited to 'mcs/class/System.Windows.Forms')
-rw-r--r-- | mcs/class/System.Windows.Forms/Makefile | 7 | ||||
-rw-r--r-- | mcs/class/System.Windows.Forms/Test/simple/Program.cs | 39 |
2 files changed, 46 insertions, 0 deletions
diff --git a/mcs/class/System.Windows.Forms/Makefile b/mcs/class/System.Windows.Forms/Makefile index 06eacbcbcf7..0e4fb4ef46d 100644 --- a/mcs/class/System.Windows.Forms/Makefile +++ b/mcs/class/System.Windows.Forms/Makefile @@ -89,6 +89,7 @@ TEST_DISTFILES = \ Test/System.Resources/compat_1_1.resx \ Test/System.Resources/compat_2_0.resx \ Test/System.Windows.Forms/bitmaps/a.png \ + Test/simple/Program.cs \ Test/DummyAssembly/AnotherSerializable.cs \ Test/DummyAssembly/Convertable.cs \ Test/DummyAssembly/Properties/AssemblyInfo.cs \ @@ -127,3 +128,9 @@ $(PREBUILT): %.prebuilt: % cp $* $@ dist-default: $(PREBUILT) + +simple-test.exe: Test/simple/Program.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll + $(CSCOMPILE) -out:$@ Test/simple/Program.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll + +test-simple: simple-test.exe + $(TEST_RUNTIME) simple-test.exe diff --git a/mcs/class/System.Windows.Forms/Test/simple/Program.cs b/mcs/class/System.Windows.Forms/Test/simple/Program.cs new file mode 100644 index 00000000000..a2ff1d1752c --- /dev/null +++ b/mcs/class/System.Windows.Forms/Test/simple/Program.cs @@ -0,0 +1,39 @@ +// +// Program.cs +// +// Author: +// Alexander Köplinger (alexander.koeplinger@xamarin.com) +// +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace SimpleTest { + public static class Program { + public static int Main () + { + // use the simplest WinForms code that invokes the XplatUI + // and causes the X connection to be established, if this fails + // then something is seriously wrong + System.Windows.Forms.Application.Idle += null; + return 0; + } + } +}
\ No newline at end of file |