Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ services:
- ./:/project
environment:
- NugetPackageDirectory=/project/${relativeNugetPackageDirectory:-packages}
- tracerHome=/project/${relativeTracerHome:-src/bin/windows-tracer-home}
- artifacts=/project/${relativeArtifacts:-src/bin/artifacts}
- tracerHome=/project/${relativeTracerHome:-tracer/src/bin/windows-tracer-home}
- artifacts=/project/${relativeArtifacts:-tracer/src/bin/artifacts}
- framework=${framework:-netcoreapp3.1}
- baseImage=${baseImage:-default}
- DD_CLR_ENABLE_NGEN=${DD_CLR_ENABLE_NGEN:-0}
Expand Down Expand Up @@ -364,8 +364,8 @@ services:
- ./:/project
environment:
- NugetPackageDirectory=/project/${relativeNugetPackageDirectory:-packages}
- tracerHome=/project/${relativeTracerHome:-src/bin/windows-tracer-home}
- artifacts=/project/${relativeArtifacts:-src/bin/artifacts}
- tracerHome=/project/${relativeTracerHome:-tracer/src/bin/windows-tracer-home}
- artifacts=/project/${relativeArtifacts:-tracer/src/bin/artifacts}
- framework=${framework:-netcoreapp3.1}
- baseImage=${baseImage:-debian}
- DD_CLR_ENABLE_NGEN=${DD_CLR_ENABLE_NGEN:-0}
Expand Down
36 changes: 15 additions & 21 deletions tracer/build/_build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ partial class Build
}
else
{
var (architecture, ext) = GetUnixArchitectureAndExtention();
var (architecture, ext) = GetUnixArchitectureAndExtension(includeMuslSuffixOnAlpine: true);
var ddwafFileName = $"libddwaf.{ext}";

var source = LibDdwafDirectory / "runtimes" / architecture / "native" / ddwafFileName;
Expand Down Expand Up @@ -422,7 +422,7 @@ partial class Build
}

// Move the native file to the architecture-specific folder
var (architecture, ext) = GetUnixArchitectureAndExtention();
var (architecture, ext) = GetUnixArchitectureAndExtension(includeMuslSuffixOnAlpine: false);

var profilerFileName = $"{NativeProfilerProject.Name}.{ext}";
var ddwafFileName = $"libddwaf.{ext}";
Expand Down Expand Up @@ -782,7 +782,6 @@ partial class Build
.EnableNoDependencies()
.SetConfiguration(BuildConfiguration)
.SetTargetPlatform(Platform)
.SetProperty("ManagedProfilerOutputDirectory", TracerHomeDirectory)
.SetTargets("BuildCsharpIntegrationTests")
.SetMaxCpuCount(null));
});
Expand Down Expand Up @@ -820,10 +819,6 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
.SetTargetPlatform(Platform)
.EnableNoDependencies()
.SetProperty("BuildInParallel", "false")
.SetProperty("ExcludeManagedProfiler", true)
.SetProperty("ExcludeNativeProfiler", true)
.SetProperty("ManagedProfilerOutputDirectory", TracerHomeDirectory)
.SetProperty("LoadManagedProfilerFromProfilerDirectory", false)
.SetProcessArgumentConfigurator(arg => arg.Add("/nowarn:NU1701"))
.CombineWith(projects, (s, project) => s
.SetProjectFile(project)));
Expand Down Expand Up @@ -879,6 +874,7 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
.SetTargetPlatform(Platform)
.EnableNoRestore()
.EnableNoBuild()
.SetProcessEnvironmentVariable("TracerHomeDirectory", TracerHomeDirectory)
.When(!string.IsNullOrEmpty(Filter), c => c.SetFilter(Filter))
.When(CodeCoverage, ConfigureCodeCoverage)
.CombineWith(ParallelIntegrationTests, (s, project) => s
Expand All @@ -895,6 +891,7 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
.EnableNoRestore()
.EnableNoBuild()
.SetFilter(Filter ?? "RunOnWindows=True&LoadFromGAC!=True&IIS!=True")
.SetProcessEnvironmentVariable("TracerHomeDirectory", TracerHomeDirectory)
.When(CodeCoverage, ConfigureCodeCoverage)
.CombineWith(ClrProfilerIntegrationTests, (s, project) => s
.EnableTrxLogOutput(GetResultsDirectory(project))
Expand Down Expand Up @@ -926,6 +923,7 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
.EnableNoRestore()
.EnableNoBuild()
.SetFilter(Filter ?? "Category=Smoke&LoadFromGAC!=True")
.SetProcessEnvironmentVariable("TracerHomeDirectory", TracerHomeDirectory)
.When(CodeCoverage, ConfigureCodeCoverage)
.CombineWith(ClrProfilerIntegrationTests, (s, project) => s
.EnableTrxLogOutput(GetResultsDirectory(project))
Expand Down Expand Up @@ -958,6 +956,7 @@ _ when projectPath.ToString().Contains("Samples.OracleMDA") => false,
.EnableNoRestore()
.EnableNoBuild()
.SetFilter(Filter ?? "(RunOnWindows=True)&LoadFromGAC=True")
.SetProcessEnvironmentVariable("TracerHomeDirectory", TracerHomeDirectory)
.When(CodeCoverage, ConfigureCodeCoverage)
.CombineWith(ClrProfilerIntegrationTests, (s, project) => s
.EnableTrxLogOutput(GetResultsDirectory(project))
Expand Down Expand Up @@ -1059,9 +1058,6 @@ var name when multiPackageProjects.Contains(name) => false,
.SetFramework(Framework)
// .SetTargetPlatform(Platform)
.SetNoWarnDotNetCore3()
.SetProperty("ExcludeManagedProfiler", "true")
.SetProperty("ExcludeNativeProfiler", "true")
.SetProperty("ManagedProfilerOutputDirectory", TracerHomeDirectory)
.When(TestAllPackageVersions, o => o.SetProperty("TestAllPackageVersions", "true"))
.When(!string.IsNullOrEmpty(NugetPackageDirectory), o => o.SetPackageDirectory(NugetPackageDirectory))
.CombineWith(projectsToBuild, (c, project) => c
Expand All @@ -1076,7 +1072,6 @@ var name when multiPackageProjects.Contains(name) => false,
.SetFramework(Framework)
// .SetTargetPlatform(Platform)
.SetNoWarnDotNetCore3()
.SetProperty("ManagedProfilerOutputDirectory", TracerHomeDirectory)
.When(TestAllPackageVersions, o => o.SetProperty("TestAllPackageVersions", "true"))
.When(!string.IsNullOrEmpty(NugetPackageDirectory), o => o.SetPackageDirectory(NugetPackageDirectory))
.CombineWith(projectsToBuild, (c, project) => c
Expand Down Expand Up @@ -1105,10 +1100,7 @@ var name when multiPackageProjects.Contains(name) => false,
.SetConfiguration(BuildConfiguration)
.EnableNoDependencies()
.SetProperty("TargetFramework", Framework.ToString())
.SetProperty("ManagedProfilerOutputDirectory", TracerHomeDirectory)
.SetProperty("BuildInParallel", "true")
.SetProperty("ExcludeManagedProfiler", "true")
.SetProperty("ExcludeNativeProfiler", "true")
.SetProcessArgumentConfigurator(arg => arg.Add("/nowarn:NU1701"))
.AddProcessEnvironmentVariable("TestAllPackageVersions", "true")
.When(TestAllPackageVersions, o => o.SetProperty("TestAllPackageVersions", "true"))
Expand Down Expand Up @@ -1140,7 +1132,6 @@ var name when multiPackageProjects.Contains(name) => false,
.When(TestAllPackageVersions, o => o
.SetProperty("TestAllPackageVersions", "true"))
.AddProcessEnvironmentVariable("TestAllPackageVersions", "true")
.AddProcessEnvironmentVariable("ManagedProfilerOutputDirectory", TracerHomeDirectory)
.When(!string.IsNullOrEmpty(NugetPackageDirectory), o =>
o.SetPackageDirectory(NugetPackageDirectory))
.CombineWith(integrationTestProjects, (c, project) => c
Expand Down Expand Up @@ -1180,6 +1171,7 @@ var name when multiPackageProjects.Contains(name) => false,
.SetFramework(Framework)
.EnableMemoryDumps()
.SetFilter(filter)
.SetProcessEnvironmentVariable("TracerHomeDirectory", TracerHomeDirectory)
.When(TestAllPackageVersions, o => o
.SetProcessEnvironmentVariable("TestAllPackageVersions", "true"))
.When(CodeCoverage, ConfigureCodeCoverage)
Expand All @@ -1197,6 +1189,7 @@ var name when multiPackageProjects.Contains(name) => false,
.SetFramework(Framework)
.EnableMemoryDumps()
.SetFilter(filter)
.SetProcessEnvironmentVariable("TracerHomeDirectory", TracerHomeDirectory)
.When(TestAllPackageVersions, o => o
.SetProcessEnvironmentVariable("TestAllPackageVersions", "true"))
.When(CodeCoverage, ConfigureCodeCoverage)
Expand All @@ -1215,13 +1208,14 @@ var name when multiPackageProjects.Contains(name) => false,

private void EnsureResultsDirectory(Project proj) => EnsureCleanDirectory(GetResultsDirectory(proj));

private (string, string) GetUnixArchitectureAndExtention()
private (string, string) GetUnixArchitectureAndExtension(bool includeMuslSuffixOnAlpine)
{
var archExt = IsOsx
? ("osx-x64", "dylib")
: ($"linux-{LinuxArchitectureIdentifier}", "so");

return archExt;
return (IsOsx, IsAlpine, includeMuslSuffixOnAlpine) switch
{
(true, _, _) => ("osx-x64", "dylib"),
(_, true, true) => ($"linux-musl-{LinuxArchitectureIdentifier}", "so"),
_ => ($"linux-{LinuxArchitectureIdentifier}", "so"),
};
}

// the integration tests need their own copy of the profiler, this achived through build.props on Windows, but doesn't seem to work under Linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
<!--These should be consolidated in a file that can be shared for the tests and samples directories -->
<DefineConstants Condition="'$(BuildingInsideVisualStudio)'=='true' or '$(TestAllPackageVersions)'!='true'">$(DefineConstants);DEFAULT_SAMPLES</DefineConstants>
<DefineConstants Condition="'$(PerformComprehensiveTesting)'=='true'">$(DefineConstants);COMPREHENSIVE_TESTS</DefineConstants>

<ManagedProfilerOutputDirectory Condition="'$(ManagedProfilerOutputDirectory)' == ''">$(MSBuildThisFileDirectory)\..\src\Datadog.Trace\bin\$(Configuration)</ManagedProfilerOutputDirectory>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\src\Datadog.Trace.ClrProfiler.Native\bin\$(Configuration)\$(Platform)\**" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" Link="profiler-lib\%(RecursiveDir)\%(Filename)%(Extension)" />
<None Remove="applicationHost.config" />
<None Remove="xunit.runner.json" />
<Content Include="..\..\integrations.json" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" Link="profiler-lib\integrations.json" />
<Content Include="applicationHost.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -47,16 +43,6 @@
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<Target Name="AfterBuildCopyManagedProfiler" AfterTargets="AfterBuild">
<ItemGroup>
<!-- Subfolders of the output directory should each be a target framework -->
<ManagedProfilerFiles Include="$(ManagedProfilerOutputDirectory)\**\*.dll" Exclude="$(ManagedProfilerOutputDirectory)\*\runtimes\**\*.dll" />
<ManagedProfilerFiles Include="$(ManagedProfilerOutputDirectory)\**\*.pdb" Exclude="$(ManagedProfilerOutputDirectory)\*\runtimes\**\*.pdb" />
</ItemGroup>

<Copy SourceFiles="@(ManagedProfilerFiles)" DestinationFolder="$(OutputPath)profiler-lib\%(RecursiveDir)" />
</Target>

<ItemGroup>
<None Update="CI\Data\*.*">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ private async Task StartSample(int traceAgentPort, string arguments, int? aspNet
throw new Exception($"application not found: {sampleAppPath}");
}

// get full paths to integration definitions
var integrationPaths = Directory.EnumerateFiles(".", "*integrations.json").Select(Path.GetFullPath);

// EnvironmentHelper.DebugModeEnabled = true;

Output.WriteLine($"Starting Application: {sampleAppPath}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
<DefineConstants Condition="'$(BuildingInsideVisualStudio)'=='true' or '$(TestAllPackageVersions)'!='true'">$(DefineConstants);DEFAULT_SAMPLES</DefineConstants>
<DefineConstants Condition="'$(PerformComprehensiveTesting)'=='true'">$(DefineConstants);COMPREHENSIVE_TESTS</DefineConstants>

<ManagedProfilerOutputDirectory Condition="'$(ManagedProfilerOutputDirectory)' == ''">$(MSBuildThisFileDirectory)\..\src\Datadog.Trace.ClrProfiler.Managed\bin\$(Configuration)</ManagedProfilerOutputDirectory>
<NativeProfilerOutputDirectory Condition="'$(NativeProfilerOutputDirectory)' == ''">$(MSBuildThisFileDirectory)\..\src\Datadog.Trace.ClrProfiler.Native\bin\$(Configuration)\$()</NativeProfilerOutputDirectory>

</PropertyGroup>

<ItemGroup>
<None Include="..\..\src\Datadog.Trace.ClrProfiler.Native\bin\$(Configuration)\$(Platform)\**" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" Link="profiler-lib\%(RecursiveDir)\%(Filename)%(Extension)" />
<None Remove="applicationHost.config" />
<None Remove="xunit.runner.json" />
<Content Include="..\..\integrations.json" CopyToOutputDirectory="Always" CopyToPublishDirectory="Always" Link="profiler-lib\integrations.json" />
<Content Include="applicationHost.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -44,18 +39,6 @@
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<Target Name="AfterBuildCopyManagedProfiler" AfterTargets="AfterBuild">
<ItemGroup>
<!-- Subfolders of the output directory should each be a target framework -->
<ManagedProfilerFiles Include="$(ManagedProfilerOutputDirectory)\**\*.dll" Exclude="$(ManagedProfilerOutputDirectory)\*\runtimes\**\*.dll" />
<ManagedProfilerFiles Include="$(ManagedProfilerOutputDirectory)\**\*.pdb" Exclude="$(ManagedProfilerOutputDirectory)\*\runtimes\**\*.pdb" />
<SecurityLibraryFiles Include="$(Pkglibddwaf)\runtimes\**\*.*" />
</ItemGroup>

<Copy SourceFiles="@(ManagedProfilerFiles)" DestinationFolder="$(OutputPath)profiler-lib\%(RecursiveDir)" />
<Copy SourceFiles="@(SecurityLibraryFiles)" DestinationFolder="$(OutputPath)profiler-lib\%(RecursiveDir)" />
</Target>

<ItemGroup>
<None Update="CI\Data\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
32 changes: 5 additions & 27 deletions tracer/test/Datadog.Trace.TestHelpers/CustomTestFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,14 @@ public CustomTestFramework(IMessageSink messageSink, Type typeTestedAssembly)

internal static string GetProfilerTargetFolder()
{
var targetFrameworkDirectory = GetTargetFrameworkDirectory();
var tracerHome = EnvironmentHelper.GetTracerHomePath();
var targetFrameworkDirectory = EnvironmentTools.GetTracerTargetFrameworkDirectory();

var paths = EnvironmentHelper.GetProfilerPathCandidates(null).ToArray();
var finalDirectory = Path.Combine(tracerHome, targetFrameworkDirectory);

foreach (var path in paths)
if (Directory.Exists(finalDirectory))
{
var baseDirectory = Path.GetDirectoryName(path);
var finalDirectory = Path.Combine(baseDirectory, targetFrameworkDirectory);

if (Directory.Exists(finalDirectory))
{
return finalDirectory;
}
return finalDirectory;
}

return null;
Expand All @@ -65,23 +60,6 @@ protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyNa
return new CustomExecutor(assemblyName, SourceInformationProvider, DiagnosticMessageSink);
}

private static string GetTargetFrameworkDirectory()
{
// The conditions looks weird, but it seems like _OR_GREATER is not supported yet in all environments
// We can trim all the additional conditions when this is fixed
#if NETCOREAPP3_1_OR_GREATER || NETCOREAPP3_1 || NET5_0
return "netcoreapp3.1";
#elif NETCOREAPP || NETSTANDARD
return "netstandard2.0";
#elif NET461_OR_GREATER || NET461 || NET47 || NET471 || NET472 || NET48
return "net461";
#elif NET45_OR_GREATER || NET45 || NET451 || NET452 || NET46
return "net45";
#else
#error Unexpected TFM
#endif
}

private class CustomExecutor : XunitTestFrameworkExecutor
{
public CustomExecutor(AssemblyName assemblyName, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink)
Expand Down
Loading