File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 2
2
//to reflect the current status of oracle.h
3
3
mod c_oracle_header;
4
4
5
+ //do not link with C during unit tests (which are built in native architecture, unlike libpyth.o)
6
+ #[ cfg( target_arch = "bpf" ) ]
5
7
#[ link( name = "cpyth" ) ]
6
8
extern "C" {
7
9
fn c_entrypoint ( input : * mut u8 ) -> u64 ;
8
10
}
9
11
12
+ //make the C entrypoint a no-op when running cargo test
13
+ #[ cfg( not( target_arch = "bpf" ) ) ]
14
+ pub extern "C" fn c_entrypoint ( input : * mut u8 ) -> u64 {
15
+ 0 //SUCCESS value
16
+ }
17
+
18
+
10
19
#[ no_mangle]
11
20
pub extern "C" fn entrypoint ( input : * mut u8 ) -> u64 {
12
21
let c_ret_val = unsafe { c_entrypoint ( input) } ;
Original file line number Diff line number Diff line change @@ -43,7 +43,10 @@ cd "${RUST_DIR}"
43
43
cargo install bindgen
44
44
bindgen ./src/bindings.h -o ./src/c_oracle_header.rs
45
45
cargo clean
46
+ cargo test
47
+ cargo clean
46
48
cargo build-bpf
49
+
47
50
sha256sum ./target/** /* .so
48
51
rm ./target/** /* -keypair.json
49
52
rm -r $PYTH_DIR /target || true
@@ -52,3 +55,5 @@ mv ./target $PYTH_DIR/target
52
55
53
56
54
57
58
+
59
+
You can’t perform that action at this time.
0 commit comments