-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateAST-trx.sh
More file actions
executable file
·67 lines (48 loc) · 2.1 KB
/
GenerateAST-trx.sh
File metadata and controls
executable file
·67 lines (48 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Simple script to generate TRX file for all AST tests
# Usage: ./GenerateAst-trx.sh
# Output: TestResults/AST.trx
set -e
# Get the directory where this script is located (repo root)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$SCRIPT_DIR"
# CD into the repo root to ensure we're in the correct location
cd "$REPO_ROOT"
echo "Working from repo root: $REPO_ROOT"
# Ensure output directory exists
mkdir -p TestResults
echo "Generating Ast test results..."
# Change to source directory
cd src
# Build and run all tests, output TRX to workspace root
dotnet test Kore.AST.Test/Kore.AST.Tests.csproj --configuration Release --verbosity minimal --logger "trx;LogFileName=$(pwd)/../TestResults/AST.trx" | true
# Return to workspace root
cd "$REPO_ROOT"
echo "TRX file generated at TestResults/AST.trx"
# Remove absolute paths from TRX file to make it generic
echo "Removing absolute paths from TRX file..."
if [[ -f "TestResults/AST.trx" ]]; then
# Replace all instances of the repo root path and its subdirectories with relative paths (case-insensitive)
# This handles cases like /full/path/to/repo/src/ -> src/
sed -i "s|$REPO_ROOT/||gI" "TestResults/AST.trx"
# Also handle case where repo root appears without trailing slash (case-insensitive)
sed -i "s|$REPO_ROOT||gI" "TestResults/AST.trx"
echo "Absolute paths removed from TRX file"
else
echo "Warning: TRX file not found at TestResults/AST.trx"
fi
# Generate markdown summary
echo "Generating markdown summary..."
./GenerateSummary.sh Ast
# Strip GUIDs and timestamps from TRX file and convert to XML
echo "Stripping GUIDs and timestamps from TRX file..."
if [[ -f "TestResults/AST.trx" ]]; then
# Strip GUIDs and timestamps, convert to XML with sorted test results
./strip-xml-guids.sh --sort "TestResults/AST.trx" "TestResults/Ast.xml"
# Remove the original TRX file since we now have the clean XML version
rm "TestResults/AST.trx"
echo "Clean XML file generated at TestResults/Ast.xml"
else
echo "Warning: TRX file not found, skipping GUID/timestamp stripping"
fi
echo "Done!"