You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/03/28 06:45:58 UTC

[incubator-teaclave] branch develop updated (ac815de -> f0ed349)

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git.


    from ac815de  [tests] End-to-End test with helper functions (#254)
     new 8cfbe6c  [config] Introduce the build_config feature to disable build config
     new f0ed349  [services] Fix the end_to_end functional test issues

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 attestation/Cargo.toml                          |  2 +-
 config/Cargo.toml                               |  1 +
 config/build.rs                                 | 14 +++++++++-----
 config/src/lib.rs                               |  2 ++
 services/access_control/enclave/Cargo.toml      |  1 +
 services/execution/enclave/Cargo.toml           |  1 +
 services/execution/enclave/src/service.rs       |  8 ++++----
 services/frontend/enclave/Cargo.toml            |  1 +
 services/management/enclave/Cargo.toml          |  1 +
 services/management/enclave/src/service.rs      |  2 +-
 services/proto/src/teaclave_frontend_service.rs |  6 +++---
 services/scheduler/enclave/Cargo.toml           |  1 +
 tests/functional/enclave/Cargo.toml             |  1 +
 tests/functional/enclave/src/end_to_end.rs      | 14 +++++++-------
 14 files changed, 34 insertions(+), 21 deletions(-)


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


[incubator-teaclave] 01/02: [config] Introduce the build_config feature to disable build config

Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8cfbe6c53944b1f0191249c8a963f11a60767299
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Fri Mar 27 22:53:16 2020 -0700

    [config] Introduce the build_config feature to disable build config
---
 attestation/Cargo.toml                     |  2 +-
 config/Cargo.toml                          |  1 +
 config/build.rs                            | 14 +++++++++-----
 config/src/lib.rs                          |  2 ++
 services/access_control/enclave/Cargo.toml |  1 +
 services/execution/enclave/Cargo.toml      |  1 +
 services/frontend/enclave/Cargo.toml       |  1 +
 services/management/enclave/Cargo.toml     |  1 +
 services/scheduler/enclave/Cargo.toml      |  1 +
 tests/functional/enclave/Cargo.toml        |  1 +
 10 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/attestation/Cargo.toml b/attestation/Cargo.toml
index db741e2..251fd86 100644
--- a/attestation/Cargo.toml
+++ b/attestation/Cargo.toml
@@ -38,7 +38,7 @@ url              = { version = "2.1.1" }
 yasna            = { version = "0.3.0", features = ["bit-vec", "num-bigint", "chrono"] }
 
 teaclave_types  = { path = "../types" }
-teaclave_config = { path = "../config" }
+teaclave_config = { path = "../config", features = ["build_config"] }
 teaclave_test_utils = { path = "../tests/utils" }
 
 sgx_rand    = { version = "1.1.0", optional = true }
diff --git a/config/Cargo.toml b/config/Cargo.toml
index f3825e3..b5600bd 100644
--- a/config/Cargo.toml
+++ b/config/Cargo.toml
@@ -9,6 +9,7 @@ edition = "2018"
 [features]
 default = []
 mesalock_sgx = ["sgx_tstd"]
+build_config = []
 
 [dependencies]
 anyhow = { version = "1.0.26" }
diff --git a/config/build.rs b/config/build.rs
index 31ed439..a7a3ae4 100644
--- a/config/build.rs
+++ b/config/build.rs
@@ -15,12 +15,13 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::env;
-use std::path::Path;
-use std::process::Command;
-use std::str;
-
+#[cfg(feature = "build_config")]
 fn main() {
+    use std::env;
+    use std::path::Path;
+    use std::process::Command;
+    use std::str;
+
     let is_sim = env::var("SGX_MODE").unwrap_or_else(|_| "HW".to_string());
     match is_sim.as_ref() {
         "HW" => {}
@@ -58,3 +59,6 @@ fn main() {
         );
     }
 }
+
+#[cfg(not(feature = "build_config"))]
+fn main() {}
diff --git a/config/src/lib.rs b/config/src/lib.rs
index 1ca24e2..6b075df 100644
--- a/config/src/lib.rs
+++ b/config/src/lib.rs
@@ -29,8 +29,10 @@ pub(crate) enum ConfigSource {
     Path(PathBuf),
 }
 
+#[cfg(feature = "build_config")]
 mod build;
 mod runtime;
 
+#[cfg(feature = "build_config")]
 pub use build::BUILD_CONFIG;
 pub use runtime::RuntimeConfig;
diff --git a/services/access_control/enclave/Cargo.toml b/services/access_control/enclave/Cargo.toml
index 5c34b48..a30680e 100644
--- a/services/access_control/enclave/Cargo.toml
+++ b/services/access_control/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/services/execution/enclave/Cargo.toml b/services/execution/enclave/Cargo.toml
index 296b052..cb14b5e 100644
--- a/services/execution/enclave/Cargo.toml
+++ b/services/execution/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
   "teaclave_worker/mesalock_sgx",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
diff --git a/services/frontend/enclave/Cargo.toml b/services/frontend/enclave/Cargo.toml
index 028899a..c3f73a3 100644
--- a/services/frontend/enclave/Cargo.toml
+++ b/services/frontend/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/services/management/enclave/Cargo.toml b/services/management/enclave/Cargo.toml
index 3a6ef96..bbd07ce 100644
--- a/services/management/enclave/Cargo.toml
+++ b/services/management/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/services/scheduler/enclave/Cargo.toml b/services/scheduler/enclave/Cargo.toml
index 90fcd43..7c2a7da 100644
--- a/services/scheduler/enclave/Cargo.toml
+++ b/services/scheduler/enclave/Cargo.toml
@@ -21,6 +21,7 @@ mesalock_sgx = [
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
 ]
 cov = ["teaclave_service_enclave_utils/cov"]
 enclave_unit_test = ["teaclave_binder/enclave_unit_test", "teaclave_test_utils/mesalock_sgx"]
diff --git a/tests/functional/enclave/Cargo.toml b/tests/functional/enclave/Cargo.toml
index 4ffec03..7c90813 100644
--- a/tests/functional/enclave/Cargo.toml
+++ b/tests/functional/enclave/Cargo.toml
@@ -19,6 +19,7 @@ mesalock_sgx = [
   "teaclave_binder/mesalock_sgx",
   "teaclave_rpc/mesalock_sgx",
   "teaclave_config/mesalock_sgx",
+  "teaclave_config/build_config",
   "teaclave_service_enclave_utils/mesalock_sgx",
   "teaclave_types/mesalock_sgx",
   "teaclave_test_utils/mesalock_sgx",


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


[incubator-teaclave] 02/02: [services] Fix the end_to_end functional test issues

Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f0ed34932487903fcc7d219233c1126d4490d381
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Fri Mar 27 23:25:48 2020 -0700

    [services] Fix the end_to_end functional test issues
---
 services/execution/enclave/src/service.rs       |  8 ++++----
 services/management/enclave/src/service.rs      |  2 +-
 services/proto/src/teaclave_frontend_service.rs |  6 +++---
 tests/functional/enclave/src/end_to_end.rs      | 14 +++++++-------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/services/execution/enclave/src/service.rs b/services/execution/enclave/src/service.rs
index 829a7c9..91028ff 100644
--- a/services/execution/enclave/src/service.rs
+++ b/services/execution/enclave/src/service.rs
@@ -83,17 +83,17 @@ impl TeaclaveExecutionService {
             let staged_task = response.staged_task;
             let result = self.invoke_task(&staged_task).unwrap();
             log::debug!("result: {:?}", result);
-            match self.update_task_status(&staged_task.task_id, TaskStatus::Finished) {
+            match self.update_task_result(&staged_task.task_id, result) {
                 Ok(_) => (),
                 Err(e) => {
-                    log::error!("UpdateTask Error: {:?}", e);
+                    log::error!("UpdateResult Error: {:?}", e);
                     continue;
                 }
             }
-            match self.update_task_result(&staged_task.task_id, result) {
+            match self.update_task_status(&staged_task.task_id, TaskStatus::Finished) {
                 Ok(_) => (),
                 Err(e) => {
-                    log::error!("UpdateResult Error: {:?}", e);
+                    log::error!("UpdateTask Error: {:?}", e);
                     continue;
                 }
             }
diff --git a/services/management/enclave/src/service.rs b/services/management/enclave/src/service.rs
index 425a71d..a48968c 100644
--- a/services/management/enclave/src/service.rs
+++ b/services/management/enclave/src/service.rs
@@ -387,7 +387,7 @@ impl TeaclaveManagement for TeaclaveManagementService {
             approved_user_list: task.approved_user_list,
             input_map: task.input_map,
             output_map: task.output_map,
-            return_value: task.return_value,
+            return_value: task.return_value.unwrap_or_default(),
             output_file_hash: task.output_file_hash,
             status: task.status,
         };
diff --git a/services/proto/src/teaclave_frontend_service.rs b/services/proto/src/teaclave_frontend_service.rs
index 29c47e4..261b033 100644
--- a/services/proto/src/teaclave_frontend_service.rs
+++ b/services/proto/src/teaclave_frontend_service.rs
@@ -329,7 +329,7 @@ pub struct GetTaskResponse {
     pub approved_user_list: HashSet<String>,
     pub input_map: HashMap<String, String>,
     pub output_map: HashMap<String, String>,
-    pub return_value: Option<Vec<u8>>,
+    pub return_value: Vec<u8>,
     pub output_file_hash: HashMap<String, String>,
     pub status: TaskStatus,
 }
@@ -976,7 +976,7 @@ impl std::convert::TryFrom<proto::GetTaskResponse> for GetTaskResponse {
             approved_user_list: proto.approved_user_list.into_iter().collect(),
             input_map,
             output_map,
-            return_value: Some(proto.return_value),
+            return_value: proto.return_value,
             output_file_hash: proto.output_file_hash,
             status,
         };
@@ -1005,7 +1005,7 @@ impl From<GetTaskResponse> for proto::GetTaskResponse {
             approved_user_list: response.approved_user_list.into_iter().collect(),
             input_map,
             output_map,
-            return_value: response.return_value.unwrap_or_default(),
+            return_value: response.return_value,
             output_file_hash: response.output_file_hash,
             status,
         }
diff --git a/tests/functional/enclave/src/end_to_end.rs b/tests/functional/enclave/src/end_to_end.rs
index 48cf94d..52aa164 100644
--- a/tests/functional/enclave/src/end_to_end.rs
+++ b/tests/functional/enclave/src/end_to_end.rs
@@ -12,11 +12,11 @@ use teaclave_rpc::config::SgxTrustedTlsClientConfig;
 use teaclave_rpc::endpoint::Endpoint;
 use teaclave_types::*;
 
-static USERNAME: &'static str = "alice";
-static PASSWORD: &'static str = "daHosldOdker0sS";
-static CONFIG_FILE: &'static str = "runtime.config.toml";
-static AUTH_SERVICE_ADDR: &'static str = "localhost:7776";
-static FRONTEND_SERVICE_ADDR: &'static str = "localhost:7777";
+const USERNAME: &str = "alice";
+const PASSWORD: &str = "daHosldOdker0sS";
+const CONFIG_FILE: &str = "runtime.config.toml";
+const AUTH_SERVICE_ADDR: &str = "localhost:7776";
+const FRONTEND_SERVICE_ADDR: &str = "localhost:7777";
 
 pub fn run_tests() -> bool {
     use teaclave_test_utils::*;
@@ -107,8 +107,8 @@ fn test_echo_task() {
         let response = client.get_task(request).unwrap();
         log::info!("Get task: {:?}", response);
         std::thread::sleep(std::time::Duration::from_secs(1));
-        if response.status != TaskStatus::Running {
-            let ret_val = String::from_utf8(response.return_value.unwrap()).unwrap();
+        if response.status == TaskStatus::Finished {
+            let ret_val = String::from_utf8(response.return_value).unwrap();
             log::info!("Task returns: {:?}", ret_val);
             assert_eq!(&ret_val, "Hello From Teaclave!");
             break;


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