Add Ubuntu 20.04 pipeline to CI and fix testing concurrent issue (#604)
* Add 2004 release pipeline
* Wait background jobs to be killed
* Fix file agent test issue caused by concurrent testing
* Add info log for test script
diff --git a/.drone.yml b/.drone.yml
index ff75a2b..cd48cfe 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -323,6 +323,94 @@
---
+x-dcap-2004-image: &dcap-2004-image
+ image: teaclave/teaclave-build-ubuntu-2004-sgx-dcap-1.12.1:0.1.2
+
+kind: pipeline
+name: sgx-dcap-release-ubuntu-2004
+
+steps:
+- name: prepare
+ <<: *dcap-2004-image
+ commands:
+ - . /root/.cargo/env
+ - . /opt/sgxsdk/environment
+ - mkdir -p build
+ - cd build && cmake -DCMAKE_BUILD_TYPE=Release -DTEST_MODE=OFF -DDCAP=ON ..
+- name: check
+ <<: *dcap-2004-image
+ commands:
+ - . /root/.cargo/env
+ - . /opt/sgxsdk/environment
+ - cd build && make check
+- name: compile
+ <<: *dcap-2004-image
+ commands:
+ - . /root/.cargo/env
+ - . /opt/sgxsdk/environment
+ - sed -i 's/ias_root_ca_cert/dcap_root_ca_cert/' config/build.config.toml
+ - cd build && make VERBOSE=1 -j2
+- name: tvm example
+ <<: *dcap-2004-image
+ commands:
+ - . ~/.cargo/env
+ - cd examples/python/wasm_tvm_mnist_payload
+ - make
+- name: test
+ <<: *dcap-2004-image
+ environment:
+ AS_ALGO: sgx_ecdsa
+ AS_URL: https://localhost:8080
+ AS_KEY:
+ from_secret: V5_KEY
+ AS_SPID:
+ from_secret: V5_SPID
+ privileged: true
+ volumes:
+ - name: sgx
+ path: /dev/sgx
+ - name: sgx_enclave
+ path: /dev/sgx_enclave
+ - name: sgx_provision
+ path: /dev/sgx_provision
+ - name: aesmd
+ path: /var/run/aesmd/aesm.socket
+ - name: aesmd-conf
+ path: /etc/aesmd.conf
+ - name: qcnl
+ path: /etc/sgx_default_qcnl.conf
+ commands:
+ - echo "$(ip route | awk 'NR==1 {print $3}') pccs-server" >> /etc/hosts
+ - . /root/.cargo/env
+ - . /opt/sgxsdk/environment
+ - (cd release/dcap && ./teaclave_dcap_ref_as &)
+ - cd build && make run-examples
+
+volumes:
+- name: sgx
+ host:
+ path: /dev/sgx
+- name: sgx_enclave
+ host:
+ path: /dev/sgx_enclave
+- name: sgx_provision
+ host:
+ path: /dev/sgx_provision
+- name: aesmd
+ host:
+ path: /var/run/aesmd/aesm.socket
+- name: aesmd-conf
+ host:
+ path: /etc/aesmd.conf
+- name: qcnl
+ host:
+ path: /etc/sgx_default_qcnl.conf
+
+node:
+ instance: mesatee-sgx-dcap
+
+---
+
x-isgx-1804-image: &isgx-1804-image
image: teaclave/teaclave-build-ubuntu-1804-sgx-2.14:0.1.3
diff --git a/cmake/scripts/test.sh b/cmake/scripts/test.sh
index dd246fb..a2eb075 100755
--- a/cmake/scripts/test.sh
+++ b/cmake/scripts/test.sh
@@ -18,6 +18,7 @@
# under the License.
set -eE
+export TEACLAVE_LOG=teaclave=info
if [ -z "${TEACLAVE_PROJECT_ROOT}" ] \
|| [ -z "${SGX_SDK}" ] || [ -z "${SGX_MODE}" ]; then
@@ -60,7 +61,8 @@
cleanup() {
# kill all background services
[[ -z "$(jobs -p -r)" ]] || kill -s SIGKILL $(jobs -p -r)
- sleep 1 # wait for resource release
+ wait # wait for resource release
+ echo "All jobs killed."
}
wait_port() {
diff --git a/file_agent/src/agent.rs b/file_agent/src/agent.rs
index dd6e8dc..2e1bf2e 100644
--- a/file_agent/src/agent.rs
+++ b/file_agent/src/agent.rs
@@ -275,7 +275,7 @@
fn test_get_single_file() {
let s = "http://localhost:6789/fixtures/functions/mesapy/input.txt";
let url = Url::parse(s).unwrap();
- let dest = PathBuf::from("/tmp/input_test.txt");
+ let dest = PathBuf::from("/tmp/input_test_get_single_file.txt");
let info = HandleFileInfo::new(&dest, &url);
let req = FileAgentRequest::new(HandleFileCommand::Download, vec![info], "");
@@ -392,7 +392,7 @@
#[test]
fn test_data_scheme() {
let url = Url::parse("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==").unwrap();
- let dest = PathBuf::from("/tmp/input_test.txt");
+ let dest = PathBuf::from("/tmp/input_test_data_scheme.txt");
let info = HandleFileInfo::new(&dest, &url);
let req = FileAgentRequest::new(HandleFileCommand::Download, vec![info], "");