Skip to content

Commit

Permalink
Add x86_64-fortanix-unknown-sgx to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jethro Beekman committed Feb 4, 2019
1 parent b5a27da commit 9b4697c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 13 deletions.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,38 @@ matrix:
sources:
- ubuntu-toolchain-r-test

- env: TARGET_X=x86_64-fortanix-unknown-sgx FEATURES_X= MODE_X=DEBUG KCOV=0
rust: nightly
os: linux
dist: trusty

- env: TARGET_X=x86_64-fortanix-unknown-sgx FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: nightly
os: linux
dist: trusty

- env: TARGET_X=x86_64-fortanix-unknown-sgx CC_X=gcc-7 FEATURES_X= MODE_X=DEBUG KCOV=0
rust: nightly
os: linux
dist: trusty
addons:
apt:
packages:
- gcc-7
sources:
- ubuntu-toolchain-r-test

- env: TARGET_X=x86_64-fortanix-unknown-sgx CC_X=gcc-7 FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: nightly
os: linux
dist: trusty
addons:
apt:
packages:
- gcc-7
sources:
- ubuntu-toolchain-r-test

- env: TARGET_X=x86_64-apple-darwin FEATURES_X= MODE_X=DEBUG KCOV=0
rust: beta
os: osx
Expand Down
6 changes: 5 additions & 1 deletion mk/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if [[ "$TARGET_X" =~ ^(arm|aarch64) && ! "$TARGET_X" =~ android ]]; then
sudo apt-get install --no-install-recommends binfmt-support qemu-user-binfmt -y
fi

if [[ ! "$TARGET_X" =~ "x86_64-" ]]; then
if [[ "$TARGET_X" != "$(rustc --version --verbose|sed -n 's/^host: //p')" ]]; then
rustup target add "$TARGET_X"

# By default cargo/rustc seems to use cc for linking, We installed the
Expand Down Expand Up @@ -122,6 +122,10 @@ armv7-linux-androideabi)

adb emu kill

;;
x86_64-fortanix-unknown-sgx)
# Can't run SGX in Travis. Only build, but don't run, the tests
RUSTFLAGS="-C target-feature=+aes,+pclmul" cargo test -vv -j2 --no-run ${mode-} ${FEATURES_X-} --target=$TARGET_X
;;
*)
cargo test -vv -j2 ${mode-} ${FEATURES_X-} --target=$TARGET_X
Expand Down
32 changes: 20 additions & 12 deletions mk/update-travis-yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"arm-unknown-linux-gnueabihf" : [ "arm-linux-gnueabihf-gcc" ],
"i686-unknown-linux-gnu" : linux_compilers,
"x86_64-unknown-linux-gnu" : linux_compilers,
"x86_64-fortanix-unknown-sgx" : linux_compilers,
"x86_64-apple-darwin" : osx_compilers,
}

Expand Down Expand Up @@ -76,17 +77,20 @@
"aarch64-unknown-linux-gnu",
"i686-unknown-linux-gnu",
"arm-unknown-linux-gnueabihf",
"x86_64-fortanix-unknown-sgx",
],
}

def format_entries():
return "\n".join([format_entry(os, target, compiler, rust, mode, features)
for rust in rusts
for os in oss
for target in targets[os]
for compiler in compilers[target]
for mode in modes
for features in feature_sets])
return "\n".join([entry for entry in
(format_entry(os, target, compiler, rust, mode, features)
for rust in rusts
for os in oss
for target in targets[os]
for compiler in compilers[target]
for mode in modes
for features in feature_sets)
if entry is not None])

# We use alternative names (the "_X" suffix) so that, in mk/travis.sh, we can
# ensure that we set the specific variables we want and that no relevant
Expand All @@ -111,6 +115,12 @@ def format_entries():
%(sources)s"""

def format_entry(os, target, compiler, rust, mode, features):
if target == "x86_64-fortanix-unknown-sgx" and rust != "nightly":
return
# Tracked in https://github.com/fortanix/rust-sgx/issues/64
if target == "x86_64-fortanix-unknown-sgx" and compiler == "clang":
return

target_words = target.split("-")
arch = target_words[0]
vendor = target_words[1]
Expand All @@ -127,13 +137,11 @@ def format_entry(os, target, compiler, rust, mode, features):
mode == "DEBUG")

if sys == "darwin":
abi = sys
sys = "macos"
elif sys == "androideabi":
abi = sys
sys = "linux"
else:
abi = target_words[3]
elif target == "x86_64-fortanix-unknown-sgx":
sys = "linux"

def prefix_all(prefix, xs):
return [prefix + x for x in xs]
Expand Down Expand Up @@ -263,7 +271,7 @@ def main():
file.seek(0)
file.write(new_contents)
file.truncate()
print new_contents
print new_contents,

if __name__ == '__main__':
main()

0 comments on commit 9b4697c

Please sign in to comment.