Client: cleanup runtest_contracts.sh and remove attic tests

This commit is contained in:
Benjamin Canou 2018-11-12 11:03:19 +01:00
parent 87be7df584
commit 494a4be140
No known key found for this signature in database
GPG Key ID: 73607948459DC5F8
8 changed files with 46 additions and 55 deletions

View File

@ -21,7 +21,7 @@
(name runtest_contracts.sh)
(deps sandbox.json
test_lib.inc.sh
(glob_files contracts/*))
(glob_files contracts/attic/*))
(locks /tcp-port/18731
/tcp-port/19731)
(action
@ -77,26 +77,10 @@
%{bin:tezos-client}
%{bin:tezos-admin-client})))
(alias
(name runtest_contracts_attic.sh)
(deps sandbox.json
test_lib.inc.sh
(glob_files contracts/attic/*))
(locks /tcp-port/18731
/tcp-port/19731)
(action
(run bash %{dep:test_contracts_attic.sh}
%{bin:tezos-sandboxed-node.sh}
%{bin:tezos-node}
%{bin:tezos-init-sandboxed-client.sh}
%{bin:tezos-client}
%{bin:tezos-admin-client})))
(alias
(name runtest_multinode.sh)
(deps sandbox.json
test_lib.inc.sh
(glob_files contracts/*.tz))
test_lib.inc.sh)
(locks /tcp-port/18731 /tcp-port/18732 /tcp-port/18733 /tcp-port/18734
/tcp-port/18735 /tcp-port/18736 /tcp-port/18737 /tcp-port/18738
/tcp-port/19731 /tcp-port/19732 /tcp-port/19733 /tcp-port/19734

View File

@ -23,40 +23,61 @@ printf "\n\n"
# Assert all contracts typecheck
if [ ! $NO_TYPECHECK ] ; then
for contract in `ls $contract_dir/*.tz`; do
for contract in `ls $contract_attic_dir/*.tz`; do
printf "[Typechecking %s]\n" "$contract";
${client} typecheck script "$contract";
done
printf "All contracts are well typed\n\n"
fi
# FORMAT: assert_output contract_file storage input expected_result
# Typing gas bounds checks
tee /tmp/first_explosion.tz <<EOF
{ parameter unit;
storage unit;
code{ DROP; PUSH nat 0 ;
DUP ; PAIR ;
DUP ; PAIR ;
DUP ; PAIR ;
DUP ; PAIR ;
DUP ; PAIR ;
DUP ; PAIR ;
DUP ; PAIR ;
DUP ; PAIR } }'
EOF
assert_fails $client originate contract first_explosion for bootstrap1 \
transferring 0 from bootstrap1 \
running '{parameter unit;storage unit;code{DROP;PUSH nat 0;DUP;PAIR;DUP;PAIR;DUP;PAIR;DUP;PAIR;DUP;PAIR;DUP;PAIR;DUP;PAIR;DUP;PAIR;}}' -G 8000
running /tmp/first_explosion.tz -G 8000
# Serialization gas bounds checks
assert_success $client run script '{parameter (list int);storage (list (list (list int)));code{CAR;DIP{NIL (list int)};DUP;ITER{DROP;DUP;DIP{CONS}};DROP;DIP{NIL (list (list int))};DUP;ITER{DROP;DUP;DIP{CONS}};DROP;NIL operation;PAIR}}' \
tee /tmp/second_explosion.tz <<EOF
{ parameter (list int) ;
storage (list (list (list int))) ;
code { CAR ; DIP { NIL (list int) } ;
DUP ; ITER { DROP ; DUP ; DIP { CONS } } ;
DROP ; DIP { NIL (list (list int)) } ;
DUP ; ITER { DROP ; DUP ; DIP { CONS } } ;
DROP ; NIL operation ; PAIR } }
EOF
assert_success $client run script /tmp/second_explosion.tz \
on storage '{}' \
and input '{1;2;3;4;5;6;7;8;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1}'
assert_fails $client run script '{parameter (list int);storage (list (list (list int)));code{CAR;DIP{NIL (list int)};DUP;ITER{DROP;DUP;DIP{CONS}};DROP;DIP{NIL (list (list int))};DUP;ITER{DROP;DUP;DIP{CONS}};DROP;NIL operation;PAIR}}' \
assert_fails $client run script /tmp/second_explosion.tz \
on storage '{}' \
and input '{1;2;3;4;5;6;7;8;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1}'
# Test sets and map literals
assert_fails $client typecheck data '{ Elt 0 1 ; Elt 0 1 }' against type '(map nat nat)'
assert_fails $client typecheck data '{ Elt 0 1 ; Elt 10 1 ; Elt 5 1 }' against type '(map nat nat)'
assert_fails $client typecheck data '{ "A" ; "C" ; "B" }' against type '(set string)'
assert_fails $client typecheck data '{ "A" ; "B" ; "B" }' against type '(set string)'
# Test for issue #262
# Test for issue #262 (bad serialization of 3+ arity primitives)
tee /tmp/bug_262.tz <<EOF
{ parameter unit ; storage unit ; code { DROP ; LAMBDA unit unit {} ; UNIT ; EXEC ; NIL operation ; PAIR } }
{ parameter unit ;
storage unit ;
code { DROP ;
LAMBDA unit unit {} ; UNIT ; EXEC ;
NIL operation ; PAIR } }
EOF
init_with_transfer /tmp/bug_262.tz $key1 'Unit' 1 bootstrap1
assert_balance bug_262 "1 ꜩ"

View File

@ -30,31 +30,6 @@ if [ ! $NO_TYPECHECK ] ; then
printf "All contracts are well typed\n\n"
fi
# Map block on lists
assert_storage $contract_attic_dir/list_map_block.tz '{0}' '{}' '{}'
assert_storage $contract_attic_dir/list_map_block.tz '{0}' '{ 1 ; 1 ; 1 ; 1 }' '{ 1 ; 2 ; 3 ; 4 }'
assert_storage $contract_attic_dir/list_map_block.tz '{0}' '{ 1 ; 2 ; 3 ; 0 }' '{ 1 ; 3 ; 5 ; 3 }'
# Reverse a list
assert_storage $contract_attic_dir/reverse.tz '{""}' '{}' '{}'
assert_storage $contract_attic_dir/reverse.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# Reverse using LOOP_LEFT
assert_storage $contract_attic_dir/loop_left.tz '{""}' '{}' '{}'
assert_storage $contract_attic_dir/loop_left.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# TODO add tests for
# accounts.tz, add1_list.tz, add1.tz, after_strategy.tz, always.tz,
# append.tz, at_least.tz, auction.tz, bad_lockup.tz,
# big_map_union.tz, cadr_annotation.tz, concat.tz, conditionals.tz,
# cons_twice.tz, cps_fact.tz, create_add1_lists.tz,
# data_publisher.tz, dispatch.tz, empty.tz, fail_amount.tz,
# faucet.tz, forward.tz, id.tz, infinite_loop.tz,
# insertion_sort.tz, int_publisher.tz, king_of_tez.tz,
# list_of_transactions.tz, queue.tz, reduce_map.tz, reentrancy.tz,
# spawn_identities.tz
printf "\nEnd of test\n"
show_logs="no"

View File

@ -37,6 +37,18 @@ fi
assert_storage $contract_op_dir/ret_int.tz None Unit '(Some 300)'
# Map block on lists
assert_storage $contract_op_dir/list_map_block.tz '{0}' '{}' '{}'
assert_storage $contract_op_dir/list_map_block.tz '{0}' '{ 1 ; 1 ; 1 ; 1 }' '{ 1 ; 2 ; 3 ; 4 }'
assert_storage $contract_op_dir/list_map_block.tz '{0}' '{ 1 ; 2 ; 3 ; 0 }' '{ 1 ; 3 ; 5 ; 3 }'
# Reverse a list
assert_storage $contract_op_dir/reverse.tz '{""}' '{}' '{}'
assert_storage $contract_op_dir/reverse.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# Reverse using LOOP_LEFT
assert_storage $contract_op_dir/loop_left.tz '{""}' '{}' '{}'
assert_storage $contract_op_dir/loop_left.tz '{""}' '{ "c" ; "b" ; "a" }' '{ "a" ; "b" ; "c" }'
# Identity on strings
assert_storage $contract_op_dir/str_id.tz None '"Hello"' '(Some "Hello")'

View File

@ -16,7 +16,6 @@ local_client="${4:-$test_dir/../../../_build/default/src/bin_client/main_client.
local_admin_client="${5:-$test_dir/../../../_build/default/src/bin_client/main_admin.exe}"
local_compiler="${6:-$test_dir/../../../_build/default/src/lib_protocol_compiler/main_native.exe}"
contract_dir="contracts"
contract_op_dir="contracts/opcodes"
contract_macros_dir="contracts/macros"
contract_scenarios_dir="contracts/mini_scenarios"