mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 06:36:36 +00:00
243b69656b
- Modified `.gitignore` to reflect the new path for test results. - Updated `docker-compose.test.yml` to mount the correct test results directory. - Adjusted `Dockerfile.test` to set the `PYTHONPATH` and ensure test results are saved in the updated location. - Added `boto3` and `netron` to `requirements-test.txt` to support new functionalities. - Updated `pytest.ini` to include the new `pythonpath` for test discovery. These changes streamline the testing process and ensure compatibility with the updated directory structure.
65 lines
1.9 KiB
Bash
Executable File
65 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||
RESULTS_DIR="$PROJECT_ROOT/tests/test-results"
|
||
|
||
cleanup() {
|
||
if [ -d "$RESULTS_DIR" ]; then
|
||
echo "Results saved to $RESULTS_DIR"
|
||
fi
|
||
}
|
||
trap cleanup EXIT
|
||
|
||
mkdir -p "$RESULTS_DIR"
|
||
|
||
echo "════════════════════════════════════"
|
||
echo " Performance Tests"
|
||
echo "════════════════════════════════════"
|
||
echo ""
|
||
echo "Thresholds (from test spec):"
|
||
echo " PT-AUG-01 Augmentation 10 images ≤ 60s"
|
||
echo " PT-AUG-02 Parallel speedup ≥ 1.5×"
|
||
echo " PT-DSF-01 Dataset formation 100 img ≤ 30s"
|
||
echo " PT-ENC-01 Encrypt/decrypt 10MB ≤ 5s"
|
||
echo " PT-INF-01 ONNX inference single ≤ 10s"
|
||
echo ""
|
||
|
||
cd "$PROJECT_ROOT"
|
||
|
||
FAILED=0
|
||
|
||
if python -m pytest tests/performance/ \
|
||
--tb=short \
|
||
--junitxml="$RESULTS_DIR/performance-results.xml" \
|
||
-v; then
|
||
echo ""
|
||
echo "✓ All performance thresholds met"
|
||
else
|
||
echo ""
|
||
echo "✗ Some performance thresholds exceeded"
|
||
FAILED=1
|
||
fi
|
||
|
||
echo ""
|
||
echo "════════════════════════════════════"
|
||
echo " Summary"
|
||
echo "════════════════════════════════════"
|
||
|
||
if [ -f "$RESULTS_DIR/performance-results.xml" ]; then
|
||
python -c "
|
||
import xml.etree.ElementTree as ET
|
||
t = ET.parse('$RESULTS_DIR/performance-results.xml').getroot()
|
||
print(f\"Tests: {t.get('tests',0)} Failures: {t.get('failures',0)} Errors: {t.get('errors',0)}\")
|
||
" 2>/dev/null || echo "Could not parse performance results XML"
|
||
fi
|
||
|
||
if [ $FAILED -ne 0 ]; then
|
||
echo "EXIT: 1 (thresholds exceeded)"
|
||
exit 1
|
||
fi
|
||
|
||
echo "EXIT: 0 (all thresholds met)"
|
||
exit 0
|