mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-11 10:18:21 +09:00

* Single-File: Pass BUNDLE_PROBE property to the runtime As described in the [design doc](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#startup), pass the bundle_probe function pointer encoded as a string to the runtime.
77 lines
2.4 KiB
C#
77 lines
2.4 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using System.IO;
|
|
using Xunit;
|
|
using Microsoft.DotNet.Cli.Build.Framework;
|
|
using Microsoft.DotNet.CoreSetup.Test;
|
|
using BundleTests.Helpers;
|
|
using System.Threading;
|
|
|
|
namespace AppHost.Bundle.Tests
|
|
{
|
|
public class BundleProbe : IClassFixture<BundleProbe.SharedTestState>
|
|
{
|
|
private SharedTestState sharedTestState;
|
|
|
|
public BundleProbe(SharedTestState fixture)
|
|
{
|
|
sharedTestState = fixture;
|
|
}
|
|
|
|
[Fact]
|
|
private void Bundle_Probe_Not_Passed_For_Non_Single_File_App()
|
|
{
|
|
var fixture = sharedTestState.TestFixture.Copy();
|
|
string appExe = BundleHelper.GetHostPath(fixture);
|
|
|
|
Command.Create(appExe)
|
|
.CaptureStdErr()
|
|
.CaptureStdOut()
|
|
.Execute()
|
|
.Should()
|
|
.Pass()
|
|
.And
|
|
.HaveStdOutContaining("No BUNDLE_PROBE");
|
|
}
|
|
|
|
[Fact]
|
|
private void Bundle_Probe_Passed_For_Single_File_App()
|
|
{
|
|
var fixture = sharedTestState.TestFixture.Copy();
|
|
string singleFile = BundleHelper.BundleApp(fixture);
|
|
|
|
Command.Create(singleFile, "SingleFile")
|
|
.CaptureStdErr()
|
|
.CaptureStdOut()
|
|
.Execute()
|
|
.Should()
|
|
.Pass()
|
|
.And
|
|
.HaveStdOutContaining("BUNDLE_PROBE OK");
|
|
}
|
|
|
|
public class SharedTestState : IDisposable
|
|
{
|
|
public TestProjectFixture TestFixture { get; set; }
|
|
public RepoDirectoriesProvider RepoDirectories { get; set; }
|
|
|
|
public SharedTestState()
|
|
{
|
|
RepoDirectories = new RepoDirectoriesProvider();
|
|
TestFixture = new TestProjectFixture("BundleProbeTester", RepoDirectories);
|
|
TestFixture
|
|
.EnsureRestoredForRid(TestFixture.CurrentRid, RepoDirectories.CorehostPackages)
|
|
.PublishProject(runtime: TestFixture.CurrentRid,
|
|
outputDirectory: BundleHelper.GetPublishPath(TestFixture));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
TestFixture.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|