1818# ./run_tests.sh --functional # Run only functional tests (with ASAN)
1919# ./run_tests.sh --performance # Run only performance tests (without ASAN)
2020# ./run_tests.sh --video # Run only video file playback tests (Release mode)
21+ # ./run_tests.sh --writer # Run only video writer tests (Release mode, macOS/Windows)
2122# ./run_tests.sh --avx2 # Run only AVX2 performance tests
2223# ./run_tests.sh --shuffle # Run only tests with names containing 'shuffle' (case-insensitive) in functional tests
2324# ./run_tests.sh --no-sanitize # Disable ASAN for all tests
@@ -75,6 +76,7 @@ RUN_ALL=false
7576RUN_FUNCTIONAL=true
7677RUN_PERFORMANCE=true
7778RUN_VIDEO=false
79+ RUN_WRITER=false
7880SKIP_BUILD=false
7981EXIT_WHEN_FAILED=false
8082GTEST_FAIL_FAST_PARAM=" "
@@ -91,6 +93,7 @@ while [[ $# -gt 0 ]]; do
9193 RUN_FUNCTIONAL=true
9294 RUN_PERFORMANCE=true
9395 RUN_VIDEO=true
96+ RUN_WRITER=true
9497 shift
9598 ;;
9699 -f | --functional)
@@ -116,6 +119,13 @@ while [[ $# -gt 0 ]]; do
116119 RUN_VIDEO=true
117120 shift
118121 ;;
122+ --writer)
123+ # Video writer tests only (Release mode, macOS/Windows only)
124+ RUN_FUNCTIONAL=false
125+ RUN_PERFORMANCE=false
126+ RUN_WRITER=true
127+ shift
128+ ;;
119129 --shuffle)
120130 # Functional only, and later restrict to tests containing 'shuffle' (case-insensitive)
121131 RUN_FUNCTIONAL=true
@@ -151,6 +161,7 @@ while [[ $# -gt 0 ]]; do
151161 echo " $0 --functional # Run only functional tests (Debug mode, with ASAN)"
152162 echo " $0 --performance # Run only performance tests (Release mode, without ASAN)"
153163 echo " $0 --video # Run only video file playback tests (Release mode)"
164+ echo " $0 --writer # Run only video writer tests (Release mode, macOS/Windows)"
154165 echo " $0 --avx2 # Run only AVX2 performance tests (Release mode)"
155166 echo " $0 --shuffle # Run only tests whose names contain '*shuffle*' or '*Shuffle*' in functional tests"
156167 echo " $0 --skip-build # Skip build step, run tests only"
215226TEST_RESULT=0
216227PERF_RESULT=0
217228VIDEO_RESULT=0
229+ WRITER_RESULT=0
218230
219231# Determine ASAN usage
220232# Functional tests: default enabled, Performance tests: default disabled
@@ -317,13 +329,15 @@ if [ "$RUN_FUNCTIONAL" = true ]; then
317329fi
318330
319331# Build Release version for performance tests or video tests
320- if [ " $RUN_PERFORMANCE " = true ] || [ " $RUN_VIDEO " = true ]; then
332+ if [ " $RUN_PERFORMANCE " = true ] || [ " $RUN_VIDEO " = true ] || [ " $RUN_WRITER " = true ] ; then
321333 echo " "
322334 echo -e " ${PURPLE} ===============================================${NC} "
323335 if [ " $SKIP_BUILD " = true ]; then
324336 echo -e " ${BLUE} Skipping build, using existing Release binaries${NC} "
325337 else
326- if [ " $RUN_VIDEO " = true ]; then
338+ if [ " $RUN_WRITER " = true ] && [ " $RUN_VIDEO " != true ] && [ " $RUN_PERFORMANCE " != true ]; then
339+ echo -e " ${BLUE} Building Release version (for video writer tests)${NC} "
340+ elif [ " $RUN_VIDEO " = true ]; then
327341 echo -e " ${BLUE} Building Release version (for video file playback tests)${NC} "
328342 else
329343 echo -e " ${BLUE} Building Release version (for performance tests)${NC} "
@@ -365,6 +379,9 @@ if [ "$RUN_PERFORMANCE" = true ] || [ "$RUN_VIDEO" = true ]; then
365379 if [ " $RUN_VIDEO " = true ]; then
366380 cmake --build . --config Release --target ccap_file_playback_test --parallel $( detectCores)
367381 fi
382+ if [ " $RUN_WRITER " = true ]; then
383+ cmake --build . --config Release --target ccap_video_writer_test --parallel $( detectCores)
384+ fi
368385 cd ..
369386 else
370387 # Linux/Mac: use separate Release directory
@@ -386,6 +403,9 @@ if [ "$RUN_PERFORMANCE" = true ] || [ "$RUN_VIDEO" = true ]; then
386403 if [ " $RUN_VIDEO " = true ]; then
387404 cmake --build . --config Release --target ccap_file_playback_test --parallel $( detectCores)
388405 fi
406+ if [ " $RUN_WRITER " = true ]; then
407+ cmake --build . --config Release --target ccap_video_writer_test --parallel $( detectCores)
408+ fi
389409 cd ../..
390410 fi
391411 fi
@@ -564,6 +584,45 @@ if [ "$RUN_VIDEO" = true ]; then
564584 fi
565585fi
566586
587+ # Run video writer tests in Release mode (macOS/Windows only)
588+ WRITER_RESULT=0
589+ if [ " $RUN_WRITER " = true ]; then
590+ echo " "
591+ echo " ==============================================="
592+ echo -e " ${GREEN} Running Video Writer Tests (Release)${NC} "
593+ echo " ==============================================="
594+
595+ # Determine test executable path based on platform
596+ if isWindows; then
597+ WRITER_EXECUTABLE=" ./build/tests/Release/ccap_video_writer_test.exe"
598+ else
599+ WRITER_EXECUTABLE=" ./build/Release/tests/ccap_video_writer_test"
600+ fi
601+
602+ if [ -f " $WRITER_EXECUTABLE " ]; then
603+ echo -e " ${YELLOW} Running video writer tests in Release mode...${NC} "
604+
605+ " $WRITER_EXECUTABLE " $GTEST_FAIL_FAST_PARAM --gtest_output=xml:build/writer_test_results_release.xml
606+
607+ WRITER_RESULT=$?
608+
609+ if [ $WRITER_RESULT -eq 0 ]; then
610+ echo -e " ${GREEN} ✓ Video writer tests PASSED${NC} "
611+ else
612+ echo -e " ${RED} ✗ Video writer tests FAILED${NC} "
613+ if [ " $EXIT_WHEN_FAILED " = true ]; then
614+ echo -e " ${RED} ❌ Exiting due to --exit-when-failed flag${NC} "
615+ exit 1
616+ fi
617+ fi
618+ else
619+ echo -e " ${YELLOW} ⚠ ccap_video_writer_test executable not found at $WRITER_EXECUTABLE ${NC} "
620+ echo -e " ${YELLOW} Video writer is only available on Windows and macOS with CCAP_ENABLE_VIDEO_WRITER=ON${NC} "
621+ # Not a failure on Linux - writer is not supported there
622+ WRITER_RESULT=0
623+ fi
624+ fi
625+
567626echo " "
568627echo " ==============================================="
569628echo -e " ${GREEN} Test Summary${NC} "
@@ -584,6 +643,10 @@ if [ "$RUN_VIDEO" = true ] && [ $VIDEO_RESULT -ne 0 ]; then
584643 OVERALL_RESULT=1
585644fi
586645
646+ if [ " $RUN_WRITER " = true ] && [ $WRITER_RESULT -ne 0 ]; then
647+ OVERALL_RESULT=1
648+ fi
649+
587650if [ $OVERALL_RESULT -eq 0 ]; then
588651 echo -e " ${GREEN} 🎉 All tests PASSED!${NC} "
589652
@@ -601,6 +664,9 @@ if [ $OVERALL_RESULT -eq 0 ]; then
601664 if [ " $RUN_VIDEO " = true ]; then
602665 echo -e " ${GREEN} ✓ Video file playback tests (Release mode)${NC} "
603666 fi
667+ if [ " $RUN_WRITER " = true ]; then
668+ echo -e " ${GREEN} ✓ Video writer tests (Release mode)${NC} "
669+ fi
604670
605671 exit 0
606672else
614680 if [ " $RUN_VIDEO " = true ] && [ $VIDEO_RESULT -ne 0 ]; then
615681 echo -e " ${RED} - Video file playback tests failed${NC} "
616682 fi
683+ if [ " $RUN_WRITER " = true ] && [ $WRITER_RESULT -ne 0 ]; then
684+ echo -e " ${RED} - Video writer tests failed${NC} "
685+ fi
617686 exit 1
618687fi
0 commit comments