From e02828877e93d681b9b5f9b878eb461503d877e8 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Wed, 8 Mar 2017 12:29:00 -0500 Subject: [PATCH] [mono/tests] Make w32message.cs a normal test-runner test Use exit codes to communicate success/failure like other test-runner tests. Get rid of custom build rules. --- mono/tests/Makefile.am | 30 +++++++++++------------------- mono/tests/w32message.cs | 21 ++++++++++++--------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 65001ba9d0d..7bbddfbc6af 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -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: diff --git a/mono/tests/w32message.cs b/mono/tests/w32message.cs index 5ff5d3a1e72..cacfa691420 100644 --- a/mono/tests/w32message.cs +++ b/mono/tests/w32message.cs @@ -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 +} -- 2.25.1