#!/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 "================================"