up
Some checks failed
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Policy Simulation / policy-simulate (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled

This commit is contained in:
StellaOps Bot
2025-12-13 09:37:15 +02:00
parent e00f6365da
commit 6e45066e37
349 changed files with 17160 additions and 1867 deletions

View File

@@ -0,0 +1,61 @@
using System;
using System.IO;
namespace StellaOps.Scanner.Analyzers.Lang.Tests.Rust;
internal static class RustFixtureBinaries
{
private static readonly byte[] HeuristicBinary =
{
0x7F, (byte)'E', (byte)'L', (byte)'F',
0x02, 0x01, 0x01, 0x00,
(byte)'_', (byte)'Z', (byte)'N', (byte)'7', (byte)'r', (byte)'e', (byte)'q', (byte)'w', (byte)'e', (byte)'s', (byte)'t',
0x00,
(byte)'_', (byte)'Z', (byte)'N', (byte)'5', (byte)'s', (byte)'e', (byte)'r', (byte)'d', (byte)'e',
0x00,
(byte)'_', (byte)'Z', (byte)'N', (byte)'5', (byte)'t', (byte)'o', (byte)'k', (byte)'i', (byte)'o',
0x00,
};
private static readonly byte[] OpaqueBinary =
{
0x7F, (byte)'E', (byte)'L', (byte)'F',
0x02, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
public static void EnsureHeuristicBinary(string fixturePath)
{
if (string.IsNullOrWhiteSpace(fixturePath))
{
throw new ArgumentException("Fixture path is required.", nameof(fixturePath));
}
var path = Path.Combine(fixturePath, "usr", "local", "bin", "heuristic_app");
WriteBinary(path, HeuristicBinary);
}
public static void EnsureOpaqueBinary(string fixturePath)
{
if (string.IsNullOrWhiteSpace(fixturePath))
{
throw new ArgumentException("Fixture path is required.", nameof(fixturePath));
}
var path = Path.Combine(fixturePath, "usr", "local", "bin", "opaque_bin");
WriteBinary(path, OpaqueBinary);
}
private static void WriteBinary(string path, byte[] content)
{
var directory = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(directory))
{
Directory.CreateDirectory(directory);
}
File.WriteAllBytes(path, content);
}
}

View File

@@ -14,6 +14,7 @@ public sealed class RustHeuristicCoverageComparisonTests
var cancellationToken = TestContext.Current.CancellationToken;
var fixturePath = TestPaths.ResolveFixture("lang", "rust", "heuristics");
var baselinePath = Path.Combine(fixturePath, "competitor-baseline.json");
RustFixtureBinaries.EnsureHeuristicBinary(fixturePath);
var analyzers = new ILanguageAnalyzer[]
{

View File

@@ -64,6 +64,7 @@ public sealed class RustLanguageAnalyzerTests
var cancellationToken = TestContext.Current.CancellationToken;
var fixturePath = TestPaths.ResolveFixture("lang", "rust", "heuristics");
var goldenPath = Path.Combine(fixturePath, "expected.json");
RustFixtureBinaries.EnsureHeuristicBinary(fixturePath);
var usageHints = new LanguageUsageHints(new[]
{
Path.Combine(fixturePath, "usr/local/bin/heuristic_app")
@@ -88,6 +89,7 @@ public sealed class RustLanguageAnalyzerTests
var cancellationToken = TestContext.Current.CancellationToken;
var fixturePath = TestPaths.ResolveFixture("lang", "rust", "fallback");
var goldenPath = Path.Combine(fixturePath, "expected.json");
RustFixtureBinaries.EnsureOpaqueBinary(fixturePath);
var usageHints = new LanguageUsageHints(new[]
{
Path.Combine(fixturePath, "usr/local/bin/opaque_bin")