From: YoungHun Kim Date: Wed, 9 May 2018 05:07:32 +0000 (+0900) Subject: Add initial gtest codes X-Git-Tag: submit/tizen/20180524.013216~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1eca2daf85ecf4541f63f54385526bd5527a80b;p=platform%2Fcore%2Fmultimedia%2Fmmsvc-core.git Add initial gtest codes - How to test (json, socket) 1. build with --define "gtests 1" 2. Install gmock rpm at target Change-Id: I70b9dcb1dcc1caeb3d22be9d1749dd87bc486721 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c1396af..560ea8db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(fw_name "muse-core") +SET(MUSE_CORE "muse-core") -PROJECT(${fw_name}) +PROJECT(${MUSE_CORE}) SET(CMAKE_INSTALL_PREFIX /usr) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -26,8 +26,8 @@ SET(dependents ${dependents} " ttrace") ENDIF(${MUSE_TTRACE_LOG}) INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_name} REQUIRED ${dependents}) -FOREACH(flag ${${fw_name}_CFLAGS}) +pkg_check_modules(${MUSE_CORE} REQUIRED ${dependents}) +FOREACH(flag ${${MUSE_CORE}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) @@ -35,6 +35,11 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE -fno-strict-alia SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-array-bounds -Wno-empty-body -Wno-ignored-qualifiers") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wshadow -Wwrite-strings -Wswitch-default") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-unused-result") + +IF(MUSE_GTESTS_BUILD) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") +ENDIF(MUSE_GTESTS_BUILD) + SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") IF("${ARCH}" STREQUAL "arm") @@ -46,18 +51,18 @@ ADD_DEFINITIONS("-DTIZEN_DEBUG") ADD_DEFINITIONS(-DTZ_SYS_DATA_PATH="${TZ_SYS_DATA}") aux_source_directory(core/src SOURCES) -ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) +ADD_LIBRARY(${MUSE_CORE} SHARED ${SOURCES}) -TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}) +TARGET_LINK_LIBRARIES(${MUSE_CORE} ${${MUSE_CORE}_LDFLAGS}) -SET_TARGET_PROPERTIES(${fw_name} +SET_TARGET_PROPERTIES(${MUSE_CORE} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER} CLEAN_DIRECT_OUTPUT 1 ) -INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR}) +INSTALL(TARGETS ${MUSE_CORE} DESTINATION ${LIBDIR}) INSTALL( DIRECTORY ${INC_DIR}/ DESTINATION include/media FILES_MATCHING @@ -65,20 +70,23 @@ INSTALL( PATTERN "${INC_DIR}/muse_core.h" ) -SET(PC_NAME ${fw_name}) +SET(PC_NAME ${MUSE_CORE}) SET(PC_REQUIRED ${pc_dependents}) -SET(PC_LDFLAGS -l${fw_name}) +SET(PC_LDFLAGS -l${MUSE_CORE}) SET(PC_CFLAGS -I\${includedir}/media) CONFIGURE_FILE( - ${fw_name}.pc.in - ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc + ${MUSE_CORE}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${MUSE_CORE}.pc @ONLY ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${MUSE_CORE}.pc DESTINATION ${LIBDIR}/pkgconfig) ADD_SUBDIRECTORY(server) ADD_SUBDIRECTORY(client) +IF(MUSE_GTESTS_BUILD) +ADD_SUBDIRECTORY(unittest) +ENDIF(MUSE_GTESTS_BUILD) IF(UNIX) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 1cc7111f..455476e2 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,8 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(fw_name "muse-client") +SET(MUSE_CLIENT "muse-client") -PROJECT(${fw_name}) +PROJECT(${MUSE_CLIENT}) SET(CMAKE_INSTALL_PREFIX /usr) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -14,8 +14,8 @@ SET(dependents "dlog glib-2.0 iniparser mm-common") SET(pc_dependents "muse-core") INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_name} REQUIRED ${dependents}) -FOREACH(flag ${${fw_name}_CFLAGS}) +pkg_check_modules(${MUSE_CLIENT} REQUIRED ${dependents}) +FOREACH(flag ${${MUSE_CLIENT}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) @@ -38,18 +38,18 @@ SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,-init,_muse_client_constructor") ENDIF(${MUSE_USE_CLIENT_SIGHANDLER}) aux_source_directory(src CLI_SOURCES) -ADD_LIBRARY(${fw_name} SHARED ${CLI_SOURCES}) +ADD_LIBRARY(${MUSE_CLIENT} SHARED ${CLI_SOURCES}) -TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}) +TARGET_LINK_LIBRARIES(${MUSE_CLIENT} ${${MUSE_CLIENT}_LDFLAGS}) -SET_TARGET_PROPERTIES(${fw_name} +SET_TARGET_PROPERTIES(${MUSE_CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER} CLEAN_DIRECT_OUTPUT 1 ) -INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR}) +INSTALL(TARGETS ${MUSE_CLIENT} DESTINATION ${LIBDIR}) INSTALL( DIRECTORY ${INC_DIR}/ DESTINATION include/media FILES_MATCHING @@ -57,14 +57,14 @@ INSTALL( PATTERN "${INC_DIR}/*.h" ) -SET(PC_NAME ${fw_name}) +SET(PC_NAME ${MUSE_CLIENT}) SET(PC_REQUIRED ${pc_dependents}) -SET(PC_LDFLAGS -l${fw_name}) +SET(PC_LDFLAGS -l${MUSE_CLIENT}) SET(PC_CFLAGS -I\${includedir}/media) CONFIGURE_FILE( - ${fw_name}.pc.in - ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc + ${MUSE_CLIENT}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${MUSE_CLIENT}.pc @ONLY ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${MUSE_CLIENT}.pc DESTINATION ${LIBDIR}/pkgconfig) diff --git a/client/src/muse_client.c b/client/src/muse_client.c index 58fa94da..eea06988 100644 --- a/client/src/muse_client.c +++ b/client/src/muse_client.c @@ -72,7 +72,8 @@ static void _mc_sigaction(int signo, siginfo_t *siginfo, void *context) /* close all opened fds */ g_mutex_lock(&mc_mutex); - g_hash_table_foreach_remove(mc_table, _mc_table_remove_func, NULL); + if (mc_table) + g_hash_table_foreach_remove(mc_table, _mc_table_remove_func, NULL); g_mutex_unlock(&mc_mutex); @@ -140,11 +141,11 @@ static int _mc_new(muse_channel_e channel) LOGI("Enter"); g_return_val_if_fail(channel < MUSE_CHANNEL_MAX, MM_ERROR_INVALID_ARGUMENT); - /*Create socket*/ + /* create socket */ sock_fd = socket(AF_UNIX, SOCK_STREAM, 0); if (!muse_core_fd_is_valid(sock_fd)) { strerror_r(errno, err_msg, MUSE_MSG_LEN_MAX); - LOGE("[socket failure] %d sock: %s", errno, err_msg); + LOGE("[socket failure] %d socket %s", errno, err_msg); muse_core_dump_fd_state(sock_fd); return ret; } diff --git a/packaging/gtest.input b/packaging/gtest.input new file mode 100644 index 00000000..7e95d02f --- /dev/null +++ b/packaging/gtest.input @@ -0,0 +1 @@ +{ "api": 21, "ret": 0, "key_request_length": 1929, "server_url_length": 39, "server_url_name": "http:\/\/widevine-proxy.appspot.com\/proxy", "key_request_name": [ -2129526520, 211618317, -351141624, 44960265, 269615624, -724829229, -404470718, 1188921445, 2025403570, -1733559528, -1910372907, 25309186, 25297418, 1251147777, -1219237827, -679963010, 607661603, 1566204842, -1971371291, 2079091143, 2038071601, -863533787, -1757359502, 1926658381, 1400081148, 731818035, 2071190397, -511958691, 516674827, -974098055, 49025950, -957304590, 1307454545, 1226267280, -233238664, 1439417706, -1975547802, 1595457169, 1233545343, -469933087, 532919768, -932340062, 1111952817, -1684292594, 834549837, -1992421250, -1966494402, -1657712143, 591062368, -510522388, 1953716262, -6042839, 388272011, -555569621, 1226195349, 1583736896, -1173375263, 1305156197, 2044654124, -274835692, -328879294, -163896220, 347413184, 1645440900, 1598961892, 909527356, -1924461213, 1044373190, 1871186710, -1733312188, 394923015, -1402596571, -362291540, 1178470199, 1592340435, -1908948747, -2055919074, 50521415, 671154177, -2146291989, -412444414, -1418427237, -1265798834, 750852162, -309860824, -1102018850, 1505827442, -714205533, 438480036, -1640485019, 1377226139, -1942354512, 1746926178, -1304610213, -1619897150, 1512646636, -731838708, -1843952932, -1061095483, 346516617, -338236686, -1538791679, -1919283377, -96086803, 1036641042, 2133130199, -1036734638, -543282742, -1947297237, -1628444519, 1953117464, 1927482558, 456056257, -1258592615, -1443100230, 5138179, -2082291657, -1670331128, 1682561834, -1935459448, -1028555961, 27718509, -1649902033, 362746328, -1090699658, 1566110204, 1524562815, -1495027355, 1886199486, 648885937, 419961639, -1527033800, -345002948, 710688718, -1550056438, -646394487, -412351321, 1760270048, -1305964059, -1014996508, -747164010, 755673195, -107973246, -724110453, 95689400, 134393354, 839913985, -916244652, -1347752049, -1092505396, 408454670, -1528519984, 42869253, 167871024, 16876034, -188629248, 2094601845, 1117785774, -1480216403, 444843618, 632765001, -269237374, 1044814270, 2031794232, -855553368, 2053671519, -1806188165, 939917330, -453011851, -1689727505, -957904182, 1997019684, 1328701184, -1230818020, 1837801876, -561412860, -2125230828, -891953004, 1890902849, 1446291974, 961097975, -33108214, -1741423343, 178734248, 2120872482, 335848093, -697539372, -974951119, -1554108172, -74541649, -1114800706, 15575027, -2036101895, -80341502, -917225854, -1662862408, 52163914, 958893917, -1207734805, -2125295020, -1450780168, 1957654169, -395361833, -915110838, -894463191, 1488220213, -55412783, -1390877518, 781749366, -1330858723, -768450033, 1195637264, 1536793297, -1700527008, 1796397646, -286829462, -1548589702, 1641685573, 1644516466, 16974591, -349699840, 58724910, 877208109, 1605277550, -1084706658, -1415449457, 1913690838, 692336311, 498890060, 1275781303, -288743100, -412754221, -1962818575, 841360045, 1724317366, -299520859, 736162184, -219892685, -1332860331, 380673752, -1799127158, -1251037262, -826325956, -1136850336, 1504643869, -245288335, 1407447053, -773952702, -1533689636, 1456560808, 776187709, 194973449, -209246142, -1621097840, 986163587, -1222302713, 1312163504, 437571628, 1074410589, -1215814344, -508427923, 1579765981, -799377787, -881603736, -1246691524, 1050817804, 1949406556, -1980316811, -1688883337, -586702917, -1091982547, 1860934310, 567553551, 1916840096, -1712518293, -1684626200, -554846238, 829060546, -1365295856, -567792838, -2130218998, -121162790, 50774140, 1734961562, -1975119289, -1961489712, -1468536116, -1400371217, -123306389, 2056723651, -846029265, -1510626294, 1237053181, 1990047782, 922154833, 988816379, 693402123, -1040676094, -1704899215, 1547665632, 1703377574, 716145901, 799464010, 2105448969, -1475141449, 324275348, 1469531937, 1087593064, 1916091915, 852602965, 1144174469, -258477318, -1127293367, 827154138, -1996368607, 1529583383, 185080358, -706454161, 201987866, 1886220131, 1601793633, 1701667182, 1632831250, 1853191021, 169351783, 1685024010, 1851747429, 308637025, 1685024010, 1851747429, 442854753, 1628506651, 1768448882, 1952671092, 1600483957, 1701667182, 1918961170, 1815574125, 185209626, 1769366884, 1851745635, 308637025, 1851869956, 169613940, 1869770764, 1952675172, 1835101791, 1259082341, 544501345, 1685025360, 443835253, 1644825113, 1684826485, 1718511967, 1292571247, 824210017, 808591410, 756693041, 1701054730, 1701013878, 308570463, 1177764896, 1145193282, 875705396, 1161053492, 943011383, 876889136, 858931766, 926499380, 170727992, 1684633364, 1852405349, 1684234085, 1702256493, 1869181810, 1981092462, 775040563, 758132016, 892745063, 926102630, 1700998456, 520758298, 1601004911, 1887007331, 1935634292, 1920295781, 1601795177, 1668571504, 1701601128, 309093750, 154284801, -14679792, 806103041, 172954113, 136776269, 805376513, 1769409818, 1769366884, 1952408942, 578057061, 825242122, 1702125365, 712208993, 1146437893, 17846089, 892805146, 1177633846, 1111830837, 909132611, 825241924, 808464432, 808464432, 808464432, 18362416, -1761956320, 355468757, -1064180680, -2145775930, 1463442946, -934743051, 1264846997, 308553008, -716800274, 737416052, -1065501005, 342146354, -2128123268, -357430533, -1564339366, 980685642, -280365936, 1172841597, 972766320, 1316646728, -1235701680, -37261669, 596983551, 789826890, 2105111702, -2059128108, -1506407261, 172881172, 1412997328, 745290866, 12333535, 956259017, 1603466670, 2118249048, 1182490150, -1692793497, -271493855, -750166668, -2062347635, -1764483247, 1616510501, -112596535, 1693921621, -823082646, -371117074, -1076948971, 634659734, 1978665969, -482216852, -1989144371, 124720481, -370009184, -106549245, -2012686330, -1681493053, 727759676, 1710748631, -871988422, 1591815859, 1364163589, 1094935001, 1232574638, 688073361, -456465538, -855457623, 554265998, -684896537, -1362935046, 1966605923 ] } diff --git a/packaging/mused.spec b/packaging/mused.spec index b68586a8..35c21cf5 100644 --- a/packaging/mused.spec +++ b/packaging/mused.spec @@ -1,6 +1,6 @@ Name: mused Summary: A multimedia daemon -Version: 0.3.39 +Version: 0.3.40 Release: 0 Group: System/Libraries License: Apache-2.0 @@ -12,6 +12,7 @@ Source4: muse-server-vd_product_tv.service Source5: muse-server-vd_product_audio.service Source6: %{name}.notstrip Source7: muse-server-vd_product_tv.path +Source8: gtest.input BuildRequires: cmake BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-system-runtime-info) @@ -34,6 +35,9 @@ BuildRequires: pkgconfig(libresourced) BuildRequires: pkgconfig(lwipc) BuildRequires: pkgconfig(ttrace) %endif +%if 0%{?gtests:1} +BuildRequires: pkgconfig(gmock) +%endif Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -74,7 +78,7 @@ export CFLAGS+=" -DMUSE_REGISTER_VIP -DMUSE_USE_LWIPC -DMUSE_TTRACE_LOG" %cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_REGISTER_VIP=1 -DMUSE_TTRACE_LOG=1 -DMUSE_USE_LWIPC=1 %else export CFLAGS+=" -DMUSE_USE_POWER_OFF_STATE_CHANGE -DMUSE_USE_EXTERNAL_STORAGE_STATE_CHANGE -DMUSE_USE_WATCHDOG" -%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA +%cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} -DTZ_SYS_DATA=%TZ_SYS_DATA -DMUSE_GTESTS_BUILD=%{?gtests:1}%{!?gtests:0} %endif make %{?jobs:-j%jobs} @@ -113,7 +117,11 @@ install -m 0644 %SOURCE3 %{buildroot}%{_unitdir}/muse-server.path %endif mkdir -p %{buildroot}/var/log/%{name} -mkdir -p -m 0770 %{buildroot}%{TZ_SYS_DATA}/%{name} +mkdir -p %{buildroot}%{TZ_SYS_DATA}/%{name} + +%if 0%{?gtests:1} +install -m 0644 %SOURCE8 %{buildroot}%{TZ_SYS_DATA}/%{name}/gtest.input +%endif %post /sbin/ldconfig @@ -150,6 +158,10 @@ chsmack -a "System::Shared" /var/log/%{name} /var/log/%{name} %{_bindir}/* +%if 0%{?gtests:1} +%{TZ_SYS_DATA}/%{name}/gtest.input +%{_bindir}/gtest-muse-server +%endif %files devel %{_includedir}/media/*.h diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index ed08110c..10da3dee 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -1,10 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(fw_name "muse") -SET(server "server") -SET(core "core") +SET(MUSE_SERVER "muse-server") -PROJECT(${fw_name}-${server}) +PROJECT(${MUSE_SERVER}) SET(CMAKE_INSTALL_PREFIX /usr) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -19,8 +17,8 @@ SET(dependents "capi-system-info capi-system-runtime-info cynara-client cynara-c SET(dependents ${dependents} " gmodule-2.0 gstreamer-1.0 iniparser libtbm storage") INCLUDE(FindPkgConfig) -pkg_check_modules(${fw_name}-${server} REQUIRED ${dependents}) -FOREACH(flag ${${fw_name}-${server}_CFLAGS}) +pkg_check_modules(${MUSE_SERVER} REQUIRED ${dependents}) +FOREACH(flag ${${MUSE_SERVER}_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) @@ -41,23 +39,23 @@ ADD_DEFINITIONS("-DTIZEN_DEBUG") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,--as-needed -pie") aux_source_directory(src SER_SOURCES) -ADD_LIBRARY(${fw_name}-${server} SHARED ${SER_SOURCES}) +ADD_LIBRARY(${MUSE_SERVER} SHARED ${SER_SOURCES}) -TARGET_LINK_LIBRARIES(${fw_name}-${server} ${fw_name}-${core} ${${fw_name}-${server}_LDFLAGS}) +TARGET_LINK_LIBRARIES(${MUSE_SERVER} ${MUSE_CORE} ${${MUSE_SERVER}_LDFLAGS}) -SET_TARGET_PROPERTIES(${fw_name}-${server} +SET_TARGET_PROPERTIES(${MUSE_SERVER} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER} CLEAN_DIRECT_OUTPUT 1 ) -ADD_EXECUTABLE(${fw_name}-${server}-bin ${MAIN-SERVER}) -TARGET_LINK_LIBRARIES(${fw_name}-${server}-bin ${pkgs_LDFLAGS} ${fw_name}-${server} ${CMAKE_DL_LIBS}) -set_target_properties(${fw_name}-${server}-bin PROPERTIES OUTPUT_NAME ${fw_name}-${server}) -INSTALL(TARGETS ${fw_name}-${server}-bin DESTINATION ${BINDIR}) +ADD_EXECUTABLE(${MUSE_SERVER}-bin ${MAIN-SERVER}) +TARGET_LINK_LIBRARIES(${MUSE_SERVER}-bin ${pkgs_LDFLAGS} ${MUSE_SERVER} ${CMAKE_DL_LIBS}) +set_target_properties(${MUSE_SERVER}-bin PROPERTIES OUTPUT_NAME ${MUSE_SERVER}) +INSTALL(TARGETS ${MUSE_SERVER}-bin DESTINATION ${BINDIR}) -INSTALL(TARGETS ${fw_name}-${server} DESTINATION ${LIBDIR}) +INSTALL(TARGETS ${MUSE_SERVER} DESTINATION ${LIBDIR}) INSTALL( DIRECTORY ${INC_DIR}/ DESTINATION include/media FILES_MATCHING @@ -65,14 +63,14 @@ INSTALL( PATTERN "${INC_DIR}/muse_server.h" ) -SET(PC_NAME ${fw_name}-${server}) -SET(PC_LDFLAGS -l${fw_name}-${server}) +SET(PC_NAME ${MUSE_SERVER}) +SET(PC_LDFLAGS -l${MUSE_SERVER}) SET(PC_CFLAGS -I\${includedir}/media) CONFIGURE_FILE( - ${fw_name}-${server}.pc.in - ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-${server}.pc + ${MUSE_SERVER}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${MUSE_SERVER}.pc @ONLY ) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}-${server}.pc DESTINATION ${LIBDIR}/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${MUSE_SERVER}.pc DESTINATION ${LIBDIR}/pkgconfig) diff --git a/server/include/muse_server_private.h b/server/include/muse_server_private.h index 9efdf6b3..b89380d5 100644 --- a/server/include/muse_server_private.h +++ b/server/include/muse_server_private.h @@ -81,7 +81,7 @@ typedef struct ms_cmd_dispatch_info { } ms_cmd_dispatcher_info_t; void ms_init(void); -muse_server_t *ms_get_instance(void); +muse_server_h ms_get_instance(void); gboolean ms_check_module_idx(int idx); ms_module_t *ms_get_module_instance(int idx); int ms_deinit(void); diff --git a/server/src/muse_server.c b/server/src/muse_server.c index e660ab81..74aa9166 100644 --- a/server/src/muse_server.c +++ b/server/src/muse_server.c @@ -215,11 +215,6 @@ int muse_server_module_get_value(muse_module_h m, const char *name, int *value) return ret; } -const char *muse_server_module_get_temporal_path(void) -{ - return MUSE_DATA_ROOT_PATH; -} - int muse_server_module_get_msg_fd(muse_module_h m) { g_return_val_if_fail(m, MM_ERROR_INVALID_ARGUMENT); diff --git a/server/src/muse_server_common.c b/server/src/muse_server_common.c new file mode 100644 index 00000000..67cdc57c --- /dev/null +++ b/server/src/muse_server_common.c @@ -0,0 +1,28 @@ +/* + * muse-server + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: YoungHun Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "muse_server_private.h" + +const char *muse_server_module_get_temporal_path(void) +{ + return MUSE_DATA_ROOT_PATH; +} + diff --git a/server/src/muse_server_private.c b/server/src/muse_server_private.c index f97571ad..5f929719 100644 --- a/server/src/muse_server_private.c +++ b/server/src/muse_server_private.c @@ -56,12 +56,14 @@ static int _ms_run(void) { int fd, already_running; + g_return_val_if_fail(muse_server, MUSE_ERR); + /* First, check whether the existing file is locked. */ - fd = open(ms_get_instance()->conf->lockfile, O_RDONLY); + fd = open(muse_server->conf->lockfile, O_RDONLY); if (fd == -1 && errno != ENOENT) { /* Cannot open file even though file exists. */ char msg[1024]; - snprintf(msg, sizeof(msg), "datserver: Cannot open lock file %s", ms_get_instance()->conf->lockfile); + snprintf(msg, sizeof(msg), "datserver: Cannot open lock file %s", muse_server->conf->lockfile); LOGE("open failed : %s", msg); return MUSE_ERR; } else if (fd != -1) { @@ -74,14 +76,14 @@ static int _ms_run(void) } /* Lock file does not exist, or is not locked. Create a new lockfile and lock it. */ - fd = open(ms_get_instance()->conf->lockfile, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + fd = open(muse_server->conf->lockfile, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd == -1) { LOGE("dataserver: Cannot create lock file"); return MUSE_ERR; } if (flock(fd, LOCK_EX | LOCK_NB) != 0) { - LOGE("Can't lock the lock file \"%s\". " "Is another instance running?", ms_get_instance()->conf->lockfile); + LOGE("Can't lock the lock file \"%s\". " "Is another instance running?", muse_server->conf->lockfile); close(fd); return MUSE_ERR; } @@ -253,11 +255,13 @@ static gboolean _ms_connection_handler(GIOChannel *source, GIOCondition conditio intptr_t module_addr = 0; ms_workqueue_job_t *job = NULL; GQueue *instance_queue = NULL; - ms_connection_t *connection = ms_get_instance()->connection; + ms_connection_t *connection = NULL; LOGI("Enter"); g_return_val_if_fail(muse_server, FALSE); + + connection = muse_server->connection; g_return_val_if_fail(connection, FALSE); _ms_lock_state(); @@ -503,7 +507,7 @@ void ms_init(void) LOGD("Leaver"); } -muse_server_t *ms_get_instance(void) +muse_server_h ms_get_instance(void) { return muse_server; } @@ -579,10 +583,15 @@ void ms_check_memory(int pid) { int used_pss_mb = ms_system_get_memory_info(pid); char err_msg[MUSE_MSG_LEN_MAX] = {'\0',}; - ms_connection_t *connection = ms_get_instance()->connection; - ms_config_t *conf = ms_get_instance()->conf; + ms_connection_t *connection = NULL; + ms_config_t *conf = NULL; + g_return_if_fail(muse_server); + + connection = muse_server->connection; g_return_if_fail(connection); + + conf = muse_server->conf; g_return_if_fail(conf); _ms_lock_state(); @@ -786,7 +795,7 @@ void ms_log_process_info(int pid) gboolean ms_is_log_enabled(void) { - return ms_get_instance()->conf->log_enabled; + return muse_server->conf->log_enabled; } gboolean ms_init_bufmgr(void) diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt new file mode 100644 index 00000000..d6d03354 --- /dev/null +++ b/unittest/CMakeLists.txt @@ -0,0 +1,22 @@ + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +LINK_DIRECTORIES(${CMAKE_BINARY_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/include) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include) + +SET(GTEST_MUSE "gtest-muse-server") + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie") + +FILE(GLOB GTEST_MUSE_SRCS *.cpp ${CMAKE_SOURCE_DIR}/server/src/muse_server_common.c) + +PKG_CHECK_MODULES(GTEST_PKGS REQUIRED glib-2.0 dlog json-c mm-common gmock) +INCLUDE_DIRECTORIES(${GTEST_PKGS_INCLUDE_DIRS}) +LINK_DIRECTORIES(${GTEST_PKGS_LIBRARY_DIRS}) + +ADD_EXECUTABLE(${GTEST_MUSE} ${GTEST_MUSE_SRCS}) +TARGET_LINK_LIBRARIES(${GTEST_MUSE} ${MUSE_CORE} ${MUSE_SERVER} ${GTEST_PKGS_LDFLAGS} -lgcov) + +INSTALL(TARGETS ${GTEST_MUSE} DESTINATION ${BINDIR}) + diff --git a/unittest/muse_gtest_json.cpp b/unittest/muse_gtest_json.cpp new file mode 100644 index 00000000..8b789026 --- /dev/null +++ b/unittest/muse_gtest_json.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "muse_gtest_json.h" +#include "muse_core.h" + +static gboolean _read_file(char *file_path, char *buf); +static void *_json_thread_function(gpointer buf); + +static gboolean _read_file(char *file_path, char *buf) +{ + FILE *fp = NULL; + + if (!file_path) { + LOGE("file path is null"); + return FALSE; + } + + fp = fopen(file_path, "r"); + + if (!fp) { + LOGE("fp error"); + return FALSE; + } + + if (!fgets(buf, MAX_BUF_LEN, fp)) { + LOGE("Read error"); + fclose(fp); + return FALSE; + } + + fclose(fp); + + return TRUE; +} + +static void *_json_thread_function(gpointer buf) +{ + int *key_request_name = NULL; + muse_core_msg_parse_err_e err = MUSE_MSG_PARSE_ERROR_NONE; + int api, idx, arr_len, url_len; + void *jobj = NULL; + char *str = NULL; + + if (!buf) + return GINT_TO_POINTER(false); + + jobj = muse_core_msg_object_new((char *)buf, NULL, &err); + + if (!jobj) { + LOGE("failed to get msg object. jobj err : %d", err); + goto out; + } + + if (!muse_core_msg_object_get_value("api", jobj, MUSE_TYPE_INT, &api)) { + LOGE("failed to get api"); + goto out; + } + printf("api (int) : %d\n", api); + + if (!muse_core_msg_object_get_value("key_request_length", jobj, MUSE_TYPE_INT, &arr_len)) { + LOGE("failed to get length"); + goto out; + } + printf("key_request_length (int) : %d\n", arr_len); + + if (!muse_core_msg_object_get_value("server_url_length", jobj, MUSE_TYPE_INT, &url_len)) { + LOGE("failed to get length"); + goto out; + } + printf("server_url_length (int) : %d\n", url_len); + + str = (char *)g_try_new0(char, MUSE_MSG_LEN_MAX); + if (!str) { + LOGE("str is null"); + goto out; + } + + if (!muse_core_msg_object_get_value("server_url_name", jobj, MUSE_TYPE_STRING, str)) { + LOGE("failed to get length"); + goto out; + } + printf("server_url_name (string) : %s\n", str); + g_free(str); + + key_request_name = (int *)g_try_new0(int, arr_len); + if (key_request_name) { + printf("key_request_name (array) : "); + if (muse_core_msg_object_get_value("key_request_name", jobj, MUSE_TYPE_ARRAY, key_request_name)) { + for (idx = 0; idx < arr_len; idx++) + printf("%d ", key_request_name[idx]); + } + printf("\n"); + g_free(key_request_name); + } + + muse_core_msg_object_free(jobj); + + return GINT_TO_POINTER(true); +out: + g_free(str); + + if (jobj) + muse_core_msg_object_free(jobj); + + return GINT_TO_POINTER(false); +} + +bool muse_gtest_json(char *file_path) +{ + GThread *thread; + char buf[MAX_BUF_LEN + 1] = {0, }; + + if (!_read_file(file_path, buf)) + return false; + + thread = g_thread_new(NULL, _json_thread_function, (gpointer)buf); + + return GPOINTER_TO_INT(g_thread_join(thread)); +} + +bool muse_gtest_multi_threaded_json(char *file_path) +{ + int i; + GPtrArray *threads = NULL; + GThread *thread = NULL; + bool result = true; + gpointer ret; + char buf[MAX_BUF_LEN + 1] = {0, }; + + if (!_read_file(file_path, buf)) + return false; + + threads = g_ptr_array_new(); + + for (i = 0; i < NTHREADS; i++) { + thread = g_thread_new(NULL, _json_thread_function, (gpointer)buf); + g_ptr_array_add(threads, thread); + } + + for (i = 0; i < NTHREADS; i++) { + ret = g_thread_join((GThread *)g_ptr_array_index(threads, i)); + result &= GPOINTER_TO_INT(ret); + } + + g_ptr_array_free(threads, TRUE); + + return result; +} + diff --git a/unittest/muse_gtest_json.h b/unittest/muse_gtest_json.h new file mode 100644 index 00000000..bf5bf828 --- /dev/null +++ b/unittest/muse_gtest_json.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __MUSE_GTEST_JSON_H__ +#define __MUSE_GTEST_JSON_H__ + +#include "unittest.h" + +bool muse_gtest_json(char *file_path); +bool muse_gtest_multi_threaded_json(char *file_path); + +#endif /*__MUSE_GTEST_JSON_H__*/ + diff --git a/unittest/muse_gtest_socket.cpp b/unittest/muse_gtest_socket.cpp new file mode 100644 index 00000000..1d999650 --- /dev/null +++ b/unittest/muse_gtest_socket.cpp @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "muse_server_private.h" +#include "muse_gtest_socket.h" + +struct sockaddr_un addr; +const char *UDS_files[MUSE_CHANNEL_MAX] = {GTEST_MUSE_SOCK_FILE0, GTEST_MUSE_SOCK_FILE1}; + +static int _server_open(muse_channel_e channel); +static int _client_open(muse_channel_e channel); +static gboolean _connect(int fd); +static int _accept(int fd); +static gboolean _client_close(int fd); +static gboolean _server_close(int fd); + +static int _server_open(muse_channel_e channel) +{ + int fd; + socklen_t address_len; + + if (channel >= MUSE_CHANNEL_MAX) + return MM_ERROR_INVALID_ARGUMENT; + + unlink(UDS_files[channel]); + + /* create socket */ + fd = socket(AF_UNIX, SOCK_STREAM, 0); /* Unix Domain Socket */ + if (!muse_core_fd_is_valid(fd)) { + LOGE("socket failed sock"); + return MUSE_ERR; + } + + LOGD("gtest muse server fd : %d", fd); + + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, UDS_files[channel], sizeof(addr.sun_path) - 1); + address_len = sizeof(addr); + + /* bind to filename */ + if (bind(fd, (struct sockaddr *)&addr, address_len) < 0) { + LOGE("socket bind failed"); + if (errno == EADDRINUSE) + unlink(addr.sun_path); + close(fd); + return MUSE_ERR; + } + + /* setup listen queue */ + if (listen(fd, 5) == MUSE_ERR) { + LOGE("listen failed"); + close(fd); + return MUSE_ERR; + } + + if (muse_core_set_nonblocking(fd, false) < 0) /* blocking */ + LOGE("failed to set server socket to blocking"); + + return fd; +} + +static int _client_open(muse_channel_e channel) +{ + int sock_fd; + + LOGI("Enter"); + g_return_val_if_fail(channel < MUSE_CHANNEL_MAX, MM_ERROR_INVALID_ARGUMENT); + + /* create socket */ + sock_fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (!muse_core_fd_is_valid(sock_fd)) { + LOGE("[socket failure] %d socket", errno); + return MUSE_ERR; + } + LOGD("gtest muse client fd : %d", sock_fd); + + if (fcntl(sock_fd, F_SETFD, FD_CLOEXEC) < 0) { + LOGE("unable to set on ctrl socket fd %d", sock_fd); + close(sock_fd); + return MUSE_ERR; + } + LOGD("fcntl"); + + if (muse_core_set_nonblocking(sock_fd, false) != MM_ERROR_NONE) { + LOGE("Error - fd (%d) set blocking", sock_fd); + close(sock_fd); + return MUSE_ERR; + } + + LOGI("Leave"); + + return sock_fd; +} + +static gboolean _connect(int fd) +{ + int ret = MUSE_ERR; + + LOGI("Enter"); + + ret = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); + if (ret < 0) { + LOGE("[Critical Error : %d] connect failure", errno); + close(fd); + return FALSE; + } + + close(fd); + + LOGI("Leave"); + + return TRUE; +} + +static int _accept(int fd) +{ + int client_sockfd; + socklen_t len = sizeof(addr); + + client_sockfd = accept(fd, (struct sockaddr *)&addr, &len); + LOGD("gtest muse client fd : %d", client_sockfd); + + return client_sockfd; +} + +static gboolean _client_close(int fd) +{ + if (shutdown(fd, SHUT_RDWR) == MUSE_ERR) { + LOGE("[%d] failed to shutdown [error %d]", fd, errno); + return FALSE; + } + + if (close(fd) == MUSE_ERR) { + LOGE("[%d] failed to close [error %s %d]", fd, errno); + return FALSE; + } + + return TRUE; +} + +static gboolean _server_close(int fd) +{ + if (close(fd) == MUSE_ERR) { + LOGE("[%d] failed to close [error %s %d]", fd, errno); + return FALSE; + } + + return TRUE; +} + +bool muse_gtest_socket(muse_channel_e channel) +{ + int server_sockfd, client_sockfd; + + server_sockfd = _server_open(channel); + if (!muse_core_fd_is_valid(server_sockfd)) { + LOGE("server open failed"); + return false; + } + + client_sockfd = _client_open(channel); + if (!muse_core_fd_is_valid(client_sockfd)) { + LOGE("client open failed"); + return false; + } + + if (!_connect(client_sockfd)) { + LOGE("fail to connect"); + return false; + } + + client_sockfd = _accept(server_sockfd); + if (!muse_core_fd_is_valid(client_sockfd)) { + LOGE("fail to accept"); + return false; + } + + if (!_client_close(client_sockfd)) { + LOGE("client close failed"); + return false; + } + + if (!_server_close(server_sockfd)) { + LOGE("server close failed"); + return false; + } + + return true; +} diff --git a/unittest/muse_gtest_socket.h b/unittest/muse_gtest_socket.h new file mode 100644 index 00000000..d5ee8f22 --- /dev/null +++ b/unittest/muse_gtest_socket.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __MUSE_GTEST_SOCKET_H__ +#define __MUSE_GTEST_SOCKET_H__ + +#include "unittest.h" + +bool muse_gtest_socket(muse_channel_e channel); + +#endif /*__MUSE_GTEST_SOCKET_H__*/ + diff --git a/unittest/unittest.cpp b/unittest/unittest.cpp new file mode 100644 index 00000000..6619f319 --- /dev/null +++ b/unittest/unittest.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "muse_gtest_json.h" +#include "muse_gtest_socket.h" + +using ::testing::InitGoogleTest; +using ::testing::Test; +using ::testing::TestCase; + +class MusedTest : public ::testing::Test { + protected: + void SetUp() { + std::cout << "SetUp()" << std::endl; + } + + void TearDown() { + std::cout << "TearDown()" << std::endl; + } +}; + +TEST(MusedTest, muse_gtest_json_p) +{ + bool ret; + char path[FILE_PATH_LEN] = {'\0', }; + + snprintf(path, sizeof(path), "%s%s", (char *)muse_server_module_get_temporal_path(), (char *)FILE_NAME); + + ret = muse_gtest_json(path); + EXPECT_EQ(ret, true); +} + +TEST(MusedTest, muse_gtest_json_n) +{ + bool ret; + char wrong_path[FILE_PATH_LEN] = {'\0', }; + + snprintf(wrong_path, sizeof(wrong_path), "%s%s_wrong", (char *)muse_server_module_get_temporal_path(), (char *)FILE_NAME); + + ret = muse_gtest_json(wrong_path); + EXPECT_EQ(ret, false); +} + + +TEST(MusedTest, muse_gtest_multi_threaded_json_p) +{ + bool ret; + char path[FILE_PATH_LEN] = {'\0', }; + + snprintf(path, sizeof(path), "%s%s", (char *)muse_server_module_get_temporal_path(), (char *)FILE_NAME); + + ret = muse_gtest_multi_threaded_json(path); + EXPECT_EQ(ret, true); +} + +TEST(MusedTest, muse_gtest_multi_threaded_json_n) +{ + bool ret; + char wrong_path[FILE_PATH_LEN] = {'\0', }; + + snprintf(wrong_path, sizeof(wrong_path), "%s%s_wrong", (char *)muse_server_module_get_temporal_path(), (char *)FILE_NAME); + + ret = muse_gtest_multi_threaded_json(wrong_path); + EXPECT_EQ(ret, false); +} + +TEST(MusedTest, muse_gtest_socket_p) +{ + bool ret; + + ret = muse_gtest_socket(MUSE_CHANNEL_MSG); + EXPECT_EQ(ret, true); +} + +TEST(MusedTest, muse_gtest_socket_n) +{ + bool ret; + + ret = muse_gtest_socket(MUSE_CHANNEL_MAX); + EXPECT_EQ(ret, false); +} + +/* +TEST( {PKG}_{MODULE_NAME}, {FUNCTION}_n ) +{ + +} +*/ + +int main(int argc, char **argv) +{ + InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} diff --git a/unittest/unittest.h b/unittest/unittest.h new file mode 100644 index 00000000..0d7cb4c0 --- /dev/null +++ b/unittest/unittest.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __GTEST_MUSE_SERVER_UNITTEST_H__ +#define __GTEST_MUSE_SERVER_UNITTEST_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "muse_server.h" +#include "muse_client.h" + +#undef LOG_TAG +#define LOG_TAG "GTEST_MUSED" + +#define MUSE_ERR -1 +#define NTHREADS 2 +#define MAX_BUF_LEN 4096 * 2 +#define FILE_NAME "gtest.input" +#define FILE_PATH_LEN 128 +#define MUSE_MSG_LEN_MAX 128 + +#define GTEST_MUSE_SOCK_FILE0 "/tmp/.gtest_muse_server_socket" +#define GTEST_MUSE_SOCK_FILE1 "/tmp/.gtest_muse_server_data_socket" + +#endif /*__GTEST_MUSE_SERVER_UNITTEST_H__*/