forked from rust-lang/rust
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
947d723
commit 6db0590
Showing
6 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "enclave" | ||
version = "0.1.0" | ||
authors = ["Raoul Strackx <raoul.strackx@fortanix.com>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CHECK: print | ||
CHECK: lfence | ||
CHECK: lfence | ||
CHECK: lfence | ||
CHECK: popq | ||
CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume> | ||
CHECK-NEXT: ud2 |
42 changes: 42 additions & 0 deletions
42
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
set -exuo pipefail | ||
|
||
function build { | ||
CRATE=enclave | ||
|
||
mkdir -p $WORK_DIR | ||
pushd $WORK_DIR | ||
rm -rf $CRATE | ||
cp -a $TEST_DIR/enclave . | ||
pushd $CRATE | ||
echo ${WORK_DIR} | ||
# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features. | ||
# These come from the top-level Rust workspace, that this crate is not a | ||
# member of, but Cargo tries to load the workspace `Cargo.toml` anyway. | ||
env RUSTC_BOOTSTRAP=1 \ | ||
cargo -v run --target $TARGET | ||
env RUSTC_BOOTSTRAP=1 \ | ||
cargo -v run --target $TARGET --release | ||
popd | ||
popd | ||
} | ||
|
||
function check { | ||
local func=$1 | ||
local checks="${TEST_DIR}/$2" | ||
local asm=$(mktemp) | ||
local objdump="${BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump" | ||
local filecheck="${BUILD_DIR}/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" | ||
|
||
${objdump} --disassemble-symbols=${func} --demangle ${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave > ${asm} | ||
${filecheck} --input-file ${asm} ${checks} | ||
} | ||
|
||
build | ||
|
||
#TODO: re-enable check when newly compiled libunwind is used | ||
#check unw_getcontext unw_getcontext.checks | ||
|
||
#TODO: re-enable check when newly compiled libunwind is used | ||
#check "libunwind::Registers_x86_64::jumpto()" jumpto.checks | ||
|
||
check "std::io::stdio::_print::h87f0c238421c45bc" print.checks |