From a9a54f42d6161d791ab8e966b376434a84307fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 17 Sep 2019 17:11:49 +0200 Subject: [PATCH] [corlib] Fix building nunit-lite twice We sometimes saw the following build error in Mono SDKs builds on Jenkins: ``` [2019-09-16T01:03:30.709Z] CSC [xammac] nunit-lite-console.exe [2019-09-16T01:03:30.709Z] error CS0009: Metadata file '/Users/builder/jenkins/workspace/archive-mono/2019-08/mac/release/mcs/class/lib/xammac/nunitlite.dll' could not be opened -- PE image doesn't contain managed metadata. ``` Taking a closer look we found out that nunit-lite was trying to be built twice for the same profile which caused a race where the file was corrupted. The reason for this is that the corlib Makefile defines two test assemblies: the normal PROFILE_corlib_test.dll and BinarySerializationOverVersionsTest.dll and integrating the BinarySerializationOverVersionsTest.dll via the `test-vts` target incorrectly overwrote the `test` target instead of using `test-local`. --- mcs/build/tests.make | 4 +--- mcs/class/corlib/Makefile | 9 +++------ mcs/tools/Makefile | 2 ++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/mcs/build/tests.make b/mcs/build/tests.make index de0fbb44b396..3e9e75c16266 100644 --- a/mcs/build/tests.make +++ b/mcs/build/tests.make @@ -128,7 +128,7 @@ $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp @if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi $(topdir)/build/deps/nunit-$(PROFILE).stamp: - cd ${topdir}/tools/nunit-lite && $(MAKE) + $(MAKE) -C ${topdir}/tools/nunit-lite echo "stamp" >$@ tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp @@ -378,5 +378,3 @@ $(xtest_makefrag): $(xtest_response) endif - -.PHONY: patch-nunitlite-appconfig diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index c5d6a51c0fd3..02fa5ff974f6 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -232,7 +232,7 @@ TEST_RESOURCES = $(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE) satellite_assembly1 = $(test_lib_dir)/es-ES/$(patsubst %.dll,%.resources.dll,$(test_lib)) satellite_assembly2 = $(test_lib_dir)/nn-NO/$(patsubst %.dll,%.resources.dll,$(test_lib)) -$(test_lib_output): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) $(test_lib_dir) +$(test_lib_output): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) | $(test_lib_dir) mscorlib_for_profile = $(topdir)/class/lib/$(PROFILE)/mscorlib.dll @@ -298,11 +298,8 @@ NO_VTS_TEST = yes endif ifndef NO_VTS_TEST -test: test-vts -run-test: run-test-vts -else -test: -run-test: +test-local: test-vts +run-test-local: run-test-vts endif EXTRA_DISTFILES += \ diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index c632a8bf3884..1cbb43420a15 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -60,6 +60,8 @@ monotouch_tv_SUBDIRS = nunit-lite monotouch_watch_SUBDIRS = nunit-lite monotouch_tools_SUBDIRS = monotouch_tools_PARALLEL_SUBDIRS = corcompare mono-api-html +xammac_SUBDIRS = nunit-lite +xammac_net_4_5_SUBDIRS = nunit-lite net_4_x_SUBDIRS = net_4_x_PARALLEL_SUBDIRS = $(net_4_5_dirs) wasm_tools_SUBDIRS =