Test targets and cleanup.

This commit is contained in:
Erik Stenman 2019-02-27 15:25:57 +01:00
parent ab150ce7f8
commit c624f4956c
4 changed files with 101 additions and 92 deletions

View File

@ -22,13 +22,13 @@ jobs:
command: make
- run:
name: Static Analysis
command: rebar3 dialyzer
command: make dialyzer
- run:
name: Eunit
command: rebar3 eunit
command: make eunit
- run:
name: Common Tests
command: rebar3 ct
command: make ct
- save_cache:
key: dialyzer-cache-v1-{{ .Branch }}-{{ .Revision }}
paths:

View File

@ -16,12 +16,21 @@ clean:
rm -f src/aeb_fate_code.erl
rm -f include/aeb_fate_opcodes.hrl
dialyzer: local
@$(REBAR) as local dialyzer
distclean: clean
@rm -rf _build/
euint: local
@$(REBAR) as local eunit
test: local
@$(REBAR) as local eunit
ebin/aeb_fate_generate_ops.beam: src/aeb_fate_generate_ops.erl ebin
erlc -o $(dir $@) $<

View File

@ -820,7 +820,7 @@ to_list_of_types(Tokens) ->
{[Type], Rest}
end.
-spec serialize_type(aeb_fate_date:fate_type_type()) -> [byte()].
-spec serialize_type(aeb_fate_data:fate_type_type()) -> [byte()].
serialize_type(integer) -> [0];
serialize_type(boolean) -> [1];
serialize_type({list, T}) -> [2 | serialize_type(T)];

View File

@ -19,7 +19,7 @@ generate(Src, Include) ->
generate_opcodes_ops(aeb_fate_opcodes, HrlFile, Src, Ops),
generate_code_ops(aeb_fate_code, Src, Ops).
%% TODO: Some real gas numbers...
ops_defs() ->
%% Opname, Opcode, args, end_bb, gas, format, Constructor, Documentation
[ { 'NOP', 16#f0, 0, false, 1, atomic, nop, "The no op. does nothing."}
@ -69,7 +69,6 @@ ops_defs() ->
, {'HD', 16#2b, 2, false, 3, [a,a], hd, "Arg0 := head of list Arg1."}
, {'TL', 16#2c, 2, false, 3, [a,a], tl, "Arg0 := tail of list Arg1."}
, {'LENGTH', 16#2d, 2, false, 3, [a,a], length, "Arg0 := length of list Arg1."}
, {'STR_EQ', 16#2e, 3, false, 3, [a,a,a], str_eq, "Arg0 := true iff the strings Arg1 and Arg2 are the same."}
, {'STR_JOIN', 16#2f, 3, false, 3, [a,a,a], str_join, "Arg0 := string Arg1 followed by string Arg2."}
, {'INT_TO_STR', 16#55, 2, false, 3, [a,a], int_to_str, "Arg0 := turn integer Arg1 into a string."}
@ -78,7 +77,7 @@ ops_defs() ->
, {'INT_TO_ADDR', 16#32, 2, false, 3, [a,a], int_to_addr, "Arg0 := turn integer Arg1 into an address."}
, {'VARIANT', 16#33, 4, false, 3, [a,a,a,a], variant, "Arg0 := create a variant of size Arg1 with the tag Arg2 (Arg2 < Arg1) and take Arg3 elements from the stack."}
, {'VARIANT_TEST', 16#34, 3, false, 3, [a,a,a], variant_test, "Arg0 := true if variant Arg1 has the tag Arg2."}
, {'VARIANT_ELEMNT',16#35,3,false, 3, [a, a, a], variant_element,"Arg0 := element number Arg2 from variant Arg1."}
, {'VARIANT_ELEMENT',16#35, 3, false, 3, [a,a,a], variant_element, "Arg0 := element number Arg2 from variant Arg1."}
, {'BITS_NONEA', 16#6e, 0, false, 3, atomic, bits_none, "accumulator := empty bitmap."}
, {'BITS_NONE', 16#36, 1, false, 3, [a], bits_none, "Arg0 := empty bitmap."}
, {'BITS_ALLA', 16#6f, 0, false, 3, atomic, bits_all, "accumulator := full bitmap."}
@ -86,7 +85,8 @@ ops_defs() ->
, {'BITS_ALL_N', 16#6d, 2, false, 3, [a,a], bits_all_n, "Arg0 := bitmap with Arg1 bits set."}
, {'BITS_SET', 16#38, 3, false, 3, [a,a,a], bits_set, "Arg0 := set bit Arg2 of bitmap Arg1."}
, {'BITS_CLEAR', 16#39, 3, false, 3, [a,a,a], bits_clear, "Arg0 := clear bit Arg2 of bitmap Arg1."}
, {'BITS_TEST', 16#3a, 3, false, 3, [a, a, a], bits_test, "Arg0 := true if bit Arg2 of bitmap Arg1 is set."} , {'BITS_SUM', 16#3b, 2, false, 3, [a, a], bits_sum, "Arg0 := sum of set bits in bitmap Arg1. Exception if infinit bitmap."}
, {'BITS_TEST', 16#3a, 3, false, 3, [a,a,a], bits_test, "Arg0 := true if bit Arg2 of bitmap Arg1 is set."}
, {'BITS_SUM', 16#3b, 2, false, 3, [a,a], bits_sum, "Arg0 := sum of set bits in bitmap Arg1. Exception if infinit bitmap."}
, {'BITS_OR', 16#3c, 3, false, 3, [a,a,a], bits_or, "Arg0 := Arg1 v Arg2."}
, {'BITS_AND', 16#3d, 3, false, 3, [a,a,a], bits_and, "Arg0 := Arg1 ^ Arg2."}
, {'BITS_DIFF', 16#3e, 3, false, 3, [a,a,a], bits_diff, "Arg0 := Arg1 - Arg2."}
@ -94,21 +94,21 @@ ops_defs() ->
, {'DUP', 16#0a, 1, false, 3, [a], dup, "push Arg0 stack pos on top of stack."}
, {'POP', 16#0b, 1, false, 3, [a], pop, "Arg0 := top of stack."}
, {'STORE', 16#10, 2, false, 3, [a,a], store, "Arg0 := Arg1."}
%% TODO: Check the documentation and update it.
, {'ADDRESS', 16#3f, 1, false, 3, [a], address, "Arg0 := The current contract address."}
, {'BALANCE', 16#3f, 1, false, 3, [a], balance, "Arg0 := The current contract address."}
, {'ORIGIN', 16#40, 1, false, 3, [a], origin, "Arg0 := Address of contract called by the call transaction."}
, {'CALLER', 16#41, 1, false, 3, [a], caller, "Arg0 := The address that signed the call transaction."}
, {'GASPRICE', 16#42, 1, false, 3, [a], gasprice, "Arg0 := The current gas price."}
, {'BLOCKHASH', 16#43, 1, false, 3, [a], blockhash, "Arg0 := The current blockhash."} %% TODO: Do we support has at height?
, {'BENEFICIARY',16#44, 1, false, 3, [a], beneficiary, "Arg0 := The address of the current beneficiary."}
, {'TIMESTAMP', 16#45, 1, false, 3, [a], timestamp, "Arg0 := The current timestamp. Unrelaiable, don't use for anything."}
, {'NUMBER', 16#46, 1, false, 3, [a], number, "Arg0 := The block height."}
, {'DIFFICULTY',16#47, 1, false, 3, [a], difficulty, "Arg0 := The current difficulty."}
, {'GASLIMIT', 16#48, 1, false, 3, [a], gaslimit, "Arg0 := The current gaslimit."}
, {'GAS', 16#49, 1, false, 3, [a], gas, "Arg0 := The amount of gas left."}
, {'ABORT', 16#4f, 1, false, 3, [a], abort, "Abort execution (dont use all gas) with error message in Arg0."}
, {'EXIT', 16#4e, 1, false, 3, [a], exit, "Abort execution (use upp all gas) with error message in Arg0."}
, {'BALANCE', 16#40, 1, false, 3, [a], balance, "Arg0 := The current contract address."}
, {'ORIGIN', 16#41, 1, false, 3, [a], origin, "Arg0 := Address of contract called by the call transaction."}
, {'CALLER', 16#42, 1, false, 3, [a], caller, "Arg0 := The address that signed the call transaction."}
, {'GASPRICE', 16#43, 1, false, 3, [a], gasprice, "Arg0 := The current gas price."}
, {'BLOCKHASH', 16#44, 1, false, 3, [a], blockhash, "Arg0 := The current blockhash."} %% TODO: Do we support has at height?
, {'BENEFICIARY', 16#45, 1, false, 3, [a], beneficiary, "Arg0 := The address of the current beneficiary."}
, {'TIMESTAMP', 16#46, 1, false, 3, [a], timestamp, "Arg0 := The current timestamp. Unrelaiable, don't use for anything."}
, {'NUMBER', 16#47, 1, false, 3, [a], number, "Arg0 := The block height."}
, {'DIFFICULTY', 16#48, 1, false, 3, [a], difficulty, "Arg0 := The current difficulty."}
, {'GASLIMIT', 16#49, 1, false, 3, [a], gaslimit, "Arg0 := The current gaslimit."}
, {'GAS', 16#4a, 1, false, 3, [a], gas, "Arg0 := The amount of gas left."}
, {'ABORT', 16#50, 1, false, 3, [a], abort, "Abort execution (dont use all gas) with error message in Arg0."}
, {'EXIT', 16#51, 1, false, 3, [a], exit, "Abort execution (use upp all gas) with error message in Arg0."}
].