[mono/tests] Make w32message.cs a normal test-runner test
authorAleksey Kliger <aleksey@xamarin.com>
Wed, 8 Mar 2017 17:29:00 +0000 (12:29 -0500)
committerAleksey Kliger <aleksey@xamarin.com>
Tue, 14 Mar 2017 15:39:04 +0000 (11:39 -0400)
Use exit codes to communicate success/failure like other test-runner tests.
Get rid of custom build rules.

mono/tests/Makefile.am
mono/tests/w32message.cs

index 65001ba9d0dede8243f3fd9baefeb4c2369c67d9..7bbddfbc6aff411afc78ae4e6788b7799ed6090c 100644 (file)
@@ -7,7 +7,7 @@ FEATUREFUL_RUNTIME_TEST = test-appdomain-unload
 endif
 
 check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-multi-netmodule test-cattr-type-load test-reflection-load-with-context test_platform        \
-                test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress test-pedump rm-empty-logs
+                test-console-output test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress test-pedump rm-empty-logs
 check-full: test-sgen check-local
 check-parallel: compile-tests check-full
 
@@ -481,7 +481,8 @@ BASE_TEST_CS_SRC=           \
        thread6.cs      \
        appdomain-threadpool-unload.cs  \
        process-unref-race.cs   \
-       bug-46661.cs
+       bug-46661.cs    \
+       w32message.cs
 
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
@@ -580,6 +581,11 @@ TEST_IL_SRC=                       \
 if AMD64
 # #651684
 PLATFORM_DISABLED_TESTS = finally_guard.exe
+
+if HOST_WIN32
+PLATFORM_DISABLED_TESTS += w32message.exe
+endif
+
 endif
 
 if IA64
@@ -592,7 +598,7 @@ if X86
 
 if HOST_WIN32
 PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
-       bug-18026.exe monitor.exe threadpool-exceptions5.exe process-unref-race.exe
+       bug-18026.exe monitor.exe threadpool-exceptions5.exe process-unref-race.exe w32message.exe
 endif
 
 endif
@@ -643,6 +649,8 @@ PLATFORM_DISABLED_TESTS= abort-stress-1.exe \
                          threadpool-exceptions5.exe \
                          threadpool-exceptions6.exe
 
+PLATFORM_DISABLED_TESTS+= w32message.exe
+
 # Tests that rely on AppDomain.Unload
 PLATFORM_DISABLED_TESTS+= appdomain-async-invoke.exe \
                           appdomain-exit.exe \
@@ -1188,22 +1196,6 @@ test-eglib-remap:
        @if which nm > /dev/null; then if nm $(top_builddir)/mono/mini/mono | grep -v $(OK_G_SYMBOLS) | grep 't g_'; then exit 1; else exit 0; fi; fi
 endif
 
-#
-# Tests that the internals in mono/io-layer/messages.c are ok by triggering the 
-# code that checks that the table is properly sorted
-#
-if NACL_CODEGEN
-test-messages:
-else
-if HOST_WIN32
-test-messages:
-else
-test-messages: w32message.exe
-       > test_messages.zero
-       $(with_mono_path) $(JITTEST_PROG_RUN) w32message.exe > w32message.allout 2>&1 && cmp test_messages.zero w32message.allout
-endif
-endif
-
 test-env-options:
        MONO_ENV_OPTIONS="--version" $(RUNTIME) array-init.exe | grep -q Architecture:
 
index 5ff5d3a1e727fe7cb697368fc1b98ef4e510cbb1..cacfa691420864741284489786e263d82fa93501 100644 (file)
@@ -2,9 +2,6 @@
 // This test merely creates a Win32Exception that triggers the
 // code in mono/io-layer/message.c that validates that the
 // error table is propertly sorted
-//
-// If there is output on stderr, we have an error
-//
 using System;
 using System.ComponentModel;
 
@@ -14,13 +11,16 @@ class X {
                return new Win32Exception (c).Message;
        }
 
-       static void check (int c, string s)
+       static bool check (int c, string s)
        {
-               if (msg (c) != s)
-                       Console.WriteLine ("For {0} expected {1} got {2}", c, s, msg (c));
+               if (msg (c) != s) {
+                       Console.Error.WriteLine ("For {0} expected {1} got {2}", c, s, msg (c));
+                       return false;
+               }
+               return true;
        }
        
-       static void Main ()
+       static int Main ()
        {
                //
                // All this test does is instantiate two Win32Exceptions
@@ -33,8 +33,11 @@ class X {
                Exception a = new Win32Exception (99999);
                a = new Win32Exception (9805);
 
-               check (2, "Cannot find the specified file");
+               if (!check (2, "Cannot find the specified file"))
+                       return 1;
+
 
+               return 0;
        }
        
-}
\ No newline at end of file
+}