From a9c402ffdac727da165baf086d31f88e4f7aed27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 21 Mar 2017 13:04:19 +0100 Subject: [PATCH] [System.Web] Fix standalone-runner to return non-zero exit code on failure (#4562) * [System.Web] Fix standalone-runner to return non-zero exit code on failure We didn't notice that test runs with standalone-runner.exe failed because it still exited with 0 in those cases. Fixed that and the standalone tests that showed up as failed in System.Web.Extensions (some differences likely from referencesource code import). * Fix replacement logic for Consts.cs.in to use Windows paths --- mcs/class/System.Web.Extensions/Makefile | 4 ++++ .../Test/standalone-tests/.gitignore | 1 + .../DataPager_NumericPagerField_Bug615315.cs | 10 +++++----- mcs/class/System.Web/Test/tools/standalone-runner.cs | 9 +++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore diff --git a/mcs/class/System.Web.Extensions/Makefile b/mcs/class/System.Web.Extensions/Makefile index 5d3f278247e..dc21bcf31c1 100644 --- a/mcs/class/System.Web.Extensions/Makefile +++ b/mcs/class/System.Web.Extensions/Makefile @@ -86,7 +86,11 @@ $(STANDALONE_TEST_ASSEMBLY): $(the_assembly) Test/standalone-tests/Consts.cs $(CSCOMPILE) $(STANDALONE_TEST_MCS_FLAGS) -out:$@ -target:library @System.Web.Extensions_standalone_test.dll.sources Test/standalone-tests/Consts.cs: Test/standalone-tests/Consts.cs.in +ifeq ($(PLATFORM), win32) + @sed 's,@SystemWebExtensionsClassDir@,$(shell cygpath -a -m .),' $< > $@ +else @sed 's,@SystemWebExtensionsClassDir@,$(shell pwd),' $< > $@ +endif include ../../build/library.make diff --git a/mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore b/mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore new file mode 100644 index 00000000000..e610081c9b9 --- /dev/null +++ b/mcs/class/System.Web.Extensions/Test/standalone-tests/.gitignore @@ -0,0 +1 @@ +/Consts.cs diff --git a/mcs/class/System.Web.Extensions/Test/standalone-tests/DataPager_NumericPagerField_Bug615315.cs b/mcs/class/System.Web.Extensions/Test/standalone-tests/DataPager_NumericPagerField_Bug615315.cs index ab36ccf501d..2e8a8b33a88 100644 --- a/mcs/class/System.Web.Extensions/Test/standalone-tests/DataPager_NumericPagerField_Bug615315.cs +++ b/mcs/class/System.Web.Extensions/Test/standalone-tests/DataPager_NumericPagerField_Bug615315.cs @@ -57,7 +57,7 @@ namespace StandAloneTests.DataPager_NumericPagerField_Bug615315 void TestQueryMode_Aspx_Start (string result, TestRunItem runItem) { - string originalHtml = @"First 1 2 3 4 5  ... Last "; + string originalHtml = @"First 1 2 3 4 5  ... Last "; Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1"); } @@ -127,25 +127,25 @@ namespace StandAloneTests.DataPager_NumericPagerField_Bug615315 void TestPostBackMode_Aspx_Start (string result, TestRunItem runItem) { - string originalHtml = @" 1 2 3 4 5  ...  "; + string originalHtml = @" 1 2 3 4 5  ...  "; Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1"); } void TestPostBackMode_Aspx_Page2 (string result, TestRunItem runItem) { - string originalHtml = @" 1 2 3 4 5  ...  "; + string originalHtml = @" 1 2 3 4 5  ...  "; Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1"); } void TestPostBackMode_Aspx_PageNext (string result, TestRunItem runItem) { - string originalHtml = @" ... 6 7 8 9 10  "; + string originalHtml = @" ... 6 7 8 9 10  "; Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1"); } void TestPostBackMode_Aspx_PagePrev (string result, TestRunItem runItem) { - string originalHtml = @" 1 2 3 4 5  ...  "; + string originalHtml = @" 1 2 3 4 5  ...  "; Helpers.ExtractAndCompareCodeFromHtml (result, originalHtml, "#A1"); } } diff --git a/mcs/class/System.Web/Test/tools/standalone-runner.cs b/mcs/class/System.Web/Test/tools/standalone-runner.cs index d3de8243332..e8f05421b5f 100644 --- a/mcs/class/System.Web/Test/tools/standalone-runner.cs +++ b/mcs/class/System.Web/Test/tools/standalone-runner.cs @@ -73,13 +73,16 @@ namespace StandAloneRunner static void Main (string[] args) { try { - Run (args); + var success = Run (args); + + if (!success) + Environment.Exit (1); } catch (Exception ex) { Die ("Exception caught:{0}{1}", Environment.NewLine, ex.ToString ()); } } - static void Run (string[] args) + static bool Run (string[] args) { bool showHelp = false; string testName = null; @@ -177,6 +180,8 @@ namespace StandAloneRunner writer.Dispose (); } } + + return failedCounter == 0; } static string FormatReport (StandaloneTest test) -- 2.25.1