mirror of https://github.com/winsw/winsw
* First configuration stub * Get rid of the old winsw_cert.pfx references, adjust docs * Fix the corrupted log4net reference, we use 2.0.3 * Generate stub SNK file * Signing: Try full SDK path to generate SNKs * Fix the path * Signing: Sign all assemblies being packed into WinSW * Tests: Try enabling tests * Tests and artifacts: Use absolute paths * Artifact path must be relative * The test DLL is the NUnit one * nunit-console does not require loggers * NUnit: Try picking all DLLs in the output folder * NUnit console: No wildcards * Tests: Fix the test project to make it properly working with the new project structure * Docs: Clarify the specifics of external extension usage * Add AppVeyor badge to README.mdpull/145/head
parent
449110f87f
commit
6c0f6d1f7a
|
@ -3,7 +3,6 @@ obj
|
|||
*.suo
|
||||
/UpgradeLog.htm
|
||||
/winsw.csproj.user
|
||||
/winsw_cert.pfx
|
||||
*.user
|
||||
/src/packages/NUnit.2.6.4
|
||||
/src/packages/ILMerge.MSBuild.Tasks.1.0.0.3
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
winsw: Windows service wrapper in less restrictive license
|
||||
=========================
|
||||
|
||||
[](https://ci.appveyor.com/project/oleg-nenashev/winsw)
|
||||
|
||||
WinSW is an executable binary, which can be used to wrap and manage a custom process as a Windows service.
|
||||
Once you download the installation package, you can rename `winsw.exe` to any name, e.g. `myService.exe`.
|
||||
|
||||
|
@ -65,6 +67,6 @@ New versions with fixes may be released on-demand.
|
|||
### Build Environment
|
||||
|
||||
* IDE: [Visual Studio Community 2013](http://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx) (free for open-source projects)
|
||||
* winsw_cert.pfx should be available in the project's root
|
||||
* `winsw-key.snk` should be available in the project's root in order to build the executable
|
||||
* You can generate the certificate in "Project Settings/Signing"
|
||||
* The certificate is in <code>.gitignore</code> list. Please do not add it to the repository
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
version: 2.0.0.{build}
|
||||
|
||||
# Do not build on tags (GitHub and BitBucket)
|
||||
skip_tags: true
|
||||
|
||||
# Project configuration
|
||||
image: Visual Studio 2013
|
||||
platform: Any CPU
|
||||
configuration: Release
|
||||
|
||||
# Automatically register private account and/or project AppVeyor NuGet feeds.
|
||||
nuget:
|
||||
account_feed: true
|
||||
project_feed: true
|
||||
disable_publish_on_pr: true # disable publishing of .nupkg artifacts to
|
||||
|
||||
before_build:
|
||||
# Check SDKs
|
||||
- ECHO "Installed SDKs:"
|
||||
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
|
||||
# Generates a temporary SNK. Not for real signing
|
||||
- cmd: "\"C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin/sn.exe\" -k winsw_key.snk"
|
||||
|
||||
build:
|
||||
parallel: true
|
||||
project: src\winsw.sln
|
||||
|
||||
test_script:
|
||||
# Runner for NUnit2
|
||||
- ps: nunit-console 'C:/projects/winsw/src/Test/winswTests/bin/Release/winswTests.dll' 'C:/projects/winsw/src/Test/winswTests/bin/Release/SharedDirectoryMapper.dll' 'C:/projects/winsw/src/Test/winswTests/bin/Release/RunawayProcessKiller.dll'
|
||||
|
||||
artifacts:
|
||||
- path: 'src/Core/ServiceWrapper/bin/Release/winsw.exe'
|
||||
name: WinSW
|
||||
|
||||
|
||||
|
||||
|
|
@ -28,5 +28,7 @@ Generic extension creation guideline:
|
|||
|
||||
WinSW engine will automatically locate your extension using the class name in the [XML Configuration File](../xmlConfigFile.md).
|
||||
See configuration samples provided for the extensions in the core.
|
||||
For extensions from external DLLs, the `className` field should also specify the assembly name.
|
||||
It can be done via fully qualified class name or just by the `${CLASS_NAME}, ${ASSEMBLY_NAME}` declaration.
|
||||
|
||||
Please note that in the current versions of WinSW `2.x` the binary compatibility of extension APIs *is not guaranteed*.
|
||||
|
|
2
sign.sh
2
sign.sh
|
@ -2,7 +2,7 @@
|
|||
export "PATH=$PATH:/cygdrive/c/Program Files/Windows Kits/8.1/bin/x86"
|
||||
for f in Release Debug;
|
||||
do
|
||||
signtool sign /f winsw_cert.pfx /t http://timestamp.verisign.com/scripts/timestamp.dll bin/$f/winsw.exe
|
||||
signtool sign /f winsw-key.snk /t http://timestamp.verisign.com/scripts/timestamp.dll bin/$f/winsw.exe
|
||||
signtool verify /v /pa bin/$f/winsw.exe
|
||||
done
|
||||
echo success
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\winsw_cert.pfx" />
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\..\..\winsw_cert.pfx</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyFile>$(SolutionDir)..\winsw_key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
|
@ -71,7 +69,6 @@
|
|||
<Compile Include="WmiSchema.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\winsw_cert.pfx" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -31,9 +31,13 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>$(SolutionDir)..\winsw_key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\..\packages\log4net.2.0.5\lib\net20-full\log4net.dll</HintPath>
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net20-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>$(SolutionDir)..\winsw_key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace winswTests.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for testing of WinSW Extensions.
|
||||
/// </summary>
|
||||
public class ExtensionTestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the name of the extension to be passed in the configuration.
|
||||
/// This name should point to assembly in tests, because we do not merge extension DLLs for testing purposes.
|
||||
/// </summary>
|
||||
/// <param name="type">Type of the extension</param>
|
||||
/// <returns>String for Type locator, which includes class and assembly names</returns>
|
||||
protected static String getExtensionClassNameWithAssembly(Type type)
|
||||
{
|
||||
return type.ToString() + ", " + type.Assembly;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,18 +5,19 @@ using winsw.Plugins.SharedDirectoryMapper;
|
|||
using winswTests.util;
|
||||
using winsw.Plugins.RunawayProcessKiller;
|
||||
|
||||
namespace winswTests.extensions
|
||||
namespace winswTests.Extensions
|
||||
{
|
||||
[TestFixture]
|
||||
class RunawayProcessKillerExtensionTest
|
||||
class RunawayProcessKillerExtensionTest : ExtensionTestBase
|
||||
{
|
||||
ServiceDescriptor _testServiceDescriptor;
|
||||
readonly TestLogger _logger = new TestLogger();
|
||||
|
||||
string testExtension = getExtensionClassNameWithAssembly(typeof(RunawayProcessKillerExtension));
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
string testExtension = typeof (RunawayProcessKillerExtension).ToString();
|
||||
string seedXml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
|
||||
+ "<service> "
|
||||
+ " <id>SERVICE_NAME</id> "
|
||||
|
@ -26,7 +27,7 @@ namespace winswTests.extensions
|
|||
+ " <arguments>-Xrs -jar \\\"%BASE%\\slave.jar\\\" -jnlpUrl ...</arguments> "
|
||||
+ " <logmode>rotate</logmode> "
|
||||
+ " <extensions> "
|
||||
+ " <extension enabled=\"true\" className=\"" + testExtension + "\" id=\"mapNetworDirs\"> "
|
||||
+ " <extension enabled=\"true\" className=\"" + testExtension + "\" id=\"killRunawayProcess\"> "
|
||||
+ " <pidfile>foo/bar/pid.txt</pidfile>"
|
||||
+ " <stopTimeout>5000</stopTimeout> "
|
||||
+ " <stopParentFirst>true</stopParentFirst>"
|
||||
|
@ -44,7 +45,7 @@ namespace winswTests.extensions
|
|||
Assert.AreEqual(1, manager.Extensions.Count, "One extension should be loaded");
|
||||
|
||||
// Check the file is correct
|
||||
var extension = manager.Extensions[typeof(RunawayProcessKillerExtension).ToString()] as RunawayProcessKillerExtension;
|
||||
var extension = manager.Extensions["killRunawayProcess"] as RunawayProcessKillerExtension;
|
||||
Assert.IsNotNull(extension, "RunawayProcessKillerExtension should be loaded");
|
||||
Assert.AreEqual("foo/bar/pid.txt", extension.Pidfile, "Loaded PID file path is not equal to the expected one");
|
||||
Assert.AreEqual(5000, extension.StopTimeout.TotalMilliseconds, "Loaded Stop Timeout is not equal to the expected one");
|
||||
|
|
|
@ -4,18 +4,20 @@ using winsw.Extensions;
|
|||
using winsw.Plugins.SharedDirectoryMapper;
|
||||
using winswTests.util;
|
||||
|
||||
namespace winswTests.extensions
|
||||
namespace winswTests.Extensions
|
||||
{
|
||||
[TestFixture]
|
||||
class WinSWExtensionManagerTest
|
||||
class SharedDirectoryMapperTest : ExtensionTestBase
|
||||
{
|
||||
ServiceDescriptor _testServiceDescriptor;
|
||||
readonly TestLogger _logger = new TestLogger();
|
||||
|
||||
string testExtension = getExtensionClassNameWithAssembly(typeof(SharedDirectoryMapper));
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
string testExtension = typeof (SharedDirectoryMapper).ToString();
|
||||
|
||||
string seedXml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
|
||||
+ "<service> "
|
||||
+ " <id>SERVICE_NAME</id> "
|
|
@ -1,7 +1,9 @@
|
|||
<NUnitProject>
|
||||
<Settings activeconfig="Debug" />
|
||||
<Settings activeconfig="Release" />
|
||||
<Config name="Debug">
|
||||
<assembly path="bin\Debug\winswTests.dll" />
|
||||
<assembly path="bin\Debug\winswTests.dll" />
|
||||
</Config>
|
||||
<Config name="Release"></Config>
|
||||
</NUnitProject>
|
||||
<Config name="Release">
|
||||
<assembly path="bin\Release\winswTests.dll" />
|
||||
</Config>
|
||||
</NUnitProject>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net20" />
|
||||
<package id="JetBrains.Annotations" version="8.0.5.0" targetFramework="net20" />
|
||||
<package id="log4net" version="2.0.3" targetFramework="net20" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net20" />
|
||||
</packages>
|
|
@ -46,14 +46,18 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\..\packages\log4net.2.0.3\lib\net20-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Extensions\ExtensionTestBase.cs" />
|
||||
<Compile Include="Extensions\RunawayProcessKillerTest.cs" />
|
||||
<Compile Include="Extensions\WinSWExtensionManagerTest.cs" />
|
||||
<Compile Include="Extensions\SharedDirectoryMapperTest.cs" />
|
||||
<Compile Include="MainTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ServiceDescriptorTests.cs" />
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
</StartupObject>
|
||||
<SignManifests>false</SignManifests>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>winsw_cert.pfx</AssemblyOriginatorKeyFile>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
|
@ -93,9 +92,6 @@
|
|||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="winsw_cert.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
|
|
Loading…
Reference in New Issue