Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion attestation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mesalock_sgx = [
"sgx_tse",
"teaclave_types/mesalock_sgx",
"teaclave_config/mesalock_sgx",
"teaclave_config/build_config",
]
enclave_unit_test = ["teaclave_test_utils/mesalock_sgx"]

Expand All @@ -40,7 +41,7 @@ webpki-roots = { version = "0.19.0" }
yasna = { version = "0.3.0", features = ["bit-vec", "num-bigint", "chrono"] }

teaclave_types = { path = "../types" }
teaclave_config = { path = "../config", features = ["build_config"] }
teaclave_config = { path = "../config" }
teaclave_test_utils = { path = "../tests/utils", optional = true }

sgx_rand = { version = "1.1.2", optional = true }
Expand Down
1 change: 1 addition & 0 deletions cmake/TeaclaveGenVars.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ set(TEACLAVE_COMMON_ENVS
TEACLAVE_BUILD_CFG_DIR=${PROJECT_SOURCE_DIR}
TEACLAVE_EDL_DIR=${TEACLAVE_EDL_DIR}
TEACLAVE_SYMLINKS=${TEACLAVE_SYMLINKS}
RUSTFLAGS=${RUSTFLAGS}
SGX_SDK=${SGX_SDK}
SGX_MODE=${SGX_MODE}
DCAP=${DCAP}
Expand Down
3 changes: 3 additions & 0 deletions cmake/UtilTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ if(TEST_MODE)
add_custom_target(
run-functional-tests COMMAND ${TEACLAVE_COMMON_ENVS}
${MT_SCRIPT_DIR}/test.sh functional)
add_custom_target(
run-sdk-tests COMMAND ${TEACLAVE_COMMON_ENVS}
${MT_SCRIPT_DIR}/test.sh sdk)
else()
add_custom_target(
run-tests
Expand Down
42 changes: 42 additions & 0 deletions cmake/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,44 @@ run_functional_tests() {
cleanup
}

run_sdk_tests() {
trap cleanup INT TERM ERR

echo_title "SDK tests"
mkdir -p /tmp/fusion_data
pushd ${TEACLAVE_CLI_INSTALL_DIR}
./teaclave_cli verify \
--enclave-info ../examples/enclave_info.toml \
--public-keys $(find ../examples -name "*.public.pem") \
--signatures $(find ../examples -name "*.sign.sha256")
popd
pushd ${TEACLAVE_SERVICE_INSTALL_DIR}
./teaclave_authentication_service &
./teaclave_storage_service &
sleep 3 # wait for authentication and storage service
./teaclave_management_service &
./teaclave_scheduler_service &
sleep 3 # wait for management service and scheduler_service
./teaclave_access_control_service &
./teaclave_frontend_service &
sleep 3 # wait for other services

start_storage_server

# Run tests of execution service separately
./teaclave_execution_service &
sleep 3 # wait for execution services
popd

pushd ${MT_SGXAPP_TOML_DIR}
RUSTFLAGS=${RUSTFLAGS} cargo test --manifest-path ${TEACLAVE_PROJECT_ROOT}/sdk/rust/Cargo.toml \
--target-dir ${TEACLAVE_TARGET_DIR}/untrusted
popd

# kill all background services
cleanup
}

run_examples() {
trap cleanup INT TERM ERR

Expand Down Expand Up @@ -207,13 +245,17 @@ case "$1" in
"functional")
run_functional_tests
;;
"sdk")
run_sdk_tests
;;
"example")
run_examples
;;
*)
run_unit_tests
run_integration_tests
run_functional_tests
run_sdk_tests
run_examples
;;
esac
1 change: 1 addition & 0 deletions docs/build-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Above targets are automatically generated from the
- `run-tests`: Run all test cases.
- `run-integration-tests`: Run integration tests only.
- `run-funtional-tests`: Run functional tests only.
- `run-sdk-tests`: Run tests of client SDK only.
- `run-examples`: Run all examples.
- `cov`: Aggregate coverage results and generate report, needs to config cmake
with `-DCOV=ON`.
Expand Down
16 changes: 16 additions & 0 deletions sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "teaclave-client-sdk"
version = "0.1.0"
authors = ["Teaclave Contributors <dev@teaclave.apache.org>"]
description = "Teaclave Rust Client SDK"
license = "Apache-2.0"
edition = "2018"

[dependencies]
teaclave_types = { path = "../../types", features = ["app"] }
teaclave_attestation = { path = "../../attestation" }
teaclave_rpc = { path = "../../rpc" }
teaclave_proto = { path = "../../services/proto" }
anyhow = { version = "1.0.26" }
url = { version = "2.1.1" }
pem = "0.7.0"
20 changes: 20 additions & 0 deletions sdk/rust/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

fn main() {
println!("cargo:rustc-env=MT_SGXAPP_TOML_DIR=../../");
}
Loading