Merge pull request #1379 from livarcocc/argument_forwarding_tests

Making argument forwarding tests run with dotnet test
This commit is contained in:
Livar 2016-02-12 14:33:07 -08:00
commit f273ea4f7d
12 changed files with 36 additions and 119 deletions

View file

@ -5,3 +5,4 @@ dotnet-compile.UnitTests
dotnet-build.Tests
Microsoft.DotNet.Cli.Utils.Tests
Microsoft.DotNet.Compiler.Common.Tests
ArgumentForwardingTests
1 EndToEnd
5 dotnet-build.Tests
6 Microsoft.DotNet.Cli.Utils.Tests
7 Microsoft.DotNet.Compiler.Common.Tests
8 ArgumentForwardingTests

View file

@ -1,2 +1 @@
argument-forwarding-tests
package-command-test
1 argument-forwarding-tests package-command-test
argument-forwarding-tests
1 package-command-test package-command-test

View file

@ -1,35 +0,0 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. "$PSScriptRoot\..\common\_common.ps1"
$ArgTestRoot = "$RepoRoot\test\ArgumentForwardingTests"
$ArgTestOutputRoot = "$RepoRoot\artifacts\tests\arg-forwarding"
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\Reflector"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\Reflector"
Exit 1
}
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\ArgumentForwardingTests"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$ArgTestOutputRoot" --configuration "$Configuration" "$ArgTestRoot\ArgumentForwardingTests"
Exit 1
}
cp "$ArgTestRoot\Reflector\reflector_cmd.cmd" "$ArgTestOutputRoot"
pushd "$ArgTestOutputRoot"
& ".\corerun" "xunit.console.netcore.exe" "ArgumentForwardingTests.dll" -xml "$_-testResults.xml" -notrait category=failing
$exitCode = $LastExitCode
popd
# No need to output here, we'll get test results
if ($exitCode -ne 0) {
Exit 1
}

View file

@ -1,30 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
ArgTestRoot="$REPOROOT/test/ArgumentForwardingTests"
ArgTestOutputRoot="$REPOROOT/artifacts/tests/arg-forwarding"
dotnet publish --framework "dnxcore50" --output "$ArgTestOutputRoot" --configuration "$CONFIGURATION" "$ArgTestRoot/Reflector"
dotnet publish --framework "dnxcore50" --output "$ArgTestOutputRoot" --configuration "$CONFIGURATION" "$ArgTestRoot/ArgumentForwardingTests"
pushd "$ArgTestOutputRoot"
./corerun "xunit.console.netcore.exe" "ArgumentForwardingTests.dll" -xml "ArgumentForwardingTests-testResults.xml" -notrait category=failing
popd

View file

@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
{
public class ArgumentForwardingTests : TestBase
{
private static readonly string s_reflectorExeName = "Reflector" + Constants.ExeSuffix;
private static readonly string s_reflectorExeName = "ArgumentsReflector" + Constants.ExeSuffix;
private static readonly string s_reflectorCmdName = "reflector_cmd";
private string ReflectorPath { get; set; }
@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
{
Console.WriteLine("Dummy Entrypoint.");
}
public ArgumentForwardingTests()
{
// This test has a dependency on an argument reflector
@ -135,7 +135,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
{
var rawArg = rawEvaluatedArgument[i];
var escapedArg = escapedEvaluatedRawArgument[i];
try
{
rawArg.Should().Be(escapedArg);
@ -175,7 +175,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
/// <summary>
/// EscapeAndEvaluateArgumentString returns a representation of string[] args
/// when rawEvaluatedArgument is passed as an argument to a process using
/// Command.Create(). Ideally this should escape the argument such that
/// Command.Create(). Ideally this should escape the argument such that
/// the output is == rawEvaluatedArgument.
/// </summary>
/// <param name="rawEvaluatedArgument">A string[] representing string[] args as already evaluated by a process</param>
@ -195,7 +195,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
/// <summary>
/// EscapeAndEvaluateArgumentString returns a representation of string[] args
/// when rawEvaluatedArgument is passed as an argument to a process using
/// Command.Create(). Ideally this should escape the argument such that
/// Command.Create(). Ideally this should escape the argument such that
/// the output is == rawEvaluatedArgument.
/// </summary>
/// <param name="rawEvaluatedArgument">A string[] representing string[] args as already evaluated by a process</param>
@ -218,7 +218,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
/// <summary>
/// Parse the output of the reflector into a string array.
/// Reflector output is simply string[] args written to
/// Reflector output is simply string[] args written to
/// one string separated by commas.
/// </summary>
/// <param name="reflectorOutput"></param>
@ -230,7 +230,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
/// <summary>
/// Parse the output of the reflector into a string array.
/// Reflector output is simply string[] args written to
/// Reflector output is simply string[] args written to
/// one string separated by commas.
/// </summary>
/// <param name="reflectorOutput"></param>
@ -262,7 +262,7 @@ namespace Microsoft.DotNet.Tests.ArgumentForwarding
{
StartInfo = new ProcessStartInfo
{
FileName = s_reflectorExeName,
FileName = ReflectorPath,
Arguments = testUserArgument,
UseShellExecute = false,
RedirectStandardOutput = true,

View file

@ -1,26 +0,0 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23811",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23811",
"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.ProjectModel": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
},
"frameworks": {
"dnxcore50": {
"imports": "portable-net45+win8"
}
}
}

View file

@ -6,21 +6,22 @@
"dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23811",
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23811",
"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0",
"Microsoft.DotNet.ProjectModel": { "target": "project" },
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-dev-48273-16"
},
"frameworks": {
"dnxcore50": {
"imports": "portable-net45+win8"
}
}
},
"testRunner": "xunit",
"scripts": { "precompile": "dotnet build ../ArgumentsReflector/project.json --framework dnxcore50 --output %compile:RuntimeOutputDir%" }
}

View file

@ -2,17 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.PlatformAbstractions;
using System.Diagnostics;
using FluentAssertions;
namespace Microsoft.DotNet.Tests.ArgumentForwarding
{

View file

@ -0,0 +1,18 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library" : "1.0.0-rc2-23811"
},
"frameworks": {
"dnxcore50": {
"imports": "portable-net45+win8"
}
},
"content": ["reflector_cmd.cmd"]
}