Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
35088e0d
O
Obs Studio
项目概览
小白菜888
/
Obs Studio
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Obs Studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
35088e0d
编写于
4月 19, 2020
作者:
C
Colin Edwards
提交者:
jp9000
6月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libobs: Add sample unit tests leveraging cmocka
上级
381960a7
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
132 addition
and
14 deletion
+132
-14
.github/workflows/main.yml
.github/workflows/main.yml
+12
-5
CI/install-dependencies-osx.sh
CI/install-dependencies-osx.sh
+1
-1
CI/scripts/macos/Brewfile
CI/scripts/macos/Brewfile
+1
-0
CMakeLists.txt
CMakeLists.txt
+6
-1
test/CMakeLists.txt
test/CMakeLists.txt
+11
-5
test/cmocka/CMakeLists.txt
test/cmocka/CMakeLists.txt
+39
-0
test/cmocka/test_darray.c
test/cmocka/test_darray.c
+29
-0
test/cmocka/test_serializer.c
test/cmocka/test_serializer.c
+31
-0
test/osx/test.mm
test/osx/test.mm
+2
-2
未找到文件。
.github/workflows/main.yml
浏览文件 @
35088e0d
...
...
@@ -2,8 +2,6 @@ name: 'CI Multiplatform Build'
on
:
push
:
branches
:
-
master
pull_request
:
paths-ignore
:
-
'
**.md'
...
...
@@ -121,11 +119,15 @@ jobs:
run
:
|
mkdir ./build
cd ./build
cmake -DENABLE_SPARKLE_UPDATER=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DQTDIR="/usr/local/Cellar/qt/${{ env.QT_VERSION }}" -DDepsPath="/tmp/obsdeps" -DVLCPath="${{ github.workspace }}/cmbuild/vlc-${{ env.VLC_VERSION }}" -DENABLE_VLC=ON -DBUILD_BROWSER=ON -DBROWSER_DEPLOY=ON -DBUILD_CAPTIONS=ON -DWITH_RTMPS=ON -DCEF_ROOT_DIR="${{ github.workspace }}/cmbuild/cef_binary_${{ env.CEF_BUILD_VERSION }}_macosx64" ..
cmake -DENABLE_
UNIT_TESTS=YES -DENABLE_
SPARKLE_UPDATER=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DQTDIR="/usr/local/Cellar/qt/${{ env.QT_VERSION }}" -DDepsPath="/tmp/obsdeps" -DVLCPath="${{ github.workspace }}/cmbuild/vlc-${{ env.VLC_VERSION }}" -DENABLE_VLC=ON -DBUILD_BROWSER=ON -DBROWSER_DEPLOY=ON -DBUILD_CAPTIONS=ON -DWITH_RTMPS=ON -DCEF_ROOT_DIR="${{ github.workspace }}/cmbuild/cef_binary_${{ env.CEF_BUILD_VERSION }}_macosx64" ..
-
name
:
'
Build'
shell
:
bash
working-directory
:
${{ github.workspace }}/build
run
:
make -j4
-
name
:
'
Test'
shell
:
bash
working-directory
:
${{ github.workspace }}/build
run
:
make CTEST_OUTPUT_ON_FAILURE=1 test
-
name
:
'
Install
prerequisite:
Packages
app'
if
:
success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
shell
:
bash
...
...
@@ -289,7 +291,8 @@ jobs:
python3-dev \
qtbase5-dev \
libqt5svg5-dev \
swig
swig \
libcmocka-dev
-
name
:
'
Restore
Chromium
Embedded
Framework
from
cache'
id
:
cef-cache
uses
:
actions/cache@v1
...
...
@@ -310,11 +313,15 @@ jobs:
run
:
|
mkdir ./build
cd ./build
cmake -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/obs-studio-portable" -DENABLE_VLC=ON -DBUILD_CAPTIONS=ON -DWITH_RTMPS=ON -DBUILD_BROWSER=ON -DCEF_ROOT_DIR="${{ github.workspace }}/cmbuild/cef_binary_${{ env.CEF_BUILD_VERSION }}_linux64" ..
cmake -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/obs-studio-portable" -DENABLE_
UNIT_TESTS=ON -DENABLE_
VLC=ON -DBUILD_CAPTIONS=ON -DWITH_RTMPS=ON -DBUILD_BROWSER=ON -DCEF_ROOT_DIR="${{ github.workspace }}/cmbuild/cef_binary_${{ env.CEF_BUILD_VERSION }}_linux64" ..
-
name
:
'
Build'
shell
:
bash
working-directory
:
${{ github.workspace }}/build
run
:
make -j4
-
name
:
'
Test'
shell
:
bash
working-directory
:
${{ github.workspace }}/build
run
:
make CTEST_OUTPUT_ON_FAILURE=1 test
-
name
:
'
Package'
if
:
success() && (github.event_name != 'pull_request' || contains( github.event.pull_request.labels.*.name, 'Seeking Testers'))
shell
:
bash
...
...
CI/install-dependencies-osx.sh
浏览文件 @
35088e0d
...
...
@@ -28,7 +28,7 @@ sudo installer -pkg ./Packages.pkg -target /
brew update
#Base OBS Deps and ccache
for
DEPENDENCY
in
jack speexdsp ccache mbedtls freetype fdk-aac
;
do
for
DEPENDENCY
in
jack speexdsp ccache mbedtls freetype fdk-aac
cmocka
;
do
if
[
!
-d
"
$(
brew
--cellar
)
/
${
DEPENDENCY
}
"
]
;
then
brew
install
$DEPENDENCY
else
...
...
CI/scripts/macos/Brewfile
浏览文件 @
35088e0d
...
...
@@ -4,6 +4,7 @@ brew "speexdsp"
brew "cmake"
brew "freetype"
brew "fdk-aac"
brew "cmocka"
brew "https://gist.githubusercontent.com/DDRBoxman/9c7a2b08933166f4b61ed9a44b242609/raw/ef4de6c587c6bd7f50210eccd5bd51ff08e6de13/qt.rb", link: true
brew "https://gist.githubusercontent.com/DDRBoxman/4cada55c51803a2f963fa40ce55c9d3e/raw/572c67e908bfbc1bcb8c476ea77ea3935133f5b5/swig.rb", link: true
brew "akeru-inc/tap/xcnotary"
CMakeLists.txt
浏览文件 @
35088e0d
...
...
@@ -244,7 +244,12 @@ if(NOT INSTALLER_RUN)
add_subdirectory
(
libobs
)
add_subdirectory
(
plugins
)
add_subdirectory
(
UI
)
if
(
BUILD_TESTS
)
if
(
ENABLE_UNIT_TESTS
)
enable_testing
()
endif
()
if
(
BUILD_TESTS OR ENABLE_UNIT_TESTS
)
add_subdirectory
(
test
)
endif
()
...
...
test/CMakeLists.txt
浏览文件 @
35088e0d
add_subdirectory
(
test-input
)
if
(
BUILD_TESTS
)
add_subdirectory
(
test-input
)
if
(
WIN32
)
add_subdirectory
(
win
)
if
(
WIN32
)
add_subdirectory
(
win
)
endif
()
if
(
APPLE AND UNIX
)
add_subdirectory
(
osx
)
endif
()
endif
()
if
(
APPLE AND UNIX
)
add_subdirectory
(
osx
)
if
(
ENABLE_UNIT_TESTS
)
add_subdirectory
(
cmocka
)
endif
()
test/cmocka/CMakeLists.txt
0 → 100644
浏览文件 @
35088e0d
project
(
obs-cmocka
)
# Fix libobs path
macro
(
fixLink target_arg
)
if
(
APPLE AND UNIX
)
add_custom_command
(
TARGET
${
target_arg
}
POST_BUILD COMMAND
"
${
CMAKE_INSTALL_NAME_TOOL
}
"
"-change"
"@rpath/libobs.0.dylib"
"@executable_path/../../libobs/libobs.0.dylib"
"$<TARGET_FILE:
${
target_arg
}
>"
VERBATIM
)
endif
()
endmacro
()
set
(
CMAKE_MACOSX_RPATH TRUE
)
set
(
CMAKE_BUILD_WITH_INSTALL_RPATH TRUE
)
list
(
APPEND CMAKE_INSTALL_RPATH
"@loader_path/"
"@executable_path/"
)
find_package
(
CMocka CONFIG REQUIRED
)
include_directories
(
${
CMOCKA_INCLUDE_DIR
}
)
include_directories
(
SYSTEM
"
${
CMAKE_SOURCE_DIR
}
/libobs"
)
# fix rpath on linux
if
(
UNIX AND NOT APPLE
)
set
(
CMAKE_INSTALL_RPATH
"$ORIGIN"
;../../libobs
)
endif
()
# Serializer test
add_executable
(
test_serializer test_serializer.c
)
target_link_libraries
(
test_serializer
${
CMOCKA_LIBRARIES
}
libobs
)
add_test
(
test_serializer
${
CMAKE_CURRENT_BINARY_DIR
}
/test_serializer
)
fixLink
(
test_serializer
)
# darray test
add_executable
(
test_darray test_darray.c
)
target_link_libraries
(
test_darray
${
CMOCKA_LIBRARIES
}
libobs
)
add_test
(
test_darray
${
CMAKE_CURRENT_BINARY_DIR
}
/test_darray
)
fixLink
(
test_darray
)
test/cmocka/test_darray.c
0 → 100644
浏览文件 @
35088e0d
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <util/darray.h>
static
void
array_basic_test
(
void
**
state
)
{
DARRAY
(
uint8_t
)
testarray
;
da_init
(
testarray
);
uint8_t
t
=
1
;
da_push_back_array
(
testarray
,
&
t
,
sizeof
(
uint8_t
));
assert_int_equal
(
testarray
.
num
,
1
);
assert_memory_equal
(
testarray
.
array
,
&
t
,
1
);
da_free
(
testarray
);
}
int
main
()
{
const
struct
CMUnitTest
tests
[]
=
{
cmocka_unit_test
(
array_basic_test
),
};
return
cmocka_run_group_tests
(
tests
,
NULL
,
NULL
);
}
test/cmocka/test_serializer.c
0 → 100644
浏览文件 @
35088e0d
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <util/array-serializer.h>
static
void
serialize_test
(
void
**
state
)
{
struct
array_output_data
output
;
struct
serializer
s
;
array_output_serializer_init
(
&
s
,
&
output
);
s_w8
(
&
s
,
0x01
);
s_w8
(
&
s
,
0xff
);
s_w8
(
&
s
,
0xe1
);
assert_int_equal
(
output
.
bytes
.
num
,
3
);
uint8_t
expected
[
3
]
=
{
0x01
,
0xff
,
0xe1
};
assert_memory_equal
(
output
.
bytes
.
array
,
expected
,
3
);
}
int
main
()
{
const
struct
CMUnitTest
tests
[]
=
{
cmocka_unit_test
(
serialize_test
),
};
return
cmocka_run_group_tests
(
tests
,
NULL
,
NULL
);
}
test/osx/test.mm
浏览文件 @
35088e0d
...
...
@@ -40,7 +40,7 @@ using DisplayContext =
static
void
CreateOBS
()
{
if
(
!
obs_startup
(
"en"
,
nullptr
))
if
(
!
obs_startup
(
"en"
,
nullptr
,
nullptr
))
throw
"Couldn't create OBS"
;
struct
obs_video_info
ovi
;
...
...
@@ -67,7 +67,7 @@ static DisplayContext CreateDisplay(NSView *view)
info
.
zsformat
=
GS_ZS_NONE
;
info
.
window
.
view
=
view
;
return
DisplayContext
{
obs_display_create
(
&
info
)};
return
DisplayContext
{
obs_display_create
(
&
info
,
0
)};
}
static
SceneContext
SetupScene
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录