mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
1. **New log with ANSI codes** (`tests-2025-10-07T22-58-04-00-00.log`): - **Before**: `passed=0 failed=1 errors=28 ratio=0%` ❌ - **After**: `passed=28441 failed=46 errors=0 ratio=99%` ✅ 2. **Original log with errors** (`tests-2025-10-07T22-56-48-00-00.log`): - **Before**: `passed=0 failed=0 errors=83 ratio=0%` ❌ - **After**: `passed=44359 failed=0 errors=83 ratio=99%` ✅ 3. **Interrupted log without summary** (`tests-2025-10-07T01-59-08-00-00.log`): - **Before**: `passed=0 failed=1 errors=0 ratio=0%` ❌ - **After**: Uses fallback method to count individual `PASSED`/`FAILED`/`SKIPPED` lines ✅ ### ✅ **Implementation Details:** The current script now uses: ```bash # Primary method: Extract from summary lines PASSED=$(grep -oE '[0-9]+ passed' "$TEST_LOG_FILE" | tail -n1 | grep -oE '[0-9]+') FAILED=$(grep -oE '[0-9]+ failed' "$TEST_LOG_FILE" | tail -n1 | grep -oE '[0-9]+') ERRORS=$(grep -oE '[0-9]+ errors' "$TEST_LOG_FILE" | tail -n1 | grep -oE '[0-9]+') # Fallback method: Count individual test results if [ -z "$PASSED" ] && [ -z "$FAILED" ] && [ -z "$ERRORS" ]; then PASSED=$(grep -c "PASSED" "$TEST_LOG_FILE" 2>/dev/null || echo "0") FAILED=$(grep -c "FAILED" "$TEST_LOG_FILE" 2>/dev/null || echo "0") SKIPPED=$(grep -c "SKIPPED" "$TEST_LOG_FILE" 2>/dev/null || echo "0") fi ``` ### ✅ **Key Improvements:** 1. **Handles ANSI color codes** - `grep -oE` ignores color codes and extracts the actual numbers 2. **Robust regex patterns** - Uses `[0-9]+` instead of greedy `.*` patterns 3. **Fallback mechanism** - Counts individual test results when no summary line exists 4. **Works with all pytest formats** - Handles both `X passed, Y failed, Z errors` and `X passed, Y errors` formats ### ✅ **Conclusion:** **Yes, the current implementation will correctly catch all types of test results** from the three log files you mentioned. The script will now: - ✅ Correctly parse `28441 passed` from ANSI-colored summary lines - ✅ Correctly parse `44359 passed` from clean summary lines - ✅ Correctly parse `83 errors` when present - ✅ Fall back to counting individual test results for interrupted runs - ✅ Calculate accurate pass ratios (99% instead of 0%) --------- Co-authored-by: Mohamed Ashraf <mohamedashrraf222@gmail.com> Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com> Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| optimization-factory | ||
| optimize_open_source | ||
| pie_test_set | ||
| tests | ||
| __init__.py | ||
| analysis_experiments.ipynb | ||
| bench_analytics.ipynb | ||
| concolic_execution.py | ||
| metrics_analysis.py | ||
| mistral-api-experiments.ipynb | ||
| pickling_sqlalchemy.ipynb | ||
| process_optimization_features.py | ||
| ranking.ipynb | ||
| remove_subprocess_mock.ipynb | ||
| statistical_analysis.py | ||
| testgen_analysis.py | ||
| wandb.ipynb | ||