Set the plugin directory factoring in architecture 77/240877/1 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.122313 accepted/tizen/6.0/unified/hotfix/20201103.004628 accepted/tizen/6.0/unified/hotfix/20201103.051817 accepted/tizen/unified/20200818.130022 submit/tizen/20200813.083528 submit/tizen_6.0/20201029.205102 submit/tizen_6.0_hotfix/20201102.192502 submit/tizen_6.0_hotfix/20201103.114802 tizen_6.0.m2_release
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 12 Aug 2020 09:11:03 +0000 (18:11 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 12 Aug 2020 09:22:43 +0000 (18:22 +0900)
- armv7l  : /usr/lib
- aarch64 : /usr/lib64

Change-Id: I07804cb9dd9e996710a5d11f84772d4bc2fa9432
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
CMakeLists.txt
packaging/capi-system-info.spec
src/system_info_external.c
src/test/CMakeLists.txt
src/test/system_info_external_plugin_test.sh [deleted file]
src/test/system_info_external_plugin_test.sh.in [new file with mode: 0755]

index 24f300c79bdda93d41f45d8981aef097f9b4aaae..7ee492e5446fe98cdab90d6217db70c45ef4a971 100644 (file)
@@ -36,6 +36,7 @@ ADD_DEFINITIONS("-DTIZEN_ID_PATH=\"${TIZEN_ID_PATH}\"")
 ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"")
 ADD_DEFINITIONS("-DSYSTEM_INFO_DB_RO_PATH=\"${DB_RO_PATH}\"")
 ADD_DEFINITIONS("-DSYSTEM_INFO_DB_RW_PATH=\"${DB_RW_PATH}\"")
+ADD_DEFINITIONS("-DPLUGIN_DIR=\"${PLUGIN_DIR}\"")
 ADD_DEFINITIONS(-D_GNU_SOURCE) # to make scandirat() available
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
index cb03b7288d5d332d0cf8dc4fd5e6424b09c0e252..2c8574a4ea348f1965ad40ad25d024d614929a16 100644 (file)
@@ -63,6 +63,8 @@ cp %{SOURCE1001} .
 %define model_config_rw_dir /opt/system/model-config
 %define db_rw_path %{model_config_rw_dir}/system_info_db
 
+%define plugin_dir %{_libdir}
+
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 
@@ -73,6 +75,7 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
             -DTIZEN_ID_PATH=%{tizen_id_path} \
             -DDB_RO_PATH=%{db_ro_path} \
             -DDB_RW_PATH=%{db_rw_path} \
+            -DPLUGIN_DIR=%{plugin_dir} \
                 -DGCOV=%{?gcov:1}%{!?gcov:0}
 
 %__make %{?_smp_mflags}
index 100e88646e8a64439ea77c4f35bb48d5f22de193..5ee3f2383b7bbb3fb108fad7e21c69cb39d4b93c 100644 (file)
@@ -29,8 +29,8 @@
 
 #define BUF_MAX 256
 
-#define EXTERNAL_PLUGINS_DIR "/usr/lib/libsystem_info_plugins"
-#define EXTERNAL_SYSTEM_INFO "/usr/lib/libsystem-info-external-plugin.so"
+#define EXTERNAL_PLUGINS_DIR PLUGIN_DIR"/libsystem_info_plugins"
+#define EXTERNAL_SYSTEM_INFO PLUGIN_DIR"/libsystem-info-external-plugin.so"
 
 //LCOV_EXCL_START
 static int plugin_filter(const struct dirent *de)
index d602a0176ea0ca413f7903629ab06512abec43bf..7aa53d35265f215f8b76481a6e8369c32433f124 100755 (executable)
@@ -19,6 +19,9 @@ ADD_EXECUTABLE(${SYSTEM_INFO_TEST} ${SRCS})
 ADD_DEPENDENCIES(${SYSTEM_INFO_TEST} ${fw_name})
 TARGET_LINK_LIBRARIES(${SYSTEM_INFO_TEST} ${SYSTEM_INFO_TEST_pkgs_LDFLAGS} "-L${CMAKE_SOURCE_DIR} -lcapi-system-info")
 
+SET(TEST_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/system_info_external_plugin_test.sh)
+CONFIGURE_FILE(${TEST_SCRIPT}.in ${TEST_SCRIPT} @ONLY)
+
 INSTALL(TARGETS ${SYSTEM_INFO_TEST} DESTINATION bin)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/test/system_info_external_plugin_test.sh DESTINATION bin)
+INSTALL(FILES ${TEST_SCRIPT} DESTINATION bin)
 
diff --git a/src/test/system_info_external_plugin_test.sh b/src/test/system_info_external_plugin_test.sh
deleted file mode 100755 (executable)
index e34142e..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/bin/bash
-
-function test_key_type_string_cmd() {
-       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_ks)"
-       name="'$FUNCNAME'"
-}
-
-function test_string_not_int_cmd() {
-       cmd_result="$(system_info_test -g custom -t int -k sysinfotest_ks)"
-       name="'$FUNCNAME'"
-}
-
-function test_string_not_double_cmd() {
-       cmd_result="$(system_info_test -g custom -t double -k sysinfotest_ks)"
-       name="'$FUNCNAME'"
-}
-
-function test_string_not_bool_cmd() {
-       cmd_result="$(system_info_test -g custom -t bool -k sysinfotest_ks)"
-       name="'$FUNCNAME'"
-}
-
-function test_key_type_int_cmd() {
-       cmd_result="$(system_info_test -g custom -t int -k sysinfotest_ki)"
-       name="'$FUNCNAME'"
-}
-
-function test_key_type_double_cmd() {
-       cmd_result="$(system_info_test -g custom -t double -k sysinfotest_kd)"
-       name="'$FUNCNAME'"
-}
-
-function test_key_type_bool_cmd() {
-       cmd_result="$(system_info_test -g custom -t bool -k sysinfotest_kb)"
-       name="'$FUNCNAME'"
-}
-
-function test_bool_not_string_cmd() {
-       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_kb)"
-       name="'$FUNCNAME'"
-}
-
-function test_bool_not_int_cmd() {
-       cmd_result="$(system_info_test -g custom -t int -k sysinfotest_kb)"
-       name="'$FUNCNAME'"
-}
-
-function test_bool_not_double_cmd() {
-       cmd_result="$(system_info_test -g custom -t double -k sysinfotest_kb)"
-       name="'$FUNCNAME'"
-}
-
-function test_second_plugin_str_cmd() {
-       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_vks_custom)"
-       name="'$FUNCNAME'"
-}
-
-function test_right_plugin_str_cmd() {
-       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_kvs)"
-       name="'$FUNCNAME'"
-}
-
-function get_cmd_result() {
-       check_result="$(echo $1 | cut -d'(' -f6 | cut -d')' -f1)"
-}
-
-function check_file_exists() {
-       cmd_result="$(test -s $1 && echo 'exists' || echo 'not')"
-       name="'$FUNCNAME' $1"
-}
-
-function check_command_exists() {
-       command_exists="$(type -p system_info_test)"
-}
-
-function check_result() {
-       local test_cmd=$1
-       local expected_result=$2
-
-       $test_cmd
-       get_cmd_result "$cmd_result"
-
-       #check if a variable is a number (formating cmd output)
-       re='^[+-]?[0-9]+([.][0-9]+)?$'
-       if [[ $check_result =~ $re ]] ; then
-               check_result="$(printf '%.2f' $check_result)"
-               if [[ $expected_result =~ $re ]] ; then
-                       expected_result="$(printf '%.2f' $expected_result)"
-               fi
-       fi
-
-       sign='='
-       nsign='!'
-       if [[ $# -ge 3 && $3 == '!' ]]; then
-               nsign=$sign
-               sign=$3
-       fi
-       if [[ $check_result == '' ]]; then
-               check_result='EMPTY_RESULT'
-       fi
-       if [[ ( $check_result != 'EMPTY_RESULT' && ( $sign == '!' && "$check_result" != "$expected_result" ) || ( "$check_result" == "$expected_result" ) ) ]]; then
-               echo -e '\033[32m[' ' OK ' ']\e[0m' "$name:\t" "$sign('$expected_result')"
-       else
-               echo -e '\033[31m[' 'FAIL' ']\e[0m' "$name:\t" "('\033[31m$check_result\e[0m'" "$nsign=" "'\033[32m$expected_result\e[0m')"
-               return_code=1
-       fi
-}
-
-check_command_exists result
-if [ -z "$command_exists" ]; then
-       exit 1
-fi
-
-return_code=0
-
-PLUGIN_FILE='/usr/lib/libsystem_info_plugins/libsystem_info_test_plugin.so'
-check_result "check_file_exists $PLUGIN_FILE" 'exists'
-PLUGIN_FILE='/usr/lib/libsystem_info_plugins/libsystem_info_test_plugin2.so'
-check_result "check_file_exists $PLUGIN_FILE" 'exists'
-
-check_result test_key_type_string_cmd 'plugin'
-check_result test_string_not_int_cmd 'ERROR : -22'
-check_result test_string_not_double_cmd 'ERROR : -22'
-check_result test_string_not_bool_cmd 'ERROR : -22'
-check_result test_key_type_int_cmd '1'
-check_result test_key_type_double_cmd '2.0'
-check_result test_key_type_bool_cmd '1'
-check_result test_bool_not_string_cmd 'ERROR : -22'
-check_result test_bool_not_int_cmd 'ERROR : -22'
-check_result test_bool_not_double_cmd 'ERROR : -22'
-check_result test_second_plugin_str_cmd 'various key'
-check_result test_right_plugin_str_cmd 'first_in_lexicographical_order'
-check_result test_right_plugin_str_cmd 'second_in_lexicographical_order' '!'
-check_result test_right_plugin_str_cmd 'ERROR : -22' '!'
-
-exit $return_code
diff --git a/src/test/system_info_external_plugin_test.sh.in b/src/test/system_info_external_plugin_test.sh.in
new file mode 100755 (executable)
index 0000000..e5a6839
--- /dev/null
@@ -0,0 +1,136 @@
+#!/bin/bash
+
+function test_key_type_string_cmd() {
+       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_ks)"
+       name="'$FUNCNAME'"
+}
+
+function test_string_not_int_cmd() {
+       cmd_result="$(system_info_test -g custom -t int -k sysinfotest_ks)"
+       name="'$FUNCNAME'"
+}
+
+function test_string_not_double_cmd() {
+       cmd_result="$(system_info_test -g custom -t double -k sysinfotest_ks)"
+       name="'$FUNCNAME'"
+}
+
+function test_string_not_bool_cmd() {
+       cmd_result="$(system_info_test -g custom -t bool -k sysinfotest_ks)"
+       name="'$FUNCNAME'"
+}
+
+function test_key_type_int_cmd() {
+       cmd_result="$(system_info_test -g custom -t int -k sysinfotest_ki)"
+       name="'$FUNCNAME'"
+}
+
+function test_key_type_double_cmd() {
+       cmd_result="$(system_info_test -g custom -t double -k sysinfotest_kd)"
+       name="'$FUNCNAME'"
+}
+
+function test_key_type_bool_cmd() {
+       cmd_result="$(system_info_test -g custom -t bool -k sysinfotest_kb)"
+       name="'$FUNCNAME'"
+}
+
+function test_bool_not_string_cmd() {
+       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_kb)"
+       name="'$FUNCNAME'"
+}
+
+function test_bool_not_int_cmd() {
+       cmd_result="$(system_info_test -g custom -t int -k sysinfotest_kb)"
+       name="'$FUNCNAME'"
+}
+
+function test_bool_not_double_cmd() {
+       cmd_result="$(system_info_test -g custom -t double -k sysinfotest_kb)"
+       name="'$FUNCNAME'"
+}
+
+function test_second_plugin_str_cmd() {
+       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_vks_custom)"
+       name="'$FUNCNAME'"
+}
+
+function test_right_plugin_str_cmd() {
+       cmd_result="$(system_info_test -g custom -t string -k sysinfotest_kvs)"
+       name="'$FUNCNAME'"
+}
+
+function get_cmd_result() {
+       check_result="$(echo $1 | cut -d'(' -f6 | cut -d')' -f1)"
+}
+
+function check_file_exists() {
+       cmd_result="$(test -s $1 && echo 'exists' || echo 'not')"
+       name="'$FUNCNAME' $1"
+}
+
+function check_command_exists() {
+       command_exists="$(type -p system_info_test)"
+}
+
+function check_result() {
+       local test_cmd=$1
+       local expected_result=$2
+
+       $test_cmd
+       get_cmd_result "$cmd_result"
+
+       #check if a variable is a number (formating cmd output)
+       re='^[+-]?[0-9]+([.][0-9]+)?$'
+       if [[ $check_result =~ $re ]] ; then
+               check_result="$(printf '%.2f' $check_result)"
+               if [[ $expected_result =~ $re ]] ; then
+                       expected_result="$(printf '%.2f' $expected_result)"
+               fi
+       fi
+
+       sign='='
+       nsign='!'
+       if [[ $# -ge 3 && $3 == '!' ]]; then
+               nsign=$sign
+               sign=$3
+       fi
+       if [[ $check_result == '' ]]; then
+               check_result='EMPTY_RESULT'
+       fi
+       if [[ ( $check_result != 'EMPTY_RESULT' && ( $sign == '!' && "$check_result" != "$expected_result" ) || ( "$check_result" == "$expected_result" ) ) ]]; then
+               echo -e '\033[32m[' ' OK ' ']\e[0m' "$name:\t" "$sign('$expected_result')"
+       else
+               echo -e '\033[31m[' 'FAIL' ']\e[0m' "$name:\t" "('\033[31m$check_result\e[0m'" "$nsign=" "'\033[32m$expected_result\e[0m')"
+               return_code=1
+       fi
+}
+
+check_command_exists result
+if [ -z "$command_exists" ]; then
+       exit 1
+fi
+
+return_code=0
+
+PLUGIN_FILE='@PLUGIN_DIR@/libsystem_info_plugins/libsystem_info_test_plugin.so'
+check_result "check_file_exists $PLUGIN_FILE" 'exists'
+PLUGIN_FILE='@PLUGIN_DIR@/libsystem_info_plugins/libsystem_info_test_plugin2.so'
+check_result "check_file_exists $PLUGIN_FILE" 'exists'
+
+check_result test_key_type_string_cmd 'plugin'
+check_result test_string_not_int_cmd 'ERROR : -22'
+check_result test_string_not_double_cmd 'ERROR : -22'
+check_result test_string_not_bool_cmd 'ERROR : -22'
+check_result test_key_type_int_cmd '1'
+check_result test_key_type_double_cmd '2.0'
+check_result test_key_type_bool_cmd '1'
+check_result test_bool_not_string_cmd 'ERROR : -22'
+check_result test_bool_not_int_cmd 'ERROR : -22'
+check_result test_bool_not_double_cmd 'ERROR : -22'
+check_result test_second_plugin_str_cmd 'various key'
+check_result test_right_plugin_str_cmd 'first_in_lexicographical_order'
+check_result test_right_plugin_str_cmd 'second_in_lexicographical_order' '!'
+check_result test_right_plugin_str_cmd 'ERROR : -22' '!'
+
+exit $return_code