diff --git a/.github/workflows/OCV-PR-LINUX-24-ASan.yaml b/.github/workflows/OCV-PR-LINUX-24-ASan.yaml new file mode 100644 index 00000000..ec4fa800 --- /dev/null +++ b/.github/workflows/OCV-PR-LINUX-24-ASan.yaml @@ -0,0 +1,146 @@ +name: OCV PR Linux 24 ASan + +on: + pull_request: + branches: + - main + paths: + - '.github/workflows/OCV-PR-LINUX-24-ASan.yaml' + workflow_call: + inputs: + workflow_branch: + description: "Branch for ci-gha-workflow repository" + default: "main" + required: false + type: string + +concurrency: + group: OCV-PR-Linux-24-ASan-${{ github.ref }} + cancel-in-progress: true + +jobs: + branch_eval: + runs-on: ubuntu-24.04 + outputs: + branches: ${{ steps.determine-branches.outputs.branches }} + steps: + - id: determine-branches + shell: bash + run: | + if [ "${{ github.event.repository.name == 'ci-gha-workflow' }}" = "true" ] ; then + echo "branches=[ '4.x', '5.x' ]" >> "$GITHUB_OUTPUT" + else + echo "branches=[ '${{ github.base_ref }}' ]" >> "$GITHUB_OUTPUT" + fi + + Ubuntu-24-ASan: + runs-on: opencv-cn-lin-x86-64 + timeout-minutes: 180 + needs: + - branch_eval + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}} + defaults: + run: + shell: bash + container: + image: 'quay.io/opencv-ci/opencv-ubuntu-24.04:20251127' + volumes: + - /home/opencv-cn/git_cache:/opt/git_cache + - /home/opencv-cn/ci_cache/opencv/24.04:/opt/.ccache + - /home/opencv-cn/binaries_cache/24.04:/opt/binaries_cache + - /home/opencv-cn/dnn-models:/opt/dnn-models + env: + ANT_HOME: '/usr/share/ant' + DNN_MODELS: '/opt/dnn-models' + CCACHE_DIR: '/opt/.ccache' + CCACHE_MAXSIZE: '8G' + OPENCV_DOWNLOAD_PATH: '/opt/binaries_cache' + CMAKE_OPT: >- + -DOPENCV_ENABLE_NONFREE=ON + -DWITH_IMGCODEC_GIF=ON + -DCPU_BASELINE=AVX2 + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DENABLE_OMIT_FRAME_POINTER=OFF + -DCMAKE_C_FLAGS="-fno-omit-frame-pointer -fsanitize=address" + -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer -fsanitize=address" + -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" + -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address" + HOME: '/home/ubuntu' + MAIN_BUILD_DIR: "${{ (github.event.repository.name != 'opencv_contrib') && 'build' || 'build-contrib' }}" + OPENCV_FOR_THREADS_NUM: 8 + CMAKE_BUILD_PARALLEL_LEVEL: 8 + + steps: + - name: Checkout workflow repository + uses: actions/checkout@v4 + with: + repository: opencv/ci-gha-workflow + ref: "${{ github.repository == 'opencv/ci-gha-workflow' && github.ref || inputs.workflow_branch }}" + + - name: Checkout and merge OpenCV + uses: ./checkout-and-merge + with: + target_branch: "${{ matrix.branch }}" + author: "${{ github.event.pull_request.user.login }}" + source_branch: "${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }}" + gitcache: '/opt/git_cache' + home: '${{ env.HOME }}' + workdir: '${{ env.HOME }}' + + - name: Update extra dnn models + timeout-minutes: 60 + working-directory: '${{ env.HOME }}' + run: | + ls -lR ${{ env.DNN_MODELS }} + python3 opencv_extra/testdata/dnn/download_models.py \ + --cleanup \ + --dst '${{ env.DNN_MODELS }}/dnn' + echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV + + - if: ${{ github.event.repository.name != 'opencv_contrib' }} + name: Configure and build OpenCV + uses: ./configure-and-build + with: + workdir: '${{ env.HOME }}' + builddir: 'build' + generator: 'Ninja' + options: '${{ env.CMAKE_OPT }}' + + - name: Configure and build OpenCV with contrib + uses: ./configure-and-build + with: + workdir: '${{ env.HOME }}' + builddir: 'build-contrib' + generator: 'Ninja' + options: '-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules ${{ env.CMAKE_OPT }}' + + - name: Run OpenCV tests + uses: ./run-tests + timeout-minutes: 100 + env: + OPENCV_TEST_DATA_PATH: '${{ env.HOME }}/opencv_extra/testdata' + OPENCV_TEST_REQUIRE_DATA: 1 + OPENCV_TEST_CHECK_OPTIONAL_DATA: 1 + PYTHONPATH: '${{ env.HOME }}/${{ env.MAIN_BUILD_DIR }}/python_loader:$PYTHONPATH' + ASAN_OPTIONS: 'detect_leaks=1:exitcode=1:abort_on_error=1:halt_on_error=1' + with: + workdir: '${{ env.HOME }}' + builddir: '${{ env.MAIN_BUILD_DIR }}' + logdir: '${{ env.HOME }}/${{ env.MAIN_BUILD_DIR }}' + plan: "test-plan-asan-${{ matrix.branch }}.json" + suite: "[ ${{ (github.event.repository.name == 'opencv_contrib') && '''linux-contrib''' || '''linux''' }} ]" + filter: "[ 'ubuntu-common', 'ubuntu-avx2' ]" + enable_python: "true" + enable_java: "true" + suffix: '24.04_asan_${{ matrix.branch }}' + timeout: "180" + + - if: ${{ always() && env.WARNINGS == '1' }} + name: Warnings check + run: | + echo "::error Warnings have been found!" + exit 1 + \ No newline at end of file diff --git a/scripts/runner.py b/scripts/runner.py index cad4afb8..af224e4f 100644 --- a/scripts/runner.py +++ b/scripts/runner.py @@ -134,7 +134,7 @@ async def run_one(name, cmd, logname, env, args): parser.add_argument("--suite", action="append", required=True, help="Suite in test plan (set of executables), multiple allowed") parser.add_argument("--filter", action="append", help="Filter in test plan (skip some testcases), multiple allowed") parser.add_argument("--options", default="default", help="Options in test plan (extra run options)") - parser.add_argument("--timeout", type=int, default=10, help="Timeout in minutes") + parser.add_argument("--timeout", type=int, default=20, help="Timeout in minutes") parser.add_argument("--prefix", default="out_", help="Prefix to add to logs") parser.add_argument("--workdir", default=".", type=Path, help="Working directory") parser.add_argument("--logdir", default=".", type=Path, help="Directory to store logs (either absolute or relative to workdir)") diff --git a/scripts/test-plan-asan-4.x.json b/scripts/test-plan-asan-4.x.json new file mode 100644 index 00000000..5ddd4704 --- /dev/null +++ b/scripts/test-plan-asan-4.x.json @@ -0,0 +1,107 @@ +{ + "suites": { + "short": [ "opencv_test_core", "opencv_test_imgproc", "opencv_test_photo" ], + + "linux": [ + "opencv_test_calib3d", + "opencv_test_core", + "opencv_test_dnn", + "opencv_test_features2d", + "opencv_test_flann", + "opencv_test_imgcodecs", + "opencv_test_imgproc", + "opencv_test_ml", + "opencv_test_objdetect", + "opencv_test_photo", + "opencv_test_stitching", + "opencv_perf_calib3d", + "opencv_perf_core", + "opencv_perf_dnn", + "opencv_perf_features2d", + "opencv_perf_gapi", + "opencv_perf_imgcodecs", + "opencv_perf_imgproc", + "opencv_perf_objdetect", + "opencv_perf_photo", + "opencv_perf_stitching" + ], + + "linux-contrib": [ + "opencv_test_bgsegm", + "opencv_test_bioinspired", + "opencv_test_dnn_superres", + "opencv_test_face", + "opencv_test_fuzzy", + "opencv_test_hdf", + "opencv_test_img_aug", + "opencv_test_img_hash", + "opencv_test_intensity_transform", + "opencv_test_line_descriptor", + "opencv_test_mcc", + "opencv_test_optflow", + "opencv_test_phase_unwrapping", + "opencv_test_quality", + "opencv_test_rapid", + "opencv_test_reg", + "opencv_test_rgbd", + "opencv_test_saliency", + "opencv_test_sfm", + "opencv_test_shape", + "opencv_test_stereo", + "opencv_test_structured_light", + "opencv_test_superres", + "opencv_test_text", + "opencv_test_tracking", + "opencv_test_videostab", + "opencv_test_wechat_qrcode", + "opencv_test_xfeatures2d", + "opencv_test_ximgproc", + "opencv_test_xphoto", + "opencv_perf_bioinspired", + "opencv_perf_dnn_superres", + "opencv_perf_features2d", + "opencv_perf_line_descriptor", + "opencv_perf_optflow", + "opencv_perf_reg", + "opencv_perf_rgbd", + "opencv_perf_stereo", + "opencv_perf_superres", + "opencv_perf_tracking", + "opencv_perf_xfeatures2d", + "opencv_perf_ximgproc", + "opencv_perf_xphoto" + ] + }, + "filters": { + "ubuntu-common": { + "test_gapi": [ + "AsyncAPICancelation/cancel/*" + ], + "test_videoio": [ + "videoio/videoio_synthetic.write_read_position/*_MPEG_GSTREAMER", + "videoio/videoio_synthetic.write_read_position/*_MJPG_GSTREAMER", + "videoio/videocapture_acceleration.read/yuv420p_mjpeg_mp4_GSTREAMER_*_MAT", + "videoio/videowriter_acceleration.write/mkv_MPEG_GSTREAMER_*_MAT" + ] + }, + "ubuntu-avx2": { + "test_core": [ + "Core_InRangeS/ElemWiseTest.accuracy/0", + "Core_InRange/ElemWiseTest.accuracy/0" + ] + } + }, + "options": { + "default": { + "wrap": { + "highgui": "xvfb-run -a" + }, + "args": { + "test": "--skip_unstable=1", + "perf": "--perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1" + }, + "exe": {}, + "env": {} + } + } +} diff --git a/scripts/test-plan-asan-5.x.json b/scripts/test-plan-asan-5.x.json new file mode 100644 index 00000000..c454c266 --- /dev/null +++ b/scripts/test-plan-asan-5.x.json @@ -0,0 +1,116 @@ +{ + "suites": { + "short": [ "opencv_test_core", "opencv_test_imgproc", "opencv_test_photo" ], + + "linux": [ + "opencv_test_3d", + "opencv_test_calib", + "opencv_test_core", + "opencv_test_dnn_classic", + "opencv_test_dnn", + "opencv_test_features", + "opencv_test_flann", + "opencv_test_imgcodecs", + "opencv_test_imgproc", + "opencv_test_objdetect", + "opencv_test_photo", + "opencv_test_stereo", + "opencv_test_stitching", + "opencv_perf_3d", + "opencv_perf_calib", + "opencv_perf_core", + "opencv_perf_dnn", + "opencv_perf_features", + "opencv_perf_imgcodecs", + "opencv_perf_imgproc", + "opencv_perf_objdetect", + "opencv_perf_photo", + "opencv_perf_stereo", + "opencv_perf_stitching" + ], + + "linux-contrib": [ + "opencv_test_bgsegm", + "opencv_test_bioinspired", + "opencv_test_dnn_superres", + "opencv_test_face", + "opencv_test_fuzzy", + "opencv_test_hdf", + "opencv_test_img_hash", + "opencv_test_intensity_transform", + "opencv_test_line_descriptor", + "opencv_test_ml", + "opencv_test_optflow", + "opencv_test_phase_unwrapping", + "opencv_test_quality", + "opencv_test_rapid", + "opencv_test_reg", + "opencv_test_rgbd", + "opencv_test_saliency", + "opencv_test_sfm", + "opencv_test_shape", + "opencv_test_structured_light", + "opencv_test_superres", + "opencv_test_text", + "opencv_test_tracking", + "opencv_test_videostab", + "opencv_test_wechat_qrcode", + "opencv_test_xfeatures2d", + "opencv_test_ximgproc", + "opencv_test_xobjdetect", + "opencv_test_xphoto", + "opencv_test_xstereo", + "opencv_perf_bioinspired", + "opencv_perf_dnn_superres", + "opencv_perf_gapi", + "opencv_perf_line_descriptor", + "opencv_perf_optflow", + "opencv_perf_reg", + "opencv_perf_superres", + "opencv_perf_tracking", + "opencv_perf_xfeatures2d", + "opencv_perf_ximgproc", + "opencv_perf_xobjdetect", + "opencv_perf_xphoto", + "opencv_perf_xstereo" + ] + }, + "filters": { + "ubuntu-common": { + "test_gapi": [ + "AsyncAPICancelation/cancel/*" + ], + "test_videoio": [ + "videoio/videoio_synthetic.write_read_position/*_MPEG_GSTREAMER", + "videoio/videoio_synthetic.write_read_position/*_MJPG_GSTREAMER", + "videoio/videocapture_acceleration.read/yuv420p_mjpeg_mp4_GSTREAMER_*_MAT", + "videoio/videowriter_acceleration.write/mkv_MPEG_GSTREAMER_*_MAT" + ] + }, + "ubuntu-avx2": { + "test_core": [ + "Core_InRangeS/ElemWiseTest.accuracy/0", + "Core_InRange/ElemWiseTest.accuracy/0" + ] + } + }, + "options": { + "default": { + "wrap": { + "highgui": "xvfb-run -a" + }, + "args": { + "test": "--skip_unstable=1", + "perf": "--perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1" + }, + "exe": { + "opencv_test_dnn_classic": "opencv_test_dnn" + }, + "env": { + "opencv_test_dnn_classic": { + "OPENCV_FORCE_DNN_ENGINE": "1" + } + } + } + } +}