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 2022/01/08 08:40:41 UTC
[incubator-teaclave] branch master updated: Move execution context into a seperate crate (#598)
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
The following commit(s) were added to refs/heads/master by this push:
new 7305cf3 Move execution context into a seperate crate (#598)
7305cf3 is described below
commit 7305cf3c4afd817bc623093f3f3d5d455dbc24c2
Author: Qinkun Bao <qi...@gmail.com>
AuthorDate: Sat Jan 8 00:40:37 2022 -0800
Move execution context into a seperate crate (#598)
---
executor/Cargo.toml | 4 +++-
{function => executor/context}/Cargo.toml | 22 +++++++++------------
executor/{ => context}/src/context.rs | 0
executor/{ => context}/src/lib.rs | 32 +------------------------------
executor/src/lib.rs | 3 ---
executor/src/mesapy.rs | 6 +++---
executor/src/wamr.rs | 8 ++++----
function/Cargo.toml | 2 ++
tests/unit/enclave/Cargo.toml | 3 +++
tests/unit/enclave/src/lib.rs | 1 +
10 files changed, 26 insertions(+), 55 deletions(-)
diff --git a/executor/Cargo.toml b/executor/Cargo.toml
index 76e0364..2a99482 100644
--- a/executor/Cargo.toml
+++ b/executor/Cargo.toml
@@ -35,11 +35,12 @@ mesalock_sgx = [
"teaclave_crypto/mesalock_sgx",
"teaclave_runtime/mesalock_sgx",
"teaclave_function/mesalock_sgx",
+ "teaclave_executor_context/mesalock_sgx",
]
cov = ["sgx_cov"]
enclave_unit_test = [
"teaclave_test_utils/mesalock_sgx",
- "teaclave_runtime/mesalock_sgx"
+ "teaclave_runtime/mesalock_sgx",
]
# Enable builtin functions for the builtin executor
@@ -87,6 +88,7 @@ teaclave_crypto = { path = "../crypto" }
teaclave_runtime = { path = "../runtime", optional = true }
teaclave_test_utils = { path = "../tests/utils", optional = true }
teaclave_function = { path = "../function" }
+teaclave_executor_context = { path = "./context" }
sgx_cov = { version = "1.1.3", optional = true }
sgx_tstd = { version = "1.1.3", features = ["net", "thread", "backtrace"], optional = true }
diff --git a/function/Cargo.toml b/executor/context/Cargo.toml
similarity index 77%
copy from function/Cargo.toml
copy to executor/context/Cargo.toml
index a71769b..05760d1 100644
--- a/function/Cargo.toml
+++ b/executor/context/Cargo.toml
@@ -16,15 +16,15 @@
# under the License.
[package]
-name = "teaclave_function"
+name = "teaclave_executor_context"
version = "0.2.0"
authors = ["Teaclave Contributors <de...@teaclave.apache.org>"]
-description = "Teaclave built-in functions."
+description = "Teaclave executor"
license = "Apache-2.0"
edition = "2018"
[lib]
-name = "teaclave_function"
+name = "teaclave_executor_context"
crate-type = ["staticlib", "rlib"]
[features]
@@ -41,8 +41,9 @@ enclave_unit_test = [
"teaclave_runtime/mesalock_sgx"
]
+
[dependencies]
-log = { version = "0.4.6", features = ["release_max_level_info"] }
+log = { version = "0.4.6", features = ["release_max_level_debug"] }
anyhow = { version = "1.0.26" }
serde_json = { version = "1.0.39" }
serde = { version = "1.0.92", features = ["derive"] }
@@ -50,16 +51,11 @@ thiserror = { version = "1.0.9" }
gbdt = { version = "0.1.0", features = ["input", "enable_training"] }
rusty-machine = { version = "0.5.4" }
itertools = { version = "0.8.0", default-features = false }
-ring = { version = "0.16.5" }
-base64 = { version = "0.13.0" }
-hex = { version = "0.4.0" }
-image = { version = "0.22.4" }
-rustface = { version = "0.1.2", features = [ "include_default_model" ] }
-teaclave_types = { path = "../types" }
-teaclave_crypto = { path = "../crypto" }
-teaclave_runtime = { path = "../runtime", optional = true }
-teaclave_test_utils = { path = "../tests/utils", optional = true }
+teaclave_types = { path = "../../types" }
+teaclave_crypto = { path = "../../crypto" }
+teaclave_runtime = { path = "../../runtime", optional = true }
+teaclave_test_utils = { path = "../../tests/utils", optional = true }
sgx_cov = { version = "1.1.3", optional = true }
sgx_tstd = { version = "1.1.3", features = ["net", "thread", "backtrace"], optional = true }
diff --git a/executor/src/context.rs b/executor/context/src/context.rs
similarity index 100%
rename from executor/src/context.rs
rename to executor/context/src/context.rs
diff --git a/executor/src/lib.rs b/executor/context/src/lib.rs
similarity index 57%
copy from executor/src/lib.rs
copy to executor/context/src/lib.rs
index d11933f..0e33fe2 100644
--- a/executor/src/lib.rs
+++ b/executor/context/src/lib.rs
@@ -25,34 +25,4 @@ use std::prelude::v1::*;
#[macro_use]
extern crate log;
-#[cfg(executor_builtin)]
-mod builtin;
-mod context;
-#[cfg(executor_mesapy)]
-mod mesapy;
-#[cfg(executor_wamr)]
-mod wamr;
-
-#[cfg(executor_builtin)]
-pub use builtin::BuiltinFunctionExecutor;
-#[cfg(executor_mesapy)]
-pub use mesapy::MesaPy;
-#[cfg(executor_wamr)]
-pub use wamr::WAMicroRuntime;
-
-#[cfg(feature = "enclave_unit_test")]
-pub mod tests {
- use super::*;
-
- pub fn run_tests() -> bool {
- let mut v: Vec<bool> = Vec::new();
- v.push(context::tests::run_tests());
- #[cfg(executor_mesapy)]
- v.push(mesapy::tests::run_tests());
- #[cfg(executor_builtin)]
- v.push(builtin::tests::run_tests());
- #[cfg(executor_wamr)]
- v.push(wamr::tests::run_tests());
- v.iter().all(|&x| x)
- }
-}
+pub mod context;
diff --git a/executor/src/lib.rs b/executor/src/lib.rs
index d11933f..86a4c2e 100644
--- a/executor/src/lib.rs
+++ b/executor/src/lib.rs
@@ -22,12 +22,10 @@ extern crate sgx_tstd as std;
#[cfg(feature = "mesalock_sgx")]
use std::prelude::v1::*;
-#[macro_use]
extern crate log;
#[cfg(executor_builtin)]
mod builtin;
-mod context;
#[cfg(executor_mesapy)]
mod mesapy;
#[cfg(executor_wamr)]
@@ -46,7 +44,6 @@ pub mod tests {
pub fn run_tests() -> bool {
let mut v: Vec<bool> = Vec::new();
- v.push(context::tests::run_tests());
#[cfg(executor_mesapy)]
v.push(mesapy::tests::run_tests());
#[cfg(executor_builtin)]
diff --git a/executor/src/mesapy.rs b/executor/src/mesapy.rs
index 713149c..1716438 100644
--- a/executor/src/mesapy.rs
+++ b/executor/src/mesapy.rs
@@ -17,9 +17,9 @@
use std::prelude::v1::*;
-use crate::context::reset_thread_context;
-use crate::context::set_thread_context;
-use crate::context::Context;
+use teaclave_executor_context::context::reset_thread_context;
+use teaclave_executor_context::context::set_thread_context;
+use teaclave_executor_context::context::Context;
use std::ffi::CString;
diff --git a/executor/src/wamr.rs b/executor/src/wamr.rs
index fcec5be..21c9cb8 100644
--- a/executor/src/wamr.rs
+++ b/executor/src/wamr.rs
@@ -17,10 +17,10 @@
use std::prelude::v1::*;
-use crate::context::reset_thread_context;
-use crate::context::set_thread_context;
-use crate::context::Context;
-use crate::context::{
+use teaclave_executor_context::context::reset_thread_context;
+use teaclave_executor_context::context::set_thread_context;
+use teaclave_executor_context::context::Context;
+use teaclave_executor_context::context::{
wasm_close_file, wasm_create_output, wasm_open_input, wasm_read_file, wasm_write_file,
};
diff --git a/function/Cargo.toml b/function/Cargo.toml
index a71769b..8079eb1 100644
--- a/function/Cargo.toml
+++ b/function/Cargo.toml
@@ -34,6 +34,7 @@ mesalock_sgx = [
"teaclave_types/mesalock_sgx",
"teaclave_crypto/mesalock_sgx",
"teaclave_runtime/mesalock_sgx",
+ "teaclave_executor_context/mesalock_sgx",
]
cov = ["sgx_cov"]
enclave_unit_test = [
@@ -60,6 +61,7 @@ teaclave_types = { path = "../types" }
teaclave_crypto = { path = "../crypto" }
teaclave_runtime = { path = "../runtime", optional = true }
teaclave_test_utils = { path = "../tests/utils", optional = true }
+teaclave_executor_context = { path = "../executor/context" }
sgx_cov = { version = "1.1.3", optional = true }
sgx_tstd = { version = "1.1.3", features = ["net", "thread", "backtrace"], optional = true }
diff --git a/tests/unit/enclave/Cargo.toml b/tests/unit/enclave/Cargo.toml
index cff44a9..80f971d 100644
--- a/tests/unit/enclave/Cargo.toml
+++ b/tests/unit/enclave/Cargo.toml
@@ -63,6 +63,8 @@ mesalock_sgx = [
"teaclave_function/enclave_unit_test",
"teaclave_runtime/mesalock_sgx",
"teaclave_runtime/enclave_unit_test",
+ "teaclave_executor_context/mesalock_sgx",
+ "teaclave_executor_context/enclave_unit_test",
"rusty-leveldb/mesalock_sgx",
"rusty-leveldb/enclave_unit_test",
]
@@ -84,6 +86,7 @@ teaclave_frontend_service_enclave = { path = "../../../services/frontend/enclave
teaclave_worker = { path = "../../../worker" }
teaclave_executor = { path = "../../../executor" }
+teaclave_executor_context = { path = "../../../executor/context" }
teaclave_function = { path = "../../../function" }
teaclave_runtime = { path = "../../../runtime" }
rusty-leveldb = { path = "../../../common/rusty_leveldb_sgx", default-features = false, optional = true }
diff --git a/tests/unit/enclave/src/lib.rs b/tests/unit/enclave/src/lib.rs
index 192d8fc..5262123 100644
--- a/tests/unit/enclave/src/lib.rs
+++ b/tests/unit/enclave/src/lib.rs
@@ -42,6 +42,7 @@ fn handle_run_test(_: &RunTestInput) -> TeeServiceResult<RunTestOutput> {
teaclave_worker::tests::run_tests(),
teaclave_runtime::tests::run_tests(),
teaclave_executor::tests::run_tests(),
+ teaclave_executor_context::context::tests::run_tests(),
teaclave_function::tests::run_tests(),
teaclave_types::tests::run_tests(),
teaclave_crypto::tests::run_tests(),
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org