2022-01-21 07:59:36 -06:00
|
|
|
// 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.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using Xunit;
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
|
|
|
|
|
|
|
|
public class XmlDocTests
|
|
|
|
{
|
|
|
|
private ITestOutputHelper OutputHelper { get; }
|
|
|
|
private DotNetHelper DotNetHelper { get; }
|
|
|
|
|
|
|
|
public XmlDocTests(ITestOutputHelper outputHelper)
|
|
|
|
{
|
|
|
|
OutputHelper = outputHelper;
|
|
|
|
DotNetHelper = new DotNetHelper(outputHelper);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <Summary>
|
|
|
|
/// Verifies every targeting pack assembly has a xml doc file.
|
|
|
|
/// There are exceptions which are specified in baselines/XmlDocIgnore.*.txt.
|
|
|
|
/// </Summary>
|
|
|
|
[Fact]
|
|
|
|
public void VerifyTargetingPacksHaveDoc()
|
|
|
|
{
|
|
|
|
List<string> missingXmlDoc = new();
|
|
|
|
|
2022-02-10 15:58:01 -06:00
|
|
|
string targetingPacksDirectory = Path.Combine(Config.DotNetDirectory, "packs");
|
2022-01-21 07:59:36 -06:00
|
|
|
foreach (string targetingPackAssembly in Directory.EnumerateFiles(targetingPacksDirectory, "*.dll", SearchOption.AllDirectories))
|
|
|
|
{
|
|
|
|
if (targetingPackAssembly.EndsWith("resources.dll"))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
string xmlFile = Path.ChangeExtension(targetingPackAssembly, ".xml");
|
|
|
|
if (!File.Exists(xmlFile))
|
|
|
|
{
|
2022-02-10 15:58:01 -06:00
|
|
|
string pathWithoutPacksPrefix = xmlFile[(targetingPacksDirectory.Length + 1)..];
|
|
|
|
string[] pathParts = pathWithoutPacksPrefix.Split(Path.DirectorySeparatorChar);
|
2022-01-21 07:59:36 -06:00
|
|
|
string pathWithoutVersion = string.Join(Path.DirectorySeparatorChar, pathParts.Take(1).Concat(pathParts.Skip(2)));
|
|
|
|
missingXmlDoc.Add(pathWithoutVersion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BaselineHelper.Compare("MissingXmlDoc.txt", missingXmlDoc.OrderBy(entry => entry));
|
|
|
|
}
|
|
|
|
}
|