LVI test std lib
This commit is contained in:
parent
947d7238e0
commit
6db05904f6
@ -2,16 +2,22 @@
|
||||
|
||||
#only-x86_64-fortanix-unknown-sgx
|
||||
|
||||
OBJDUMP="${S}/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump"
|
||||
FILECHECK="${S}/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck"
|
||||
# For cargo setting
|
||||
export RUSTC := $(RUSTC_ORIGINAL)
|
||||
export LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
|
||||
# We need to be outside of 'src' dir in order to run cargo
|
||||
export WORK_DIR := $(TMPDIR)
|
||||
export TEST_DIR := $(shell pwd)
|
||||
|
||||
## clean up unused env variables which might cause harm.
|
||||
unexport RUSTC_LINKER
|
||||
unexport RUSTC_BOOTSTRAP
|
||||
unexport RUST_BUILD_STAGE
|
||||
unexport RUST_TEST_THREADS
|
||||
unexport RUST_TEST_TMPDIR
|
||||
unexport AR
|
||||
unexport CC
|
||||
unexport CXX
|
||||
|
||||
all:
|
||||
$(RUSTC) --target ${TARGET} enclave.rs
|
||||
|
||||
#TODO: re-enable check when newly compiled libunwind is used
|
||||
#${OBJDUMP} --disassemble-symbols=unw_getcontext --demangle $(TMPDIR)/enclave > $(TMPDIR)/unw_getcontext.asm
|
||||
#${FILECHECK} --input-file $(TMPDIR)/unw_getcontext.asm unw_getcontext.checks
|
||||
|
||||
#TODO: re-enable check when newly compiled libunwind is used
|
||||
${OBJDUMP} --disassemble-symbols="libunwind::Registers_x86_64::jumpto()" --demangle $(TMPDIR)/enclave > $(TMPDIR)/jumpto.asm
|
||||
${FILECHECK} --input-file $(TMPDIR)/jumpto.asm jumpto.checks
|
||||
bash script.sh
|
||||
|
@ -1,5 +0,0 @@
|
||||
|
||||
pub fn main() {
|
||||
println!("Hello, World!");
|
||||
}
|
||||
|
@ -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]
|
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
CHECK: print
|
||||
CHECK: lfence
|
||||
CHECK: lfence
|
||||
CHECK: lfence
|
||||
CHECK: popq
|
||||
CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume>
|
||||
CHECK-NEXT: ud2
|
42
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
Normal file
42
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user