File tree Expand file tree Collapse file tree 6 files changed +78
-16
lines changed
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi Expand file tree Collapse file tree 6 files changed +78
-16
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# only-x86_64-fortanix-unknown-sgx
4
4
5
- OBJDUMP ="${S}/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump"
6
- FILECHECK ="${S}/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck"
5
+ # For cargo setting
6
+ export RUSTC := $(RUSTC_ORIGINAL )
7
+ export LD_LIBRARY_PATH := $(HOST_RPATH_DIR )
8
+ # We need to be outside of 'src' dir in order to run cargo
9
+ export WORK_DIR := $(TMPDIR )
10
+ export TEST_DIR := $(shell pwd)
7
11
8
- all :
9
- $(RUSTC ) --target ${TARGET} enclave.rs
10
-
11
- # TODO: re-enable check when newly compiled libunwind is used
12
- # ${OBJDUMP} --disassemble-symbols=unw_getcontext --demangle $(TMPDIR)/enclave > $(TMPDIR)/unw_getcontext.asm
13
- # ${FILECHECK} --input-file $(TMPDIR)/unw_getcontext.asm unw_getcontext.checks
12
+ # # clean up unused env variables which might cause harm.
13
+ unexport RUSTC_LINKER
14
+ unexport RUSTC_BOOTSTRAP
15
+ unexport RUST_BUILD_STAGE
16
+ unexport RUST_TEST_THREADS
17
+ unexport RUST_TEST_TMPDIR
18
+ unexport AR
19
+ unexport CC
20
+ unexport CXX
14
21
15
- # TODO: re-enable check when newly compiled libunwind is used
16
- ${OBJDUMP} --disassemble-symbols="libunwind::Registers_x86_64::jumpto()" --demangle $(TMPDIR)/enclave > $(TMPDIR)/jumpto.asm
17
- ${FILECHECK} --input-file $(TMPDIR)/jumpto.asm jumpto.checks
22
+ all :
23
+ bash script.sh
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " enclave"
3
+ version = " 0.1.0"
4
+ authors = [" Raoul Strackx <raoul.strackx@fortanix.com>" ]
5
+ edition = " 2018"
6
+
7
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+
9
+ [dependencies ]
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ println ! ( "Hello, world!" ) ;
3
+ }
Original file line number Diff line number Diff line change
1
+ CHECK: print
2
+ CHECK: lfence
3
+ CHECK: lfence
4
+ CHECK: lfence
5
+ CHECK: popq
6
+ CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume>
7
+ CHECK-NEXT: ud2
Original file line number Diff line number Diff line change
1
+ set -exuo pipefail
2
+
3
+ function build {
4
+ CRATE=enclave
5
+
6
+ mkdir -p $WORK_DIR
7
+ pushd $WORK_DIR
8
+ rm -rf $CRATE
9
+ cp -a $TEST_DIR /enclave .
10
+ pushd $CRATE
11
+ echo ${WORK_DIR}
12
+ # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
13
+ # These come from the top-level Rust workspace, that this crate is not a
14
+ # member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
15
+ env RUSTC_BOOTSTRAP=1 \
16
+ cargo -v run --target $TARGET
17
+ env RUSTC_BOOTSTRAP=1 \
18
+ cargo -v run --target $TARGET --release
19
+ popd
20
+ popd
21
+ }
22
+
23
+ function check {
24
+ local func=$1
25
+ local checks=" ${TEST_DIR} /$2 "
26
+ local asm=$( mktemp)
27
+ local objdump=" ${BUILD_DIR} /x86_64-unknown-linux-gnu/llvm/build/bin/llvm-objdump"
28
+ local filecheck=" ${BUILD_DIR} /x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck"
29
+
30
+ ${objdump} --disassemble-symbols=${func} --demangle ${WORK_DIR} /enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave > ${asm}
31
+ ${filecheck} --input-file ${asm} ${checks}
32
+ }
33
+
34
+ build
35
+
36
+ # TODO: re-enable check when newly compiled libunwind is used
37
+ # check unw_getcontext unw_getcontext.checks
38
+
39
+ # TODO: re-enable check when newly compiled libunwind is used
40
+ # check "libunwind::Registers_x86_64::jumpto()" jumpto.checks
41
+
42
+ check " std::io::stdio::_print::h87f0c238421c45bc" print.checks
You can’t perform that action at this time.
0 commit comments