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/04/30 23:47:14 UTC

[incubator-teaclave] 02/02: [services] Fix building issue when TEST_MODE=OFF

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-teaclave.git

commit e2b92f41ab8f8f45db3ce4dc534754111955edcb
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Thu Apr 30 16:15:52 2020 -0700

    [services] Fix building issue when TEST_MODE=OFF
---
 .drone.yml                                 |  7 ++++++-
 services/management/enclave/src/service.rs | 14 ++++++++++----
 worker/src/worker.rs                       |  4 ++--
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/.drone.yml b/.drone.yml
index 81bbf1a..32a0985 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -135,7 +135,12 @@ steps:
   image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0
   commands:
   - . /root/.cargo/env
-  - cd build && make VERBOSE=1 -j2
+  - cd build && cmake -DTEST_MODE=OFF .. && make VERBOSE=1 -j2
+- name: compile-test-mode
+  image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0
+  commands:
+  - . /root/.cargo/env
+  - cd build && cmake -DTEST_MODE=ON .. && make VERBOSE=1 -j2
 - name: test
   image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0
   privileged: true
diff --git a/services/management/enclave/src/service.rs b/services/management/enclave/src/service.rs
index 0ba09b4..7fd767a 100644
--- a/services/management/enclave/src/service.rs
+++ b/services/management/enclave/src/service.rs
@@ -37,9 +37,11 @@ use teaclave_proto::teaclave_storage_service::{
 use teaclave_rpc::endpoint::Endpoint;
 use teaclave_rpc::Request;
 use teaclave_service_enclave_utils::{ensure, teaclave_service};
-use teaclave_types::Function;
-#[cfg(test_mode)]
-use teaclave_types::*;
+use teaclave_types::{
+    ExternalID, FileCrypto, Function, FunctionInputFile, FunctionOutputFile, OwnerList, StagedTask,
+    Storable, Task, TaskStatus, TeaclaveInputFile, TeaclaveOutputFile,
+    TeaclaveServiceResponseError, TeaclaveServiceResponseResult, UserID,
+};
 use thiserror::Error;
 use url::Url;
 use uuid::Uuid;
@@ -545,6 +547,7 @@ impl TeaclaveManagementService {
 
     #[cfg(test_mode)]
     fn add_mock_data(&self) -> Result<()> {
+        use teaclave_types::{FileAuthTag, FunctionInput, FunctionOutput};
         let mut output_file = self.create_fusion_data(vec!["mock_user1", "frontend_user"])?;
         output_file.uuid = Uuid::parse_str("00000000-0000-0000-0000-000000000001")?;
         output_file.cmac = Some(FileAuthTag::mock());
@@ -597,7 +600,10 @@ impl TeaclaveManagementService {
 pub mod tests {
     use super::*;
     use std::collections::HashMap;
-    use teaclave_types::{hashmap, FileCrypto, FunctionArguments, FunctionInput, FunctionOutput};
+    use teaclave_types::{
+        hashmap, Executor, FileAuthTag, FileCrypto, FunctionArguments, FunctionInput,
+        FunctionOutput,
+    };
     use url::Url;
 
     pub fn handle_input_file() {
diff --git a/worker/src/worker.rs b/worker/src/worker.rs
index c94d64a..2109451 100644
--- a/worker/src/worker.rs
+++ b/worker/src/worker.rs
@@ -24,7 +24,7 @@ use std::format;
 use teaclave_types::{Executor, ExecutorType, StagedFiles, StagedFunction};
 
 use teaclave_executor::{BuiltinFunctionExecutor, MesaPy};
-use teaclave_runtime::{DefaultRuntime, RawIoRuntime};
+use teaclave_runtime::DefaultRuntime;
 use teaclave_types::{TeaclaveExecutor, TeaclaveRuntime};
 
 type BoxedTeaclaveExecutor = Box<dyn TeaclaveExecutor + Send + Sync>;
@@ -48,7 +48,7 @@ impl Default for Worker {
 
         #[cfg(test_mode)]
         worker.register_runtime("raw-io", |input, output| {
-            Box::new(RawIoRuntime::new(input, output))
+            Box::new(teaclave_runtime::RawIoRuntime::new(input, output))
         });
 
         // Register supported executors


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