Skip to content

Commit ebfe4a5

Browse files
packaging tests
1 parent e1e6a80 commit ebfe4a5

7 files changed

Lines changed: 146 additions & 22 deletions

File tree

‎.github/workflows/builds.yml‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,29 +386,30 @@ jobs:
386386
test -f "${bundle}/lib/cmake/LiveKit/LiveKitConfigVersion.cmake"
387387
test -f "${bundle}/lib/cmake/LiveKit/LiveKitTargets.cmake"
388388
389-
- name: Smoke-test installed capture SDK (Unix)
389+
- name: Test installed capture SDK (Unix)
390390
if: matrix.capture == true && runner.os != 'Windows'
391391
shell: bash
392392
run: |
393393
bundle="$GITHUB_WORKSPACE/sdk-out/livekit-sdk-${{ matrix.name }}"
394394
arch_args=()
395395
if [[ "${{ matrix.name }}" == macos-x64* ]]; then arch_args+=(-DCMAKE_OSX_ARCHITECTURES=x86_64); fi
396-
cmake -S scripts/capture-bundle-smoke -B capture-smoke -G Ninja \
397-
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$bundle" "${arch_args[@]}"
398-
cmake --build capture-smoke
399-
./capture-smoke/capture_bundle_smoke
396+
cmake -S src/tests/packaging -B build-packaging-tests -G Ninja \
397+
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$bundle" \
398+
-DLIVEKIT_EXPECT_CAPTURE=ON "${arch_args[@]}"
399+
cmake --build build-packaging-tests
400+
ctest --test-dir build-packaging-tests -C Release --output-on-failure -L packaging
400401
401-
- name: Smoke-test installed capture SDK (Windows)
402+
- name: Test installed capture SDK (Windows)
402403
if: matrix.capture == true && runner.os == 'Windows'
403404
shell: pwsh
404405
run: |
405406
$bundle = Join-Path $env:GITHUB_WORKSPACE "sdk-out/livekit-sdk-${{ matrix.name }}"
406-
cmake -S scripts/capture-bundle-smoke -B capture-smoke -DCMAKE_PREFIX_PATH="$bundle"
407+
cmake -S src/tests/packaging -B build-packaging-tests -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE=ON
407408
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
408-
cmake --build capture-smoke --config Release
409+
cmake --build build-packaging-tests --config Release
409410
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
410411
$env:PATH = "$bundle\bin;$env:PATH"
411-
& .\capture-smoke\Release\capture_bundle_smoke.exe
412+
ctest --test-dir build-packaging-tests -C Release --output-on-failure -L packaging
412413
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
413414
414415
# ---------- Upload artifacts ----------

‎.github/workflows/ci.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
- .github/workflows/make-release.yml
5353
- .github/actions/setup-capture/**
5454
- .github/scripts/check_no_private_symbols.py
55-
- scripts/capture-bundle-smoke/**
5655
tests:
5756
- src/**
5857
- include/**

‎.github/workflows/make-release.yml‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -380,29 +380,30 @@ jobs:
380380
throw "Build info is missing livekit-ffi version"
381381
}
382382
383-
- name: Smoke-test installed capture SDK (Unix)
383+
- name: Test installed capture SDK (Unix)
384384
if: matrix.capture == true && runner.os != 'Windows'
385385
shell: bash
386386
run: |
387387
bundle="$GITHUB_WORKSPACE/sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}"
388388
arch_args=()
389389
if [[ "${{ matrix.name }}" == macos-x64* ]]; then arch_args+=(-DCMAKE_OSX_ARCHITECTURES=x86_64); fi
390-
cmake -S scripts/capture-bundle-smoke -B capture-smoke -G Ninja \
391-
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$bundle" "${arch_args[@]}"
392-
cmake --build capture-smoke
393-
./capture-smoke/capture_bundle_smoke
390+
cmake -S src/tests/packaging -B build-packaging-tests -G Ninja \
391+
-DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$bundle" \
392+
-DLIVEKIT_EXPECT_CAPTURE=ON "${arch_args[@]}"
393+
cmake --build build-packaging-tests
394+
ctest --test-dir build-packaging-tests -C Release --output-on-failure -L packaging
394395
395-
- name: Smoke-test installed capture SDK (Windows)
396+
- name: Test installed capture SDK (Windows)
396397
if: matrix.capture == true && runner.os == 'Windows'
397398
shell: pwsh
398399
run: |
399400
$bundle = Join-Path $env:GITHUB_WORKSPACE "sdk-out/livekit-sdk-${{ matrix.name }}-${{ steps.version.outputs.version }}"
400-
cmake -S scripts/capture-bundle-smoke -B capture-smoke -DCMAKE_PREFIX_PATH="$bundle"
401+
cmake -S src/tests/packaging -B build-packaging-tests -DCMAKE_PREFIX_PATH="$bundle" -DLIVEKIT_EXPECT_CAPTURE=ON
401402
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
402-
cmake --build capture-smoke --config Release
403+
cmake --build build-packaging-tests --config Release
403404
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
404405
$env:PATH = "$bundle\bin;$env:PATH"
405-
& .\capture-smoke\Release\capture_bundle_smoke.exe
406+
ctest --test-dir build-packaging-tests -C Release --output-on-failure -L packaging
406407
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
407408
408409
# ---------- Upload artifact (raw directory, no pre-compression) ----------

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Be sure to update the directory layout in this file if the directory layout chan
9494
| `scripts/` | Local helper scripts for SDK-specific development tasks |
9595
| `docs/` | Documentation root. `docs/` holds hand-written long-form Markdown intended to also read well on GitHub. |
9696
| `docs/doxygen/` | Doxygen tool config, theme assets, and Doxygen-only content (`Doxyfile`, `index.md` mainpage, `customization/*.css`, `customization/header.html`, `customization/favicon.ico`). Files here use Doxygen-only syntax (`@ref`, `@brief`, …) and are not intended for human reading on their own. |
97-
| `scripts/capture-bundle-smoke/` | Standalone downstream CMake consumer that validates capture-enabled SDK bundles |
97+
| `src/tests/packaging/` | Standalone CTest integration tests consuming installed SDK bundles |
9898
| `.github/actions/setup-capture/` | Shared CI setup for capture runtime and development dependencies |
9999
| `.github/workflows/` | GitHub Actions CI workflows |
100100

@@ -132,8 +132,8 @@ Both build scripts accept `--capture` to enable GStreamer, pattern, and clock
132132
sources, and `--no-capture` to disable them. Test/all presets enable capture by
133133
default; normal and example presets disable it. Capture-enabled builds need
134134
GStreamer development and runtime libraries. Release workflows publish separate
135-
`-capture` bundles and validate creation through the installed SDK using
136-
`scripts/capture-bundle-smoke/`.
135+
`-capture` bundles and validate creation through the installed SDK using the standalone CTest project in
136+
`src/tests/packaging/`.
137137

138138
Rust FFI outputs live under `client-sdk-rust/target/cpp-<feature-hash>/` to isolate
139139
Cargo feature configurations. Generated public build metadata lives under each

‎docs/testing.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,32 @@ export LIVEKIT_TOKEN_B="$(lk token create --api-key devkey --api-secret secret -
9898
--token-only)"
9999
```
100100

101+
## Installed SDK packaging tests
102+
103+
`src/tests/packaging/` is a standalone CMake consumer of an installed SDK.
104+
CTest registers `InstalledSdk.Capture` with the `packaging` and `integration`
105+
labels and a 30-second timeout. It checks the bundle's capture metadata and
106+
creates a GStreamer VP8 source through the installed library. It needs no
107+
LiveKit server; capture-enabled runs require GStreamer and the pipeline's plugins.
108+
109+
From the repository root:
110+
111+
```bash
112+
source scripts/set-test-tokens.sh
113+
./build.sh debug --capture --bundle --prefix sdk-out/livekit-sdk-capture
114+
cmake -S src/tests/packaging -B build-packaging-tests \
115+
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$PWD/sdk-out/livekit-sdk-capture" \
116+
-DLIVEKIT_EXPECT_CAPTURE=ON
117+
cmake --build build-packaging-tests --config Debug
118+
ctest --test-dir build-packaging-tests -C Debug --output-on-failure -L packaging
119+
```
120+
121+
Use `LIVEKIT_EXPECT_CAPTURE=OFF` when testing a standard bundle. A mismatch
122+
between the expected capability and the installed header fails the test. In
123+
capture-enabled CI release jobs, the expectation is explicitly `ON`; a disabled
124+
bundle cannot pass by rejecting source creation. On Windows, add the installed
125+
SDK's `bin` directory and GStreamer's `bin` directory to `PATH` before running CTest.
126+
101127
## Test coverage
102128

103129
- **SDK initialization**: initialize / shutdown lifecycle.

‎src/tests/packaging/CMakeLists.txt‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2026 LiveKit
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS,
8+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
# See the License for the specific language governing permissions and
10+
# limitations under the License.
11+
12+
cmake_minimum_required(VERSION 3.20)
13+
project(livekit_packaging_tests LANGUAGES CXX)
14+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
15+
16+
# This is a standalone consumer of an installed SDK, not the in-tree target.
17+
find_package(LiveKit CONFIG REQUIRED)
18+
set(LIVEKIT_EXPECT_CAPTURE "ON" CACHE STRING "Expected capture support in the installed SDK (ON or OFF)")
19+
set_property(CACHE LIVEKIT_EXPECT_CAPTURE PROPERTY STRINGS ON OFF)
20+
if(NOT LIVEKIT_EXPECT_CAPTURE STREQUAL "ON" AND NOT LIVEKIT_EXPECT_CAPTURE STREQUAL "OFF")
21+
message(FATAL_ERROR "LIVEKIT_EXPECT_CAPTURE must be ON or OFF")
22+
endif()
23+
24+
add_executable(livekit_capture_package_test test_capture_bundle.cpp)
25+
target_compile_features(livekit_capture_package_test PRIVATE cxx_std_17)
26+
target_link_libraries(livekit_capture_package_test PRIVATE LiveKit::livekit)
27+
# The installed macOS SDK uses @rpath for its FFI dependency.
28+
if(APPLE)
29+
set_property(TARGET livekit_capture_package_test PROPERTY BUILD_RPATH "$<TARGET_FILE_DIR:LiveKit::livekit>")
30+
endif()
31+
32+
enable_testing()
33+
add_test(NAME InstalledSdk.Capture
34+
COMMAND livekit_capture_package_test "--expect-capture=${LIVEKIT_EXPECT_CAPTURE}")
35+
set_tests_properties(InstalledSdk.Capture PROPERTIES
36+
LABELS "packaging;integration"
37+
TIMEOUT 30
38+
)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright 2026 LiveKit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an “AS IS” BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <livekit/livekit.h>
18+
19+
#include <exception>
20+
#include <iostream>
21+
#include <string_view>
22+
23+
int main(int argc, char** argv) {
24+
if (argc != 2 ||
25+
(std::string_view(argv[1]) != "--expect-capture=ON" && std::string_view(argv[1]) != "--expect-capture=OFF")) {
26+
std::cerr << "Usage: livekit_capture_package_test --expect-capture=ON|OFF\n";
27+
return 2;
28+
}
29+
const bool expect_capture = std::string_view(argv[1]) == "--expect-capture=ON";
30+
if (livekit::kCaptureEnabled != expect_capture) {
31+
std::cerr << "Installed SDK capture metadata does not match the requested expectation\n";
32+
return 1;
33+
}
34+
35+
livekit::initialize(livekit::LogLevel::Warn);
36+
int status = 0;
37+
try {
38+
livekit::GstreamerVideoSourceConfig config;
39+
config.pipeline =
40+
"videotestsrc num-buffers=4 ! video/x-raw,width=320,height=240,framerate=30/1 ! "
41+
"vp8enc deadline=1 ! appsink name=lk_appsink";
42+
auto source = livekit::CaptureSource::create(config).get();
43+
if (!expect_capture || !source || source->kind() != livekit::CaptureSourceKind::Encoded || source->width() != 320 ||
44+
source->height() != 240 || source->codec() != livekit::VideoCodec::VP8 || !source->videoSource()) {
45+
std::cerr << "Installed capture SDK returned unexpected source metadata\n";
46+
status = 1;
47+
}
48+
} catch (const livekit::CaptureSourceError& error) {
49+
if (expect_capture) {
50+
std::cerr << "Installed capture SDK failed: " << error.what() << '\n';
51+
status = 1;
52+
}
53+
} catch (const std::exception& error) {
54+
std::cerr << error.what() << '\n';
55+
status = 1;
56+
}
57+
livekit::shutdown();
58+
return status;
59+
}

0 commit comments

Comments
 (0)