Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update test script to check output #336

Merged
merged 68 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
20b450d
formatting the test, removing old code
ivoysey May 4, 2021
b0302bd
new test case with less going on
ivoysey May 5, 2021
431a62e
updating primops test case to use local vars not fields
ivoysey May 5, 2021
6d54975
scala style, whitespace, a new util function, comments, variable decl…
ivoysey May 5, 2021
565b1f5
updating bool literal test to refer to a local rather than a field
ivoysey May 5, 2021
1a389dc
no prizes for guessing where i copied this file from
ivoysey May 5, 2021
64982c6
assign instead of declare; removing type annotations from declaration…
ivoysey May 5, 2021
ee7dfa3
whitespace
ivoysey May 5, 2021
0b374b9
similar enough case for decls, so might as well
ivoysey May 5, 2021
367c033
updating ifthenelse test case to use locals not fields, fixing a bug …
ivoysey May 5, 2021
2dd334f
adding case for if, since it\'s so similar to ifthenelse
ivoysey May 5, 2021
fe1420e
intconst test to locals not fields
ivoysey May 5, 2021
265ae32
removing sstore for local variables
ivoysey May 5, 2021
9d6b22f
fixing scaladocs
ivoysey May 5, 2021
7f821b7
updating simplecall test to not use fields
ivoysey May 5, 2021
9ff43f3
adding a top level return to simple call so its testable
ivoysey May 5, 2021
c158be5
scala style
ivoysey May 5, 2021
e11e145
adding a slightly hacky script to run all the ganache tests locally i…
ivoysey May 6, 2021
b9396e5
merging from master after PR #322
ivoysey May 6, 2021
9bc0d90
scraps
ivoysey May 7, 2021
4403ee5
better shell scripting practices
ivoysey May 7, 2021
be048da
more shell tweaks
ivoysey May 7, 2021
ce30660
Adding some logic to make local testing of specific files easier
ivoysey May 7, 2021
44fef40
shell script hacking; this will likely break on travis beacuse of unr…
ivoysey May 7, 2021
779bb33
moving a comment around; it's valid scala to have it where it was, bu…
ivoysey May 10, 2021
58591cd
whitespace and comments in testing script
ivoysey May 10, 2021
04a2fe1
adding a call to eth_call and a check on the result
ivoysey May 10, 2021
479a864
updating travis build to include sha3 utility
ivoysey May 11, 2021
574466b
fixed a type in a bash variable name, updated the hash implemention i…
ivoysey May 11, 2021
19eda88
possibly better travis install commands
ivoysey May 11, 2021
dd5dfbc
apt command change
ivoysey May 11, 2021
cfbab56
adding rhash to the build, to see if that works better
ivoysey May 11, 2021
10312f8
more hashing attempts
ivoysey May 13, 2021
33ab8a7
code to pick between which hash implementation based on uname
ivoysey May 13, 2021
1de8429
cutting hash to first 8 bytes in travis, adding messages
ivoysey May 13, 2021
94c15ef
updating call to use the contract address
ivoysey May 13, 2021
bf31216
stripping quotes off the contract address, adding a dire warning abou…
ivoysey May 13, 2021
7b0420f
guarded hack for running something locally, but i still want to spin …
ivoysey May 13, 2021
7984173
Adding more gas; updating check on testexp and expected so it warns (…
ivoysey May 13, 2021
ffd809f
found a duplicated 0x with michael
ivoysey May 14, 2021
d6a4438
checking against expected
ivoysey May 14, 2021
be7102a
comments
ivoysey May 14, 2021
8daa727
Adding check on getTransactionRecipt status code
ivoysey May 14, 2021
83161d0
Adding check on getTransactionRecipt status code
ivoysey May 14, 2021
e906ea9
updating comments on testing script
ivoysey May 17, 2021
0c183af
removing redundant braces, some binaries from solidity code for local…
ivoysey May 20, 2021
1aef008
commenting out the failure count incrementer so i can check travis fo…
ivoysey May 20, 2021
c1e77fe
off by one error
ivoysey May 21, 2021
75bbdd3
removing binaries for local testing and commented line from travis sc…
ivoysey May 21, 2021
3479852
fixed a bug with not assigning back to the temp var in the function c…
ivoysey May 21, 2021
8f5a334
fixing Return test
ivoysey May 21, 2021
10888c0
updating Travis travis script to only make a call to eth_call if the …
ivoysey May 24, 2021
61ae904
adding test expected values to other simple tests
ivoysey May 24, 2021
0b64a64
test script output
ivoysey May 24, 2021
4ccf648
breaking primops test up into one test per operator
ivoysey May 24, 2021
65e08d9
copy paste typos
ivoysey May 24, 2021
c1f743b
typos, small fixes
ivoysey May 24, 2021
ae1ed38
splitting subtraction test into two cases
ivoysey May 24, 2021
57dfbc3
typos
ivoysey May 24, 2021
48515fa
adding a rough summary of what passed and failed to the output for re…
ivoysey May 25, 2021
b4cb8cf
quick summary
ivoysey May 25, 2021
dca9ef6
updating codegen to fix logical negation, which entailed fixing bugs …
ivoysey May 25, 2021
6f1652d
actually fixing the bug in if-then-else; adding a new test case that …
ivoysey May 25, 2021
d976b9f
removing the json file for a failing test per #337 and #335
ivoysey May 25, 2021
3dbc02b
removing JSON per #338
ivoysey May 25, 2021
cca8ef6
adding a simple script that tells me which tests are defined but with…
ivoysey May 25, 2021
ff9461f
adding a warning about skipped tests
ivoysey May 25, 2021
78de938
Adding comments to convenience shell scripts
ivoysey May 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Obsidian_Runtime/src/main/yul_templates/object.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ object "{{creationObject}}" {

{{! todo: is 4 a magic number or should it be generated based on the object in question? check the ABI }}
if iszero(lt(calldatasize(), 4)) {
{
{{#dispatch}}
{{! TODO 224 is a magic number offset to shift to follow the spec above; check that it's right }}
let selector := shr(224, calldataload(0))
Expand Down Expand Up @@ -95,5 +94,4 @@ object "{{creationObject}}" {
{{runtimeSubObjects}}
}
{{subObjects}}
}
}
14 changes: 14 additions & 0 deletions bin/run_obs_yul_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
ivoysey marked this conversation as resolved.
Show resolved Hide resolved


# this is a wrapper on the run_obs_yul script, which produces yul for the ganache tests programs
# without actually running them, that runs it on all of the test programs in a batch mode. it is
# kind of a hack but it works for now and saves a rewrite of the run_obs_yul script.

for f in $(run_obs_yul.sh | tail -n +2)
do
echo "---------------------------"
echo $f
echo "---------------------------"
run_obs_yul.sh "$f"
done
6 changes: 6 additions & 0 deletions bin/skipped_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
ivoysey marked this conversation as resolved.
Show resolved Hide resolved

# when run from the top level of the repo, this prints out the names of the obsidian files
# in the ganache tests that do not also have a json file paired with them -- that means that
# they won't be run by travis. this also appears in the output of the travis script at the very top.
comm -13 <(ls resources/tests/GanacheTests/*.json | xargs basename -s '.json') <(ls resources/tests/GanacheTests/*.obs | xargs basename -s '.obs')
4 changes: 3 additions & 1 deletion resources/tests/GanacheTests/AssignLocalAdd.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1
"numaccts" : 1,
"testexp" : "main()",
"expected" : "17"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/AssignLocalAdd.obs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ main contract AssignLocalAdd{
x = 5 + 12;
return;
}

transaction main() returns int {
int x = 5 + 12;
return x;
}
}
4 changes: 3 additions & 1 deletion resources/tests/GanacheTests/BoolLiteral.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1
"numaccts" : 1,
"testexp" : "main()",
"expected" : "0"
}
4 changes: 4 additions & 0 deletions resources/tests/GanacheTests/BoolLiteral.obs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ main contract BoolLiteral{
x = true;
x = false;
}

transaction main() returns bool {
return false;
}
}
4 changes: 3 additions & 1 deletion resources/tests/GanacheTests/If.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1
"numaccts" : 1,
"testexp" : "main()",
"expected" : "1"
}
12 changes: 10 additions & 2 deletions resources/tests/GanacheTests/If.obs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ main contract If {
transaction iftest() {
int x;
if (true) {
x = 1;
}
x = 1;
}
return;
}

transaction main() returns int {
int x = 0;
if (true) {
x = 1;
}
return x;
}
}
4 changes: 3 additions & 1 deletion resources/tests/GanacheTests/IfThenElse.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1
"numaccts" : 1,
"testexp" : "main()",
"expected" : "90"
}
10 changes: 10 additions & 0 deletions resources/tests/GanacheTests/IfThenElse.obs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ main contract IfThenElse {
}
return;
}

transaction main() returns int {
int x = 9;
if (false) {
x = 50;
} else {
x = 90;
}
return x;
}
}
4 changes: 3 additions & 1 deletion resources/tests/GanacheTests/IntConst.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1
"numaccts" : 1,
"testexp" : "main()",
"expected" : "12"
}
6 changes: 5 additions & 1 deletion resources/tests/GanacheTests/IntConst.obs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
main contract IntConst{
transaction intconst() {
int x;
x = 4;
x = 12;
return;
}

transaction main() returns int {
return 12;
}
}
28 changes: 0 additions & 28 deletions resources/tests/GanacheTests/PrimOps.obs

This file was deleted.

8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsAdd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsadd()",
"expected" : "13"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsAdd.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsAdd{
transaction primopsadd() returns int {
return(5+8);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsAnd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsand()",
"expected" : "0"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsAnd.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsAnd{
transaction primopsand() returns bool {
return(true && false);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsDiv.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsdiv()",
"expected" : "2"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsDiv.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsDiv{
transaction primopsdiv() returns int {
return(4/2);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsEq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopseq()",
"expected" : "0"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsEq.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsEq{
transaction primopseq() returns bool {
return(5 == 9);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsGreater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsgreater()",
"expected" : "0"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsGreater.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsGreater{
transaction primopsgreater() returns bool {
return(12 > 19);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsGreaterEq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsgreatereq()",
"expected" : "1"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsGreaterEq.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsGreaterEq{
transaction primopsgreatereq() returns bool {
return(12 >= 12);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsLess.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsless()",
"expected" : "1"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsLess.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsLess{
transaction primopsless() returns bool {
return(9 < 10);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsLessEq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopslesseq()",
"expected" : "1"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsLessEq.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsLessEq{
transaction primopslesseq() returns bool {
return(9 <= 19);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsMod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsmod()",
"expected" : "5"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsMod.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsMod{
transaction primopsmod() returns int {
return(13 % 8);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsMul.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsmul()",
"expected" : "20"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsMul.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsMul{
transaction primopsmul() returns int {
return(5*4);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNEq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsneq()",
"expected" : "1"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNEq.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsNEq{
transaction primopsneq() returns bool {
return(5 != 9);
}
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNeg.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsNeg{
transaction primopsneg() returns int {
return(-20);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNotFalse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsnotfalse()",
"expected" : "1"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNotFalse.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsNotFalse{
transaction primopsnotfalse() returns bool {
return(! false);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNotTrue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsnottrue()",
"expected" : "0"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsNotTrue.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsNotTrue{
transaction primopsnottrue() returns bool {
return(! true);
}
}
8 changes: 8 additions & 0 deletions resources/tests/GanacheTests/PrimOpsOr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"gas" : 30000000,
"gasprice" : "0x9184e72a000",
"startingeth" : 5000000,
"numaccts" : 1,
"testexp" : "primopsor()",
"expected" : "1"
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsOr.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsOr{
transaction primopsor() returns bool {
return(true || false);
}
}
5 changes: 5 additions & 0 deletions resources/tests/GanacheTests/PrimOpsSubNeg.obs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main contract PrimOpsSubNeg{
transaction primopssubneg() returns int {
return(5-20);
}
}
Loading