Skip to content

Commit e979143

Browse files
fix the smoke tests
1 parent 6725e92 commit e979143

2 files changed

Lines changed: 31 additions & 13 deletions

File tree

‎.github/workflows/builds.yml‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,26 @@ jobs:
9999
if: runner.os != 'Windows'
100100
shell: bash
101101
run: |
102-
set -eux
102+
set -euo pipefail
103+
103104
sdk_root="$(ls -d build/_deps/livekit-sdk/* | head -n 1)"
104105
echo "SDK root: ${sdk_root}"
105106
ls -la "${sdk_root}/lib" || true
106-
107+
# Locate executable (it may not be directly under build/)
108+
exe="$(find build -type f -name basic_room -perm -111 | head -n 1)"
109+
if [[ -z "${exe}" ]]; then
110+
echo "basic_room executable not found under build/"
111+
find build -maxdepth 3 -type f -print
112+
exit 1
113+
fi
114+
echo "Running: ${exe} --self-test"
107115
if [[ "$RUNNER_OS" == "Linux" ]]; then
108116
export LD_LIBRARY_PATH="${sdk_root}/lib:${LD_LIBRARY_PATH:-}"
109117
else
110118
export DYLD_LIBRARY_PATH="${sdk_root}/lib:${DYLD_LIBRARY_PATH:-}"
111119
fi
120+
"${exe}" --self-test
112121
113-
./build/basic_room --help || true
114122
115123
- name: Smoke test (Windows)
116124
if: runner.os == 'Windows'
@@ -122,24 +130,22 @@ jobs:
122130
throw "SDK root not found under build/_deps/livekit-sdk"
123131
}
124132
Write-Host "SDK root: $($sdkRoot.FullName)"
125-
126133
# Make sure DLLs are found at runtime
127134
$env:PATH = "$($sdkRoot.FullName)\bin;$($sdkRoot.FullName)\lib;$env:PATH"
128-
129135
# Locate the built executable
130136
$exe = Get-ChildItem -Recurse build -Filter basic_room.exe | Select-Object -First 1
131137
if (-not $exe) {
132138
throw "basic_room.exe not found in build directory"
133139
}
134-
135140
Write-Host "Running $($exe.FullName) --help"
136-
137141
# Try to execute it. We only care that it launches.
138-
& $exe.FullName --help 2>$null
139-
if ($LASTEXITCODE -ne 0) {
140-
Write-Host "basic_room.exe exited with code $LASTEXITCODE (allowed for --help)"
142+
$out = & $exe.FullName --self-test 2>&1
143+
$code = $LASTEXITCODE
144+
if ($code -ne 0) {
145+
Write-Host $out
146+
throw "basic_room.exe --self-test failed with exit code $code"
141147
}
142-
148+
Write-Host $out
143149
144150
# ---------- upload build output ----------
145151
- name: Upload binary

‎basic_room/main.cpp‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@ void printUsage(const char *prog) {
4141
<< " LIVEKIT_URL, LIVEKIT_TOKEN\n";
4242
}
4343

44-
bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
44+
bool parseArgs(int argc, char *argv[], std::string &url, std::string &token, bool &self_test) {
4545
for (int i = 1; i < argc; ++i) {
4646
const std::string a = argv[i];
4747
if (a == "-h" || a == "--help")
4848
return false;
4949

50+
if (a == "--self-test") {
51+
self_test = true;
52+
return true;
53+
}
54+
5055
auto take = [&](std::string &out) -> bool {
5156
if (i + 1 >= argc)
5257
return false;
@@ -83,10 +88,17 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token) {
8388

8489
int main(int argc, char *argv[]) {
8590
std::string url, token;
86-
if (!parseArgs(argc, argv, url, token)) {
91+
bool self_test = false;
92+
if (!parseArgs(argc, argv, url, token, self_test)) {
8793
printUsage(argv[0]);
8894
return 1;
8995
}
96+
if (self_test) {
97+
livekit::initialize(livekit::LogSink::kConsole);
98+
livekit::shutdown();
99+
std::cout << "self-test ok" << std::endl;
100+
return 0;
101+
}
90102

91103
std::signal(SIGINT, handleSignal);
92104

0 commit comments

Comments
 (0)