diff --git a/.github/workflows/camera-test-libpisp.yml b/.github/workflows/camera-test-libpisp.yml new file mode 100644 index 0000000..3b29b2b --- /dev/null +++ b/.github/workflows/camera-test-libpisp.yml @@ -0,0 +1,50 @@ +name: Camera Tests + +on: + pull_request_target: + branches: [main] + +permissions: + statuses: write + +jobs: + trigger-camera-tests: + runs-on: [self-hosted, camera-test-bridge] + if: >- + github.event.pull_request.head.repo.full_name == github.repository + timeout-minutes: 120 + steps: + - name: Checkout camera_tester + env: + CAMERA_TESTER_URL: ${{ secrets.CAMERA_TESTER_URL }} + CAMERA_TESTER_PROJECT_ID: ${{ vars.CAMERA_TESTER_PROJECT_ID }} + CAMERA_TESTER_API_TOKEN: ${{ secrets.CAMERA_TESTER_API_TOKEN }} + run: | + CLONE_URL=$(curl -sf -H "PRIVATE-TOKEN: ${CAMERA_TESTER_API_TOKEN}" \ + "${CAMERA_TESTER_URL}/api/v4/projects/${CAMERA_TESTER_PROJECT_ID}" \ + | python3 -c "import sys, json; print(json.load(sys.stdin)['http_url_to_repo'])") + AUTH_URL="${CLONE_URL/https:\/\//https://oauth2:${CAMERA_TESTER_API_TOKEN}@}" + find . -mindepth 1 -delete 2>/dev/null || true + git clone --depth 1 "$AUTH_URL" . + + - name: Install camera_tester + run: | + python3 -m venv .venv + . .venv/bin/activate + pip install -e . + + - name: Run bridge + env: + LIBRARY: libpisp + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_BASE_REF: ${{ github.base_ref }} + CAMERA_TESTER_URL: ${{ secrets.CAMERA_TESTER_URL }} + CAMERA_TESTER_PROJECT_ID: ${{ vars.CAMERA_TESTER_PROJECT_ID }} + CAMERA_TESTER_TRIGGER_TOKEN: ${{ secrets.CAMERA_TESTER_TRIGGER_TOKEN }} + CAMERA_TESTER_API_TOKEN: ${{ secrets.CAMERA_TESTER_API_TOKEN }} + run: | + . .venv/bin/activate + python -m camera_tester.bridge diff --git a/.github/workflows/libpisp-build-test.yaml b/.github/workflows/libpisp-build-test.yaml deleted file mode 100644 index 8db6d05..0000000 --- a/.github/workflows/libpisp-build-test.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: BSD-2-Clause -# Copyright (C) 2023, Raspberry Pi Ltd - -name: libpisp build test - -on: - workflow_dispatch: - - pull_request: - branches: [ main ] - -jobs: - build-test: - strategy: - matrix: - os: [ ubuntu-latest, ubuntu-24.04-arm ] - compiler: [ g++, clang++ ] - build_type: [ release, debug ] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - clean: true - - - name: Install meson and ninja - run: pip3 install --user meson ninja - - - name: Install boost dependencies - run: sudo apt install -y libboost-log-dev libboost-thread-dev - - - name: Configure meson - run: CXX=${{matrix.compiler}} meson setup build_${{matrix.compiler}}_${{matrix.build_type}} -Dbuildtype=${{matrix.build_type}} -Dexamples=true - timeout-minutes: 5 - - - name: Build - run: ninja -C build_${{matrix.compiler}}_${{matrix.build_type}} - timeout-minutes: 10 diff --git a/.github/workflows/pisp-verification.test.yaml b/.github/workflows/pisp-verification.test.yaml deleted file mode 100644 index 99374ea..0000000 --- a/.github/workflows/pisp-verification.test.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# SPDX-License-Identifier: BSD-2-Clause -# Copyright (C) 2023, Raspberry Pi Ltd - -name: pisp verification tests - -on: - workflow_dispatch: - - pull_request: - branches: [ main ] - -env: - BE_TEST_DIR: "${{github.workspace}}/../be_test" - LKG_DIR: "${{github.workspace}}/../lkg" - TESTS_DIR: "/home/pi/pisp_tests" - -jobs: - build-test: - - runs-on: [ self-hosted, pi5 ] - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - clean: true - - - name: Configure meson - run: meson setup build -Dbuildtype=debug -Dexamples=true - timeout-minutes: 5 - - - name: Build - run: ninja -C build - timeout-minutes: 10 - - run-test: - - runs-on: [ self-hosted, pi5 ] - needs: build-test - - steps: - - name: Run verification tests - run: LD_LIBRARY_PATH=${{github.workspace}}/build/src LIBPISP_BE_CONFIG_FILE="${{github.workspace}}/src/libpisp/backend/backend_default_config.json" ${{env.BE_TEST_DIR}}/run_be_tests.py --hw --logall --test ${{env.BE_TEST_DIR}}/be_test ${{env.TESTS_DIR}}/back_end - timeout-minutes: 20 - - - name: Run convert tests - run: LD_LIBRARY_PATH=${{github.workspace}}/build/src LIBPISP_BE_CONFIG_FILE="${{github.workspace}}/src/libpisp/backend/backend_default_config.json" python3 ${{github.workspace}}/utils/test_convert.py ${{github.workspace}}/build/src/examples/convert --out /tmp/ --in $HOME/libpisp_conv/ --ref ~/libpisp_conv/ref/ - timeout-minutes: 10 diff --git a/src/helpers/buffer.cpp b/src/helpers/buffer.cpp index 8d357d3..7919778 100644 --- a/src/helpers/buffer.cpp +++ b/src/helpers/buffer.cpp @@ -62,6 +62,11 @@ const std::array &Buffer::Sync::Get() const return buffer_.get().mem; } +const std::array &Buffer::Sync::Size() const +{ + return buffer_.get().Size(); +} + Buffer::Buffer() : size(), mem(), fd({ -1, -1, -1 }) { diff --git a/src/helpers/buffer.hpp b/src/helpers/buffer.hpp index 3f54fd8..5e41cd8 100644 --- a/src/helpers/buffer.hpp +++ b/src/helpers/buffer.hpp @@ -63,6 +63,7 @@ struct Buffer::Sync ~Sync(); const std::array &Get() const; + const std::array &Size() const; private: BufferRef buffer_;