Skip to content

Commit

Permalink
Remove all old spawn test cases (#3)
Browse files Browse the repository at this point in the history
Update ckb-c-stdlib with new spawn syscalls.
Update db feature
  • Loading branch information
XuJiandong authored Mar 5, 2024
1 parent 6a1f8a4 commit 3584a7c
Show file tree
Hide file tree
Showing 81 changed files with 11 additions and 746 deletions.
4 changes: 2 additions & 2 deletions script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ tokio = { version = "1.35.0", features = ["rt-multi-thread"] }

[dev-dependencies]
proptest = "1.0"
ckb-db = { path = "../db", version = "= 0.114.0-pre" }
ckb-store = { path = "../store", version = "= 0.114.0-pre" }
ckb-db = { path = "../db", version = "= 0.114.0-pre", features = ["portable"] }
ckb-store = { path = "../store", version = "= 0.114.0-pre", features = ["portable"] }
ckb-test-chain-utils = { path = "../util/test-chain-utils", version = "= 0.114.0-pre" }
tiny-keccak = { version = "2.0", features = ["sha3"] }
ckb-crypto = { path = "../util/crypto", version = "= 0.114.0-pre" }
Expand Down
68 changes: 8 additions & 60 deletions script/testdata/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ LIB_TARGET := riscv64-unknown-linux-gnu
LIB_CC := $(LIB_TARGET)-gcc
LIB_OBJCOPY := $(LIB_TARGET)-objcopy

# Tip: add `-DDEBUG` to enable the debug outputs
COMMON_CFLAGS := -O3 \
-I deps/ckb-c-stdlib \
-I deps/ckb-c-stdlib/molecule \
-Wall -Werror -g
-Wall -Werror
# enable log
COMMON_CFLAGS += -DCKB_C_STDLIB_PRINTF -DCKB_C_STDLIB_PRINTF_BUFFER_SIZE=1024
# enable debug
# COMMON_CFLAGS += -g

BIN_CFLAGS := $(COMMON_CFLAGS)
LIB_CFLAGS := -shared -fPIC -nostdlib -nostartfiles -fvisibility=hidden $(COMMON_CFLAGS)

COMMON_LDFLAGS := -Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections
BIN_LDFLAGS := $(COMMON_LDFLAGS)
LIB_LDFLAGS := $(COMMON_LDFLAGS)

OBJCOPY_FLAGS := --strip-debug --strip-all

# nervos/ckb-riscv-gnu-toolchain:bionic-20210804
BIN_BUILDER_DOCKER := nervos/ckb-riscv-gnu-toolchain@sha256:cfeb97864cf2039a0900bfa83c3f112a780b2281bded395604b8a8a693c95e08
# nervos/ckb-riscv-gnu-toolchain:gnu-bionic-20210727
Expand Down Expand Up @@ -50,32 +52,8 @@ ALL_BINS := jalr_zero \
load_is_even_into_global \
load_is_even_with_snapshot \
load_arithmetic \
debugger \
get_memory_limit \
set_content \
spawn_big_content_length \
spawn_big_memory_size \
spawn_callee_exec_callee \
spawn_callee_exec_caller \
spawn_callee_get_memory_limit \
spawn_callee_out_of_cycles \
spawn_callee_set_content \
spawn_callee_strcat \
spawn_caller_exec \
spawn_caller_get_memory_limit \
spawn_caller_out_of_cycles \
spawn_caller_out_of_cycles_wrap \
spawn_caller_set_content \
spawn_caller_strcat_wrap \
spawn_caller_strcat \
spawn_caller_strcat_data_hash \
spawn_recursive \
spawn_current_memory \
spawn_caller_current_cycles \
spawn_callee_current_cycles \
spawn_peak_memory_512k_to_32m \
spawn_peak_memory_2m_to_32m \
spawn_peak_memory_4m_to_32m
debugger

ALL_LIBS := is_even.lib \
add1.lib sub1.lib mul2.lib div2.lib

Expand All @@ -99,24 +77,20 @@ clean: clean-bins clean-libs

%: %.c
$(BIN_CC) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ $<
$(BIN_OBJCOPY) $(OBJCOPY_FLAGS) $@

%.lib: %.c
$(LIB_CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -o $@ $<
$(LIB_OBJCOPY) $(OBJCOPY_FLAGS) $@

%: %.S
$(BIN_AS) -o $@.o $<
$(BIN_LD) -o $@ $@.o
@rm $@.o
$(BIN_OBJCOPY) $(OBJCOPY_FLAGS) $@

jalr_zero: jalr_zero.S
cadd_hint_lock: cadd_hint_lock.S
$(BIN_AS) -march=rv64imc -o $@.o $<
$(BIN_LD) -o $@ $@.o
@rm $@.o
$(BIN_OBJCOPY) $(OBJCOPY_FLAGS) $@
cpop_lock: cpop_lock.c
mop_adc_lock: mop_adc_lock.S
current_cycles: current_cycles.c
Expand All @@ -140,29 +114,3 @@ sub1.lib: sub1.c
mul2.lib: mul2.c
div2.lib: div2.c
load_arithmetic: load_arithmetic.c

get_memory_limit: get_memory_limit.c
set_content: set_content.c
spawn_big_content_length: spawn_big_content_length.c
spawn_big_memory_size: spawn_big_memory_size.c
spawn_callee_current_cycles: spawn_callee_current_cycles.c
spawn_callee_exec_callee: spawn_callee_exec_callee.c
spawn_callee_exec_caller: spawn_callee_exec_caller.c
spawn_callee_get_memory_limit: spawn_callee_get_memory_limit.c
spawn_callee_out_of_cycles: spawn_callee_out_of_cycles.c
spawn_callee_set_content: spawn_callee_out_of_cycles.c
spawn_callee_strcat: spawn_callee_strcat.c
spawn_caller_current_cycles: spawn_caller_current_cycles.c
spawn_caller_exec: spawn_caller_exec.c
spawn_caller_get_memory_limit: spawn_caller_get_memory_limit.c
spawn_caller_out_of_cycles: spawn_caller_out_of_cycles.c
spawn_caller_out_of_cycles_wrap: spawn_caller_out_of_cycles_wrap.c
spawn_caller_set_content: spawn_caller_set_content.c
spawn_caller_strcat_wrap: spawn_caller_strcat_wrap.c
spawn_caller_strcat: spawn_caller_strcat.c
spawn_caller_strcat_data_hash: spawn_caller_strcat_data_hash.c
spawn_peak_memory_512k_to_32m: spawn_peak_memory_512k_to_32m.c
spawn_peak_memory_2m_to_32m: spawn_peak_memory_2m_to_32m.c
spawn_peak_memory_4m_to_32m: spawn_peak_memory_4m_to_32m.c
spawn_recursive: spawn_recursive.c
spawn_current_memory: spawn_current_memory.c
2 changes: 1 addition & 1 deletion script/testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Create a directory named `deps`.

- Clone https://github.com/nervosnetwork/ckb-c-stdlib into `deps`.
- Clone https://github.com/XuJiandong/ckb-c-stdlib.git with branch `syscall-spawn` into `deps`.

- Build all scripts with `docker`.

Expand Down
Binary file modified script/testdata/add1.lib
Binary file not shown.
Binary file modified script/testdata/cadd_hint_lock
Binary file not shown.
Binary file modified script/testdata/cpop_lock
Binary file not shown.
Binary file modified script/testdata/current_cycles
Binary file not shown.
Binary file modified script/testdata/current_cycles_with_snapshot
Binary file not shown.
Binary file modified script/testdata/debugger
Binary file not shown.
Binary file modified script/testdata/div2.lib
Binary file not shown.
Binary file modified script/testdata/exec_callee
Binary file not shown.
Binary file modified script/testdata/exec_caller_big_offset_length
Binary file not shown.
Binary file modified script/testdata/exec_caller_from_cell_data
Binary file not shown.
Binary file modified script/testdata/exec_caller_from_witness
Binary file not shown.
Binary file modified script/testdata/exec_configurable_callee
Binary file not shown.
Binary file modified script/testdata/exec_configurable_caller
Binary file not shown.
Binary file removed script/testdata/get_memory_limit
Binary file not shown.
8 changes: 0 additions & 8 deletions script/testdata/get_memory_limit.c

This file was deleted.

Binary file modified script/testdata/infinite_loop
Binary file not shown.
Binary file modified script/testdata/is_even.lib
Binary file not shown.
Binary file modified script/testdata/jalr_zero
Binary file not shown.
Binary file modified script/testdata/load_arithmetic
Binary file not shown.
Binary file modified script/testdata/load_code_to_stack_then_reuse
Binary file not shown.
Binary file modified script/testdata/load_is_even_into_global
Binary file not shown.
Binary file modified script/testdata/load_is_even_with_snapshot
Binary file not shown.
Binary file modified script/testdata/mop_adc_lock
Binary file not shown.
Binary file modified script/testdata/mul2.lib
Binary file not shown.
Binary file removed script/testdata/set_content
Binary file not shown.
12 changes: 0 additions & 12 deletions script/testdata/set_content.c

This file was deleted.

Binary file removed script/testdata/spawn_big_content_length
Binary file not shown.
19 changes: 0 additions & 19 deletions script/testdata/spawn_big_content_length.c

This file was deleted.

Binary file removed script/testdata/spawn_big_memory_size
Binary file not shown.
18 changes: 0 additions & 18 deletions script/testdata/spawn_big_memory_size.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_current_cycles
Binary file not shown.
15 changes: 0 additions & 15 deletions script/testdata/spawn_callee_current_cycles.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_exec_callee
Binary file not shown.
1 change: 0 additions & 1 deletion script/testdata/spawn_callee_exec_callee.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_exec_caller
Binary file not shown.
6 changes: 0 additions & 6 deletions script/testdata/spawn_callee_exec_caller.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_get_memory_limit
Binary file not shown.
3 changes: 0 additions & 3 deletions script/testdata/spawn_callee_get_memory_limit.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_out_of_cycles
Binary file not shown.
8 changes: 0 additions & 8 deletions script/testdata/spawn_callee_out_of_cycles.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_set_content
Binary file not shown.
18 changes: 0 additions & 18 deletions script/testdata/spawn_callee_set_content.c

This file was deleted.

Binary file removed script/testdata/spawn_callee_strcat
Binary file not shown.
17 changes: 0 additions & 17 deletions script/testdata/spawn_callee_strcat.c

This file was deleted.

Binary file removed script/testdata/spawn_caller_current_cycles
Binary file not shown.
41 changes: 0 additions & 41 deletions script/testdata/spawn_caller_current_cycles.c

This file was deleted.

Binary file removed script/testdata/spawn_caller_exec
Binary file not shown.
14 changes: 0 additions & 14 deletions script/testdata/spawn_caller_exec.c

This file was deleted.

Binary file removed script/testdata/spawn_caller_get_memory_limit
Binary file not shown.
46 changes: 0 additions & 46 deletions script/testdata/spawn_caller_get_memory_limit.c

This file was deleted.

Binary file removed script/testdata/spawn_caller_out_of_cycles
Binary file not shown.
18 changes: 0 additions & 18 deletions script/testdata/spawn_caller_out_of_cycles.c

This file was deleted.

Binary file removed script/testdata/spawn_caller_out_of_cycles_wrap
Binary file not shown.
Loading

0 comments on commit 3584a7c

Please sign in to comment.