mesatee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ms...@apache.org
Subject [incubator-mesatee] branch master updated: [build] Put enclave.signed.so files into different dirs according to their src paths. (#120)
Date Wed, 04 Dec 2019 03:39:26 GMT
This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mesatee.git


The following commit(s) were added to refs/heads/master by this push:
     new ee345b2  [build] Put enclave.signed.so files into different dirs according to their
src paths. (#120)
ee345b2 is described below

commit ee345b26ae0440e43844ed65b4e0f4bd3ddd9f08
Author: Rundong Zhou <rundongzhou@gmail.com>
AuthorDate: Tue Dec 3 19:39:17 2019 -0800

    [build] Put enclave.signed.so files into different dirs according to their src paths.
(#120)
---
 CMakeLists.txt                 |  3 +++
 cmake/MesaTEEUtils.cmake       | 11 +++++++++--
 cmake/scripts/sgx_link_sign.sh |  6 +++---
 tests/functional_test.sh       |  5 +++--
 tests/integration_test.sh      |  5 +++--
 5 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae71b33..583040f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,7 @@ parse_cargo_packages(SGX_APPS
 
 parse_cargo_packages(SGX_LIBS
     CARGO_TOML_PATH ${PROJECT_SOURCE_DIR}/cmake/tomls/Cargo.sgx_trusted_lib.toml
+    CATEGORIES SGX_LIB_CATEGORIES
     PKG_PATHS SGX_LIB_PATHS
 )
 
@@ -106,9 +107,11 @@ math(EXPR SGX_LIB_LAST_INDEX "${SGX_LIB_LEN} - 1")
 foreach(_i RANGE ${SGX_LIB_LAST_INDEX})
     list(GET SGX_LIBS ${_i} _pkg_name)
     list(GET SGX_LIB_PATHS ${_i} _pkg_path)
+    list(GET SGX_LIB_CATEGORIES ${_i} _category)
     sgxlib_pkgname_2_modname(${_pkg_name} _mod_name)
     add_sgx_build_target(${_pkg_path} ${_pkg_name}
         DEPENDS prep ${TARGET_CONFIG_GEN} "${SGXAPP_PREFIX}-${_mod_name}" pycomponent
+        INSTALL_DIR ${MESATEE_INSTALL_DIR}/${_category}
     )
 endforeach()
 
diff --git a/cmake/MesaTEEUtils.cmake b/cmake/MesaTEEUtils.cmake
index 2fbcf75..823ac36 100644
--- a/cmake/MesaTEEUtils.cmake
+++ b/cmake/MesaTEEUtils.cmake
@@ -124,11 +124,12 @@ endfunction()
 
 # add_sgx_build_target(sgx_lib_path
 # [DEPENDS [dep]...]
+# [INSTALL_DIR dir]
 # [EXTRA_CARGO_FLAGS flg...]
 # )
 function(add_sgx_build_target sgx_lib_path pkg_name)
     set(options)
-    set(oneValueArgs)
+    set(oneValueArgs INSTALL_DIR)
     set(multiValueArgs DEPENDS EXTRA_CARGO_FLAGS)
     cmake_parse_arguments(MTEE "${options}" "${oneValueArgs}"
         "${multiValueArgs}" ${ARGN})
@@ -139,6 +140,12 @@ function(add_sgx_build_target sgx_lib_path pkg_name)
         set(_depends)
     endif()
 
+    if (DEFINED MTEE_INSTALL_DIR)
+        set(_copy_dir ${MTEE_INSTALL_DIR})
+    else()
+        set(_copy_dir ${MESATEE_INSTALL_DIR})
+    endif()
+
     # remove trailing "_enclave" to get _module_name
     sgxlib_pkgname_2_modname(${pkg_name} _module_name)
 
@@ -149,7 +156,7 @@ function(add_sgx_build_target sgx_lib_path pkg_name)
             ${MT_SCRIPT_DIR}/cargo_build_ex.sh -p ${pkg_name}
             --target-dir ${TRUSTED_TARGET_DIR} ${CARGO_BUILD_FLAGS} ${SGX_ENCLAVE_FEATURES}
${MTEE_EXTRA_CARGO_FLAGS}
         COMMAND ${CMAKE_COMMAND} -E env ${TARGET_SGXLIB_ENVS} SGX_COMMON_CFLAGS=${STR_SGX_COMMON_CFLAGS}
-            CUR_MODULE_NAME=${_module_name} CUR_MODULE_PATH=${sgx_lib_path} ${MT_SCRIPT_DIR}/sgx_link_sign.sh
+            CUR_MODULE_NAME=${_module_name} CUR_MODULE_PATH=${sgx_lib_path} CUR_INSTALL_DIR=${_copy_dir}
${MT_SCRIPT_DIR}/sgx_link_sign.sh
         ${_depends}
         COMMENT "Building ${_target_name}"
         WORKING_DIRECTORY ${MT_SGXLIB_TOML_DIR}
diff --git a/cmake/scripts/sgx_link_sign.sh b/cmake/scripts/sgx_link_sign.sh
index 039341a..880f20f 100755
--- a/cmake/scripts/sgx_link_sign.sh
+++ b/cmake/scripts/sgx_link_sign.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 REQUIRED_ENVS=("CMAKE_C_COMPILER" "CUR_MODULE_NAME" "CUR_MODULE_PATH"
-"MESATEE_SERVICE_INSTALL_DIR" "MESATEE_OUT_DIR" "MESATEE_PROJECT_ROOT" "Service_Library_Name"
+"CUR_INSTALL_DIR" "MESATEE_OUT_DIR" "MESATEE_PROJECT_ROOT" "Service_Library_Name"
 "SGX_COMMON_CFLAGS" "SGX_ENCLAVE_SIGNER" "SGX_LIBRARY_PATH" "TARGET" "Trts_Library_Name"
 "TRUSTED_TARGET_DIR")
 for var in "${REQUIRED_ENVS[@]}"; do
@@ -10,7 +10,7 @@ done
 
 LIBENCLAVE_PATH="${TRUSTED_TARGET_DIR}/${TARGET}/lib${CUR_MODULE_NAME}_enclave.a"
 CONFIG_PATH="${MESATEE_PROJECT_ROOT}/${CUR_MODULE_PATH}/Enclave.config.xml"
-SIGNED_PATH="${MESATEE_SERVICE_INSTALL_DIR}/${CUR_MODULE_NAME}.enclave.signed.so"
+SIGNED_PATH="${CUR_INSTALL_DIR}/${CUR_MODULE_NAME}.enclave.signed.so"
 CUR_ENCLAVE_INFO_PATH="${MESATEE_OUT_DIR}/${CUR_MODULE_NAME}_enclave_info.txt"
 if [ ! "$LIBENCLAVE_PATH" -nt "$SIGNED_PATH" ] \
     && [ ! "$CONFIG_PATH" -nt "$SIGNED_PATH" ] \
@@ -35,7 +35,7 @@ ${CMAKE_C_COMPILER} libEnclave_t.o -o \
     -Wl,--version-script=${MESATEE_PROJECT_ROOT}/cmake/scripts/Enclave.lds
 ${SGX_ENCLAVE_SIGNER} sign -key ${MESATEE_PROJECT_ROOT}/cert/Enclave_private.pem \
     -enclave ${CUR_MODULE_NAME}.enclave.so \
-    -out ${MESATEE_SERVICE_INSTALL_DIR}/${CUR_MODULE_NAME}.enclave.signed.so \
+    -out ${CUR_INSTALL_DIR}/${CUR_MODULE_NAME}.enclave.signed.so \
     -config ${MESATEE_PROJECT_ROOT}/${CUR_MODULE_PATH}/Enclave.config.xml \
     -dumpfile ${CUR_MODULE_NAME}.enclave.meta.txt > /dev/null 2>&1
 echo ${CUR_MODULE_NAME} > ${CUR_MODULE_NAME}_enclave_info.txt
diff --git a/tests/functional_test.sh b/tests/functional_test.sh
index e626d41..aae5b73 100755
--- a/tests/functional_test.sh
+++ b/tests/functional_test.sh
@@ -5,7 +5,7 @@ trap "pkill -2 -P $$; wait" SIGINT SIGTERM EXIT
 cd ../release/services
 
 # prepare test data
-cp -r ../../tests/integration_test/test_data ./
+cp -r ../../tests/integration_test/test_data ../tests/
 
 # check port
 if lsof -i :6016; then
@@ -65,5 +65,6 @@ wait_service tms 5555 30
 wait_service fns 3444 30
 wait_service acs 5077 30
 
-../tests/functional_test 2>&1 | tee functional_test.log
+cd ../tests
+./functional_test 2>&1 | tee functional_test.log
 exit ${PIPESTATUS[0]}
diff --git a/tests/integration_test.sh b/tests/integration_test.sh
index 754ad12..19d77a9 100755
--- a/tests/integration_test.sh
+++ b/tests/integration_test.sh
@@ -5,7 +5,7 @@ trap "pkill -2 -P $$; wait" SIGINT SIGTERM EXIT
 cd ../release/services
 
 # prepare test data
-cp -r ../../tests/integration_test/test_data ./
+cp -r ../../tests/integration_test/test_data ../tests/
 
 # check ports
 for port in 5554 5555 3444 6016 5065 5066; do
@@ -49,7 +49,8 @@ wait_service "tms" 5555 30
 wait_service "fns" 3444 30
 
 echo "[+] run integration_test"
-../tests/integration_test 2>&1 | tee integration_test.log
+cd ../tests
+./integration_test 2>&1 | tee integration_test.log
 [ ${PIPESTATUS[0]} -eq 0 ] || exit ${PIPESTATUS[0]}
 
 echo "[+] run three_party_demo"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@mesatee.apache.org
For additional commands, e-mail: commits-help@mesatee.apache.org


Mime
View raw message