diff --git a/ShowBuildMenu.bat b/ShowBuildMenu.bat index dc4423e517f..f455d08db4d 100644 --- a/ShowBuildMenu.bat +++ b/ShowBuildMenu.bat @@ -12,7 +12,7 @@ echo ========================= NHIBERNATE BUILD MENU ========================== echo --- TESTING --- echo B. (Step 1) Set up a new test configuration for a particular database. echo C. (Step 2) Activate a test configuration. -echo D. (Step 3) Run tests using active configuration. +echo D. (Step 3) Run tests using active configuration (Needs built in Visual Studio). echo. echo --- BUILD --- echo E. Build NHibernate (Debug) @@ -165,7 +165,9 @@ echo Configuration activated. goto main-menu :test-run -start "nunit3-console" cmd /K %NUNIT% --x86 --agents=1 --process=separate NHibernate.nunit +SET NUNITPLATFORM= +IF /I "%PLATFORM%" NEQ "x64" set NUNITPLATFORM=--x86 +start "nunit3-console" cmd /K %NUNIT% %NUNITPLATFORM% --agents=1 --process=separate NHibernate.nunit goto main-menu rem :build-test diff --git a/default.build b/default.build index 0b5e9695714..9f38e2ad55e 100644 --- a/default.build +++ b/default.build @@ -198,19 +198,19 @@ - - - - - - + + + + + + - - + + - - + + @@ -241,65 +241,65 @@ - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NHibernate.Everything.sln b/src/NHibernate.Everything.sln index f139ae39166..234a401f88f 100644 --- a/src/NHibernate.Everything.sln +++ b/src/NHibernate.Everything.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26730.3 +VisualStudioVersion = 15.0.26730.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Support", "Support", "{9BDB5C84-14EC-4384-B423-9E319675B3CA}" ProjectSection(SolutionItems) = preProject @@ -73,6 +73,8 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "NHibernate.Test.VisualBasic EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.Example.Web", "NHibernate.Example.Web\NHibernate.Example.Web.csproj", "{B291C1C1-599B-418E-8591-8A8CF1CAA188}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.TestDatabaseSetup", "NHibernate.TestDatabaseSetup\NHibernate.TestDatabaseSetup.csproj", "{783DB85E-2EED-4377-8EF4-8D6EFE042007}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -144,6 +146,18 @@ Global {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Any CPU.Build.0 = Release|Any CPU {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|.NET.ActiveCfg = Debug|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|.NET.Build.0 = Debug|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Any CPU.Build.0 = Debug|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|.NET.ActiveCfg = Release|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|.NET.Build.0 = Release|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Any CPU.ActiveCfg = Release|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Any CPU.Build.0 = Release|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -159,6 +173,7 @@ Global {7AEE5B37-C552-4E59-9B6F-88755BCB5070} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD} {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D} = {92509065-DAEA-4457-8300-C7B64CD0E9F4} {7C2EF610-BCA0-4D1F-898A-DE9908E4970C} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD} + {783DB85E-2EED-4377-8EF4-8D6EFE042007} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A41913C2-EDEB-440A-BBDE-0AEB56C1CBA6} diff --git a/src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs b/src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs index 0a0487be2d1..da65cecaf2c 100644 --- a/src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs +++ b/src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs @@ -23,7 +23,7 @@ public PeVerifier(string assemblyFileName) var dir = Path.GetDirectoryName(_assemlyLocation); - while (!Directory.Exists(Path.Combine(dir, "Tools/PEVerify"))) + while (!Directory.Exists(Path.Combine(dir, "Tools", "PEVerify"))) { if (Directory.GetParent(dir) == null) throw new Exception(string.Format("Could not find Tools/PEVerify directory in ancestor of {0}", _assemlyLocation)); @@ -35,7 +35,7 @@ public PeVerifier(string assemblyFileName) if (Environment.Version.Major == 2) versionFolder = "3.5"; - _peVerifyPath = Path.Combine(dir, "Tools/PEVerify/" + versionFolder + "/PEVerify.exe"); + _peVerifyPath = Path.Combine(dir, "Tools", "PEVerify", versionFolder, "PEVerify.exe"); if (!File.Exists(_peVerifyPath)) throw new Exception(string.Format("Could not find PEVerify.exe at {0}", _peVerifyPath)); diff --git a/src/NHibernate.Test/NHSpecificTest/Logs/LogsFixture.cs b/src/NHibernate.Test/NHSpecificTest/Logs/LogsFixture.cs index 2ffc692763b..a64c0093345 100644 --- a/src/NHibernate.Test/NHSpecificTest/Logs/LogsFixture.cs +++ b/src/NHibernate.Test/NHSpecificTest/Logs/LogsFixture.cs @@ -40,7 +40,7 @@ public void WillGetSessionIdFromSessionLogs() s.Get(1);//will execute some sql - var loggingEvent = spy.Events[0]; + var loggingEvent = spy.GetWholeLog(); Assert.That(loggingEvent.Contains(sessionId.ToString()), Is.True); } } @@ -78,12 +78,9 @@ public TextLogSpy(string loggerName, string pattern) loggerImpl.Level = Level.All; } - public string[] Events + public string GetWholeLog() { - get - { - return stringBuilder.ToString().Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries); - } + return stringBuilder.ToString(); } public void Dispose() diff --git a/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs b/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs index ba8bbc42c41..7e1c090559e 100644 --- a/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs +++ b/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs @@ -1,7 +1,6 @@ using System; using System.Collections; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; +using System.Runtime.CompilerServices; using NHibernate.Util; using NUnit.Framework; @@ -11,11 +10,30 @@ namespace NHibernate.Test.UtilityTest [TestFixture] public class WeakHashtableFixture { - protected WeakHashtable Create() + private static WeakHashtable Create() { return new WeakHashtable(); } + // NoInlining to keep temporary variables' lifetime from being extended. + [MethodImpl(MethodImplOptions.NoInlining)] + private static WeakHashtable CreateWithTwoObjects() + { + var table = Create(); + + table[new object()] = new object(); + table[new object()] = new object(); + + return table; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static WeakRefWrapper CreateWeakRefWrapper() + { + object obj = new object(); + return new WeakRefWrapper(obj); + } + [Test] public void Basic() { @@ -33,10 +51,8 @@ public void Basic() [Test] public void WeakReferenceGetsFreedButHashCodeRemainsConstant() { - object obj = new object(); - WeakRefWrapper wr = new WeakRefWrapper(obj); + WeakRefWrapper wr = CreateWeakRefWrapper(); int hashCode = wr.GetHashCode(); - obj = null; GC.Collect(); @@ -48,10 +64,7 @@ public void WeakReferenceGetsFreedButHashCodeRemainsConstant() [Test] public void Scavenging() { - WeakHashtable table = Create(); - - table[new object()] = new object(); - table[new object()] = new object(); + WeakHashtable table = CreateWithTwoObjects(); GC.Collect(); table.Scavenge(); @@ -62,10 +75,7 @@ public void Scavenging() [Test] public void IterationAfterGC() { - WeakHashtable table = Create(); - - table[new object()] = new object(); - table[new object()] = new object(); + WeakHashtable table = CreateWithTwoObjects(); GC.Collect(); diff --git a/src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs b/src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs index 1723bd5ca30..8ed0c9f55db 100644 --- a/src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs +++ b/src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs @@ -116,17 +116,21 @@ private static void SetupFirebird(Cfg.Configuration cfg) private static void SetupSqlServerCe(Cfg.Configuration cfg) { + var connStr = cfg.Properties[Cfg.Environment.ConnectionString]; + try { - if (File.Exists("NHibernate.sdf")) - File.Delete("NHibernate.sdf"); + var connStrBuilder = new SqlCeConnectionStringBuilder(connStr); + var dataSource = connStrBuilder.DataSource; + if (File.Exists(dataSource)) + File.Delete(dataSource); } catch (Exception e) { Console.WriteLine(e); } - using (var en = new SqlCeEngine("DataSource=\"NHibernate.sdf\"")) + using (var en = new SqlCeEngine(connStr)) { en.CreateDatabase(); } diff --git a/src/NHibernate/NHibernate.build b/src/NHibernate/NHibernate.build index 031ee0f976a..cd401255f64 100644 --- a/src/NHibernate/NHibernate.build +++ b/src/NHibernate/NHibernate.build @@ -1,14 +1,14 @@ - + @@ -19,7 +19,7 @@ - + @@ -37,7 +37,7 @@ - +