Skip to content

Commit

Permalink
Move all examples in ./res to ./examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Jun 28, 2024
1 parent 2cd8829 commit 68f1196
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 296 deletions.
14 changes: 11 additions & 3 deletions ckb-debugger/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ all: ckb-c-stdlib \
exec_callee \
exec_caller \
fib \
file_operations \
out_of_memory \
print_log \
read_file \
spawn_callee_strcat \
spawn_caller_strcat \
timenow
Expand All @@ -29,20 +31,26 @@ exec_caller:
fib:
$(CC) -o $@ $@.c

file_operations:
$(CC) -Wno-builtin-requires-header -o $@ $@.c

out_of_memory:
$(CC) -o $@ $@.c

print_log:
$(CC) -o $@ $@.c

spawn_callee_strcat:
read_file:
$(CC) -o $@ $@.c

spawn_caller_strcat:
spawn_callee_strcat:
$(CC) -o $@ $@.c

timenow:
spawn_caller_strcat:
$(CC) -o $@ $@.c

test:
bash MakefileTest.sh

timenow:
$(CC) -o $@ $@.c
4 changes: 4 additions & 0 deletions ckb-debugger/examples/MakefileTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ckb-debugger --mode full --bin fib --enable-steplog
ckb-debugger --mode fast --bin fib --max-cycles 100 2>&1 | grep "ExceededMaximumCycles"
ckb-debugger --mode full --bin fib --max-cycles 100 2>&1 | grep "CyclesExceeded"

ckb-debugger --mode full --bin file_operations | grep "Run result: 0"

ckb-debugger --mode fast --tx-file mock_tx.json --cell-index 0 --cell-type input --script-group-type lock
ckb-debugger --mode full --tx-file mock_tx.json --cell-index 0 --cell-type input --script-group-type lock
ckb-debugger --mode full --tx-file mock_tx.json --cell-index 0 --cell-type input --script-group-type lock --bin always_failure 2>&1 | grep "Run result: 1"
Expand All @@ -25,6 +27,8 @@ ckb-debugger --mode full --bin out_of_memory 2>&1 | grep "MemOutOfBound"
ckb-debugger --mode fast --bin print_log
ckb-debugger --mode full --bin print_log

ckb-debugger --bin read_file --read-file read_file.c | grep "Run result: 0"

ckb-debugger --mode fast --tx-file spawn.json --cell-index 0 --cell-type input --script-group-type lock
ckb-debugger --mode full --tx-file spawn.json --cell-index 0 --cell-type input --script-group-type lock
ckb-debugger --mode full --tx-file spawn.json --cell-index 0 --cell-type input --script-group-type lock --pid 0 --pprof /tmp/spawn.pprof
Expand Down
Binary file added ckb-debugger/examples/file_operations
Binary file not shown.
File renamed without changes.
Binary file added ckb-debugger/examples/read_file
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ int main() {
printf("%s", buf);

int duration = now() - start;
printf("duration = %lld milli-second", duration / 1000 / 1000);
printf("generate a random number: %llu", random());
printf("duration = %d milli-second", duration / 1000 / 1000);
printf("generate a random number: %lu", random());

return 0;
}
68 changes: 0 additions & 68 deletions ckb-debugger/res/Makefile

This file was deleted.

24 changes: 0 additions & 24 deletions ckb-debugger/res/fib.c

This file was deleted.

21 changes: 0 additions & 21 deletions ckb-debugger/res/outofmemory.c

This file was deleted.

Loading

0 comments on commit 68f1196

Please sign in to comment.