Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7724270d
提交
7724270d
authored
9月 28, 2015
作者:
William King
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8233 convert unit tests frameworks to non-recursive makefiles
上级
967245bf
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
49 行增加
和
48 行删除
+49
-48
Makefile.am
Makefile.am
+13
-1
configure.ac
configure.ac
+0
-1
Makefile.am
tests/unit/Makefile.am
+0
-30
switch_event.c
tests/unit/switch_event.c
+7
-7
switch_hash.c
tests/unit/switch_hash.c
+10
-9
unit.mk
tests/unit/unit.mk
+19
-0
没有找到文件。
Makefile.am
浏览文件 @
7724270d
EXTRA_DIST
=
SUBDIRS
=
.
src build
tests/unit
SUBDIRS
=
.
src build
AUTOMAKE_OPTIONS
=
foreign subdir-objects
NAME
=
freeswitch
...
...
@@ -775,3 +775,15 @@ support:
@
cp
support-d/.screenrc ~
@
cp
support-d/.bashrc ~
@
test
-f
~/.cc-mode-installed
||
sh support-d/install-cc-mode.sh
&&
touch
~/.cc-mode-installed
# Using a non-recursive Makefile structure for the automated tests so that the tests have visibility into
# targets in the rest of the FreeSWITCH tree. This greatly simplifies dependency tracking at the expense
# of longer test target names. Since the tests are expected to be run easily and rapidly after minor source
# changes this is the most effective structure.
TESTS
=
check_PROGRAMS
=
include
tests/unit/unit.mk
configure.ac
浏览文件 @
7724270d
...
...
@@ -1671,7 +1671,6 @@ ac_cv_file_dbd_apr_dbd_mysql_c=no
AC_CONFIG_FILES([Makefile
build/Makefile
src/Makefile
tests/unit/Makefile
src/mod/Makefile
src/mod/applications/mod_abstraction/Makefile
src/mod/applications/mod_avmd/Makefile
...
...
tests/unit/Makefile.am
deleted
100644 → 0
浏览文件 @
967245bf
AUTOMAKE_OPTIONS
=
foreign
FSLD
=
$(top_builddir)
/libfreeswitch.la
$(top_builddir)
/libs/apr/libapr-1.la
$(top_builddir)
/libs/apr-util/libaprutil-1.la
TESTS
=
check_PROGRAMS
=
if
HAVE_TAP
TESTS
+=
switch_event
check_PROGRAMS
+=
switch_event
switch_event_SOURCES
=
switch_event.c
switch_event_CFLAGS
=
$(SWITCH_AM_CFLAGS)
switch_event_LDADD
=
$(FSLD)
switch_event_LDFLAGS
=
$(SWITCH_AM_LDFLAGS)
-ltap
TESTS
+=
switch_hash
check_PROGRAMS
+=
switch_hash
switch_hash_SOURCES
=
switch_hash.c
switch_hash_CFLAGS
=
$(SWITCH_AM_CFLAGS)
switch_hash_LDADD
=
$(FSLD)
switch_hash_LDFLAGS
=
$(SWITCH_AM_LDFLAGS)
-ltap
else
check
:
error
error
:
$
(
error You must
install
libtap-dev to build these unit tests
)
endif
tests/unit/switch_event.c
浏览文件 @
7724270d
...
...
@@ -9,7 +9,7 @@ int main () {
switch_bool_t
verbose
=
SWITCH_TRUE
;
const
char
*
err
=
NULL
;
switch_time_t
start_ts
,
end_ts
;
int
rc
=
0
,
loops
=
10
;
int
rc
=
0
,
loops
=
10
,
x
=
0
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
char
**
index
=
NULL
;
unsigned
long
long
micro_total
=
0
;
...
...
@@ -31,7 +31,7 @@ int main () {
}
index
=
calloc
(
loops
,
sizeof
(
char
*
));
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
index
[
x
]
=
switch_mprintf
(
"%d"
,
x
);
}
...
...
@@ -42,13 +42,13 @@ int main () {
ok
(
status
==
SWITCH_STATUS_SUCCESS
,
"Create Event"
);
#ifndef BENCHMARK
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
status
=
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
index
[
x
],
index
[
x
]);
ok
(
status
==
SWITCH_STATUS_SUCCESS
,
"Add header to event"
);
}
#else
small_start_ts
=
switch_time_now
();
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
if
(
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
index
[
x
],
index
[
x
])
!=
SWITCH_STATUS_SUCCESS
)
{
fail
(
"Failed to add header to event"
);
}
...
...
@@ -64,12 +64,12 @@ int main () {
#ifndef BENCHMARK
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
is
(
switch_event_get_header
(
event
,
index
[
x
]),
index
[
x
],
"correct header value returned"
);
}
#else
small_start_ts
=
switch_time_now
();
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
if
(
!
switch_event_get_header
(
event
,
index
[
x
]))
{
fail
(
"Failed to lookup event header value"
);
}
...
...
@@ -89,7 +89,7 @@ int main () {
end_ts
=
switch_time_now
();
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
free
(
index
[
x
]);
}
free
(
index
);
...
...
tests/unit/switch_hash.c
浏览文件 @
7724270d
...
...
@@ -13,7 +13,8 @@ int main () {
unsigned
long
long
micro_total
=
0
;
double
micro_per
=
0
;
double
rate_per_sec
=
0
;
int
x
=
0
;
#ifdef BENCHMARK
switch_time_t
small_start_ts
,
small_end_ts
;
#endif
...
...
@@ -42,7 +43,7 @@ int main () {
}
index
=
calloc
(
loops
,
sizeof
(
char
*
));
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
index
[
x
]
=
switch_mprintf
(
"%d"
,
x
);
}
...
...
@@ -51,13 +52,13 @@ int main () {
/* Insertion */
#ifndef BENCHMARK
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
status
=
switch_core_hash_insert
(
hash
,
index
[
x
],
(
void
*
)
index
[
x
]);
ok
(
status
==
SWITCH_STATUS_SUCCESS
,
"Insert into the hash"
);
}
#else
small_start_ts
=
switch_time_now
();
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
switch_core_hash_insert
(
hash
,
index
[
x
],
(
void
*
)
index
[
x
]);
}
small_end_ts
=
switch_time_now
();
...
...
@@ -72,7 +73,7 @@ int main () {
/* Lookup */
#ifndef BENCHMARK
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
char
*
data
=
NULL
;
data
=
switch_core_hash_find
(
hash
,
index
[
x
]);
ok
(
data
!=
NULL
,
"Successful lookup"
);
...
...
@@ -80,7 +81,7 @@ int main () {
}
#else
small_start_ts
=
switch_time_now
();
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
if
(
!
switch_core_hash_find
(
hash
,
index
[
x
]))
{
fail
(
"Failed to properly locate one of the values"
);
}
...
...
@@ -97,7 +98,7 @@ int main () {
/* Delete */
#ifndef BENCHMARK
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
char
*
data
=
NULL
;
data
=
switch_core_hash_delete
(
hash
,
index
[
x
]);
ok
(
data
!=
NULL
,
"Create a new hash"
);
...
...
@@ -105,7 +106,7 @@ int main () {
}
#else
small_start_ts
=
switch_time_now
();
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
if
(
!
switch_core_hash_delete
(
hash
,
index
[
x
]))
{
fail
(
"Failed to delete and return the value"
);
}
...
...
@@ -124,7 +125,7 @@ int main () {
/* END LOOPS */
switch_core_hash_destroy
(
&
hash
);
for
(
int
x
=
0
;
x
<
loops
;
x
++
)
{
for
(
x
=
0
;
x
<
loops
;
x
++
)
{
free
(
index
[
x
]);
}
free
(
index
);
...
...
tests/unit/unit.mk
0 → 100644
浏览文件 @
7724270d
AUTOMAKE_OPTIONS = foreign
FSLD = $(top_builddir)/libfreeswitch.la $(top_builddir)/libs/apr/libapr-1.la $(top_builddir)/libs/apr-util/libaprutil-1.la
TESTS += tests/unit/switch_event
check_PROGRAMS += tests/unit/switch_event
tests_unit_switch_event_SOURCES = tests/unit/switch_event.c
tests_unit_switch_event_CFLAGS = $(SWITCH_AM_CFLAGS)
tests_unit_switch_event_LDADD = $(FSLD)
tests_unit_switch_event_LDFLAGS = $(SWITCH_AM_LDFLAGS) -ltap
TESTS += tests/unit/switch_hash
check_PROGRAMS += tests/unit/switch_hash
tests_unit_switch_hash_SOURCES = tests/unit/switch_hash.c
tests_unit_switch_hash_CFLAGS = $(SWITCH_AM_CFLAGS)
tests_unit_switch_hash_LDADD = $(FSLD)
tests_unit_switch_hash_LDFLAGS = $(SWITCH_AM_LDFLAGS) -ltap
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论