Skip to content

Commit

Permalink
Merge pull request #695 from ngbrown/misc
Browse files Browse the repository at this point in the history
Miscellaneous fixes
  • Loading branch information
hazzik committed Sep 20, 2017
2 parents c8f1ce8 + 55dc320 commit 35bb01c
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 103 deletions.
6 changes: 4 additions & 2 deletions ShowBuildMenu.bat
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
138 changes: 69 additions & 69 deletions default.build
Expand Up @@ -198,19 +198,19 @@
<!-- Tests -->
<copy file="${bin.dir}/TestEmbeddedConfig.cfg.xml" todir="${bin-pack.tests}"/>
<copy file="${bin.dir}/ABC.hbm.xml" todir="${bin-pack.tests}"/>
<copy todir="${bin-pack.tests}/DbScripts">
<fileset basedir="${root.dir}/src/NHibernate.Test/DbScripts">
<include name="*.sql" />
</fileset>
</copy>
<copy todir="${bin-pack.tests}">
<copy todir="${bin-pack.tests}/DbScripts">
<fileset basedir="${root.dir}/src/NHibernate.Test/DbScripts">
<include name="*.sql" />
</fileset>
</copy>
<copy todir="${bin-pack.tests}">
<fileset basedir="${bin.dir}">
<include name="nunit*" />
<include name="SharpTestsEx*" />
<include name="NHibernate.Domain*" />
<include name="SharpTestsEx*" />
<include name="NHibernate.Domain*" />
<include name="NHibernate.Test*" />
<include name="log4net*" />
</fileset>
<include name="log4net*" />
</fileset>
</copy>
</target>

Expand Down Expand Up @@ -241,65 +241,65 @@

</target>

<fileset id="nugetfiles.all" basedir="src">
<include name="NHibernate/NHibernate.build" />
</fileset>

<target name="nuspec" depends="init nuget.set-properties" description="Create nuspec files">
<nant target="nuspec">
<buildfiles refid="nugetfiles.all" />
</nant>
</target>
<target name="nuget" depends="init binaries nuget.set-properties nuspec"
description="Creates files for the release on nuget gallery.">
<fileset id="nugetfiles.all" basedir="src">
<include name="NHibernate/NHibernate.build" />
</fileset>

<target name="nuspec" depends="init nuget.set-properties" description="Create nuspec files">
<nant target="nuspec">
<buildfiles refid="nugetfiles.all" />
</nant>
</target>
<target name="nuget" depends="init binaries nuget.set-properties nuspec"
description="Creates files for the release on nuget gallery.">

<nant target="nuget">
<buildfiles refid="nugetfiles.all" />
</nant>

<mkdir dir="${nuget.nupackages.dir}" />
<move todir="${nuget.nupackages.dir}">
<fileset basedir="${nuget.workingdir}">
<include name="*.nupkg" />
</fileset>
</move>
</target>
<target name="nugetpushbat" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
description="Creates files for the release on nuget gallery.">

<copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/>

<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<echo message="nuget push ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
</target>
<target name="nugetpush" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
description="Push packages on nuget gallery.">
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe">
<arg value="push" />
<arg value="${filename}" />
</exec>
</do>
</foreach>
</target>
<nant target="nuget">
<buildfiles refid="nugetfiles.all" />
</nant>

<mkdir dir="${nuget.nupackages.dir}" />
<move todir="${nuget.nupackages.dir}">
<fileset basedir="${nuget.workingdir}">
<include name="*.nupkg" />
</fileset>
</move>
</target>
<target name="nugetpushbat" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
description="Creates files for the release on nuget gallery.">

<copy file="${tools.dir}/NuGet.exe" todir="${nuget.nupackages.dir}"/>

<echo message="rem In order to use this bat you have to be sure you have executed 'nuget SetApiKey' ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="false"/>
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<echo message="nuget push ${filename} ${environment::newline()}" file="${nuget.nupackages.pushbatfile}" append="true"/>
</do>
</foreach>
</target>
<target name="nugetpush" depends="init binaries common.download-nuget nuget.set-properties nuspec nuget"
description="Push packages on nuget gallery.">
<!-- In order to use this task you have to be sure you have executed 'nuget SetApiKey' -->
<foreach item="File" property="filename">
<in>
<items>
<include name="${nuget.nupackages.dir}/*.nupkg"/>
</items>
</in>
<do>
<exec basedir="${tools.dir}" workingdir="${nuget.nupackages.dir}" program="NuGet.exe">
<arg value="push" />
<arg value="${filename}" />
</exec>
</do>
</foreach>
</target>

</project>
17 changes: 16 additions & 1 deletion 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions src/NHibernate.Test/DynamicProxyTests/PeVerifier.cs
Expand Up @@ -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));
Expand All @@ -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));
Expand Down
9 changes: 3 additions & 6 deletions src/NHibernate.Test/NHSpecificTest/Logs/LogsFixture.cs
Expand Up @@ -40,7 +40,7 @@ public void WillGetSessionIdFromSessionLogs()

s.Get<Person>(1);//will execute some sql

var loggingEvent = spy.Events[0];
var loggingEvent = spy.GetWholeLog();
Assert.That(loggingEvent.Contains(sessionId.ToString()), Is.True);
}
}
Expand Down Expand Up @@ -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()
Expand Down
38 changes: 24 additions & 14 deletions 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;
Expand All @@ -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()
{
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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();

Expand Down
10 changes: 7 additions & 3 deletions src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs
Expand Up @@ -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();
}
Expand Down

0 comments on commit 35bb01c

Please sign in to comment.