Files
next.orly.dev/scripts/test_policy.sh
mleku 202d3171f9 Implement multi-platform build system with pure Go support
- Introduced a comprehensive build system that supports multiple platforms (Linux, macOS, Windows, Android) using pure Go builds (`CGO_ENABLED=0`).
- Updated all build and test scripts to ensure compatibility with the new purego approach, allowing for dynamic loading of `libsecp256k1` at runtime.
- Added detailed documentation on the build process, platform detection, and deployment options.
- Enhanced CI/CD workflows to automate builds for all supported platforms and include necessary libraries in releases.
- Updated `.gitignore` to exclude build output files.
- Created new documentation files for deployment and multi-platform build summaries.
2025-11-04 20:29:19 +00:00

61 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Policy System Test Runner
# This script runs all policy-related tests and benchmarks
set -e
# Pure Go build with purego - no CGO needed
# libsecp256k1 is loaded dynamically at runtime if available
export CGO_ENABLED=0
if [ -f "$(dirname "$0")/../pkg/crypto/p8k/libsecp256k1.so" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$(dirname "$0")/../pkg/crypto/p8k"
fi
echo "🧪 Running Policy System Tests"
echo "================================"
# Change to the project directory
cd "$(dirname "$0")"
# Run policy package tests
echo ""
echo "📦 Running Policy Package Tests..."
go test -v ./pkg/policy/... -run "Test.*" -timeout 30s
# Run policy integration tests
echo ""
echo "🔗 Running Policy Integration Tests..."
go test -v ./app/... -run "TestPolicy.*" -timeout 30s
# Run policy benchmarks
echo ""
echo "⚡ Running Policy Benchmarks..."
go test -v ./pkg/policy/... -run "Benchmark.*" -bench=. -benchmem -timeout 60s
# Run edge case tests
echo ""
echo "🔍 Running Edge Case Tests..."
go test -v ./pkg/policy/... -run "TestEdge.*" -timeout 30s
# Run race condition tests
echo ""
echo "🏃 Running Race Condition Tests..."
go test -v ./pkg/policy/... -race -timeout 30s
# Run coverage analysis
echo ""
echo "📊 Running Coverage Analysis..."
go test -v ./pkg/policy/... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
echo "Coverage report generated: coverage.html"
# Check for any linting issues
echo ""
echo "🔍 Running Linter Checks..."
golangci-lint run ./pkg/policy/... || echo "Linter not available, skipping..."
echo ""
echo "✅ All Policy Tests Completed!"
echo "================================"