Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

Commit d37170b

Browse files
authored
Merge pull request #97 from registreerocks/build-add-all.sh
build: add all.sh (plus README updates)
2 parents 733dfe0 + 772d4ca commit d37170b

File tree

3 files changed

+74
-19
lines changed

3 files changed

+74
-19
lines changed

README.md

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,16 @@ Use `docker-compose run dev` to start the dev container. This will put you in an
2121

2222
To run the application inside of the container, do `cd rtc-data` and then `./runall.sh`
2323

24-
## Running tests
24+
## Helper scripts
2525

26-
Helper script:
26+
Check, build, and test everything:
2727

2828
```shell
29-
./runtests.sh
29+
./all.sh
3030
```
3131

32-
Currently, some tests with static mocks can intermittently fail due to test thread concurrency.
33-
(For example, see test `rtc_enclave::tests::dcap_azure_attestation_works`.)
34-
35-
To avoid this, run:
32+
Run tests :
3633

3734
```shell
38-
cargo test -- --test-threads=1
39-
```
40-
41-
or set:
42-
43-
```shell
44-
export RUST_TEST_THREADS=1
35+
./runtests.sh
4536
```
46-
47-
TODO(Pi): We should probably configure single-threading by default in affected crates
48-
once `cargo test` implements this:
49-
50-
* [Enable specifying --test-threads in Cargo.toml #8430](https://github.com/rust-lang/cargo/issues/8430)

_hack_timestamp.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh -e
2+
3+
# See all.sh
4+
#
5+
# This works around cargo rebuilding sgx_unwind unnecessarily due to config.h.in* churn.
6+
# Run this before (and/or after) each relevant cargo invocation.
7+
8+
# See "Pinning SGX dependencies" in HACKING.md.
9+
# This revision should match the Rust SGX SDK revision we're pinned to.
10+
base='/root/.cargo/git/checkouts/incubator-teaclave-sgx-sdk-c63c8825343e87f0/b9d1bda/sgx_unwind/libunwind'
11+
12+
if test -e "$base"; then
13+
touch --reference "$base/configure.in" "$base/include/config.h.in" "$base/include/config.h.in~"
14+
else
15+
echo "$0: warning: missing $base"
16+
fi

all.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh -e
2+
# Check, build, and test everything
3+
4+
echo "################################################################################"
5+
echo "# make enclaves"
6+
echo "################################################################################"
7+
for enclave in 'rtc_data_enclave' 'rtc_auth_enclave' 'rtc_exec_enclave'; do
8+
./_hack_timestamp.sh
9+
(cd "$enclave" && make)
10+
done
11+
12+
# TODO: doc --document-private-items
13+
for action in check build doc test; do
14+
15+
for root in rtc_tenclave rtc_data_enclave rtc_auth_enclave rtc_exec_enclave .; do
16+
17+
args=''
18+
case "$root $action" in
19+
20+
# Skip enclave tests: not supported yet.
21+
'rtc_'*'_enclave test') continue ;;
22+
23+
# Only the root project can build all targets, so far
24+
'. build') args='--all-targets' ;;
25+
26+
27+
# FIXME: Skip enclave docs for now: rustdoc doesn't support const_evaluatable_checked yet.
28+
# Issue: https://github.com/rust-lang/rust/issues/77647
29+
'rtc_'*'enclave doc') continue ;;
30+
31+
# FIXME: Only the rtc_types docs build successfully right now.
32+
'. doc') args='--no-deps --package rtc_types' ;;
33+
34+
# Skip documenting dependencies, by default
35+
*' doc') args='--no-deps' ;;
36+
37+
# rtc_tenclave can test, but only with --no-default-features
38+
'rtc_tenclave test') args='--no-default-features' ;;
39+
40+
esac
41+
42+
# Show a big banner to make it easier to find and re-run failing commands.
43+
echo "################################################################################"
44+
echo "# (cd $root && cargo $action $args)"
45+
echo "################################################################################"
46+
./_hack_timestamp.sh
47+
(cd "$root" && cargo "$action" $args)
48+
done
49+
50+
done
51+
52+
# Final timestamp reset, for good measure.
53+
./_hack_timestamp.sh

0 commit comments

Comments
 (0)