Skip to content

Commit

Permalink
Code coverage codecov compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss committed Nov 14, 2023
1 parent 1ecdaff commit c64e8bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ jobs:
run: |
$env:COMPlus_gcServer=1
dotnet test --no-build Content.IntegrationTests/Content.IntegrationTests.csproj -v n
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 2 additions & 3 deletions Content.Tests/DMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public enum DMTestFlags {
}

[Test, TestCaseSource(nameof(GetTests))]
public void TestFiles(string sourceFile, string coverageFile, string coverageDirectory, DMTestFlags testFlags) {
public void TestFiles(string sourceFile, string coverageFile, DMTestFlags testFlags) {
string initialDirectory = Directory.GetCurrentDirectory();
TestContext.WriteLine($"--- TEST {sourceFile} | Flags: {testFlags}");
try {
Expand All @@ -88,7 +88,7 @@ public enum DMTestFlags {
Assert.IsTrue(compiledFile is not null && File.Exists(compiledFile), "Failed to compile DM source file");
Assert.IsTrue(_dreamMan.LoadJson(compiledFile), $"Failed to load {compiledFile}");

_debugManager.InitializeCoverage(coverageFile, coverageDirectory);
_debugManager.InitializeCoverage(coverageFile);

_dreamMan.StartWorld();

Expand Down Expand Up @@ -174,7 +174,6 @@ private static IEnumerable<object[]> GetTests()
yield return new object[] {
sourceFile2,
Path.GetFullPath($"{sourceFile[..^2]}coverage.xml"),
Path.GetFullPath(TestProject),
testFlags
};
}
Expand Down
2 changes: 1 addition & 1 deletion OpenDreamRuntime/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public sealed class EntryPoint : GameServer {

var codeCoverageOutputFile = _configManager.GetCVar(OpenDreamCVars.CodeCoverage);
if (!String.IsNullOrWhiteSpace(codeCoverageOutputFile)) {
_debugManager.InitializeCoverage(codeCoverageOutputFile, Path.GetFullPath(Environment.CurrentDirectory));
_debugManager.InitializeCoverage(codeCoverageOutputFile);
}

int debugAdapterPort = _configManager.GetCVar(OpenDreamCVars.DebugAdapterLaunched);
Expand Down
9 changes: 3 additions & 6 deletions OpenDreamRuntime/Procs/DebugAdapter/DreamDebugManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public struct ThreadStepMode {
/// </summary>
private ulong[][]? _coverageTracking;
private string? _coverageOutputFile;
private string? _coverageInputDirectory;

// Breakpoint storage
private const string ExceptionFilterRuntimes = "runtimes";
Expand Down Expand Up @@ -180,7 +179,7 @@ private struct ActiveBreakpoint {
}
}

public void InitializeCoverage(string outputFile, string inputDirectory) {
public void InitializeCoverage(string outputFile) {
var allProcs = _objectTree.Procs;
var coverageTracking = new ulong[allProcs.Count][];
for(var i = 0; i < allProcs.Count; ++i) {
Expand All @@ -191,7 +190,6 @@ private struct ActiveBreakpoint {

_coverageTracking = coverageTracking;
_coverageOutputFile = outputFile;
_coverageInputDirectory = inputDirectory;
}

public void HandleInstruction(DMProcState state) {
Expand Down Expand Up @@ -935,7 +933,7 @@ private struct ActiveBreakpoint {
.ToArray(),
},
},
sources = new string[] { _coverageInputDirectory! },
sources = new string[] { String.Empty },
};

var serializer = new XmlSerializer(schema.GetType());
Expand All @@ -945,12 +943,11 @@ private struct ActiveBreakpoint {

_coverageTracking = null;
_coverageOutputFile = null;
_coverageInputDirectory = null;
}
}

public interface IDreamDebugManager {
public void InitializeCoverage(string outputFile, string inputDirectory);
public void InitializeCoverage(string outputFile);
public void InitializeDebugging(int port);
public void Update();
public void Shutdown();
Expand Down

0 comments on commit c64e8bf

Please sign in to comment.