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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
scala style, whitespace, a new util function, comments, variable decl…
…aration first cut
ivoysey committed May 5, 2021
commit 6d54975700aeb1297a2d05d71f2df91de0828fab
7 changes: 3 additions & 4 deletions src/main/scala/edu/cmu/cs/obsidian/codegen/CodeGenYul.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package edu.cmu.cs.obsidian.codegen

import edu.cmu.cs.obsidian.CompilerOptions
import edu.cmu.cs.obsidian.codegen.LiteralKind.LiteralKind

import java.io.{File, FileWriter}
import java.nio.file.{Files, Path, Paths}
@@ -230,7 +229,7 @@ object CodeGenYul extends CodeGenerator {
assignTo match {
case ReferenceIdentifier(x) =>
val id = nextTemp()
val e_yul = translateExpr(id,e,contractName,checkedTable)
val e_yul = translateExpr(id, e, contractName, checkedTable)
decl_0exp(id) +:
e_yul :+
decl_1exp(Identifier(x), id)
@@ -241,6 +240,7 @@ object CodeGenYul extends CodeGenerator {
case IfThenElse(scrutinee, pos, neg) =>
val id = nextTemp()
val scrutinee_yul: Seq[YulStatement] = translateExpr(id, scrutinee, contractName, checkedTable)
// todo: why don't these recursive calls both get new temps? that's gotta be a bug
val pos_yul: Seq[YulStatement] = pos.flatMap(s => translateStatement(s, retVar, contractName, checkedTable))
val neg_yul: Seq[YulStatement] = neg.flatMap(s => translateStatement(s, retVar, contractName, checkedTable))
decl_0exp(id) +:
@@ -251,8 +251,7 @@ object CodeGenYul extends CodeGenerator {
Case(boollit(false), Block(neg_yul))))
case e: Expression => translateExpr(nextTemp(), e, contractName, checkedTable)
case VariableDecl(typ, varName) =>
assert(assertion = false, s"TODO: translateStatement unimplemented for ${s.toString}")
Seq()
Seq(decl_0exp_t(Identifier(varName), typ))
case VariableDeclWithInit(typ, varName, e) =>
assert(assertion = false, s"TODO: translateStatement unimplemented for ${s.toString}")
Seq()
9 changes: 9 additions & 0 deletions src/main/scala/edu/cmu/cs/obsidian/codegen/Util.scala
Original file line number Diff line number Diff line change
@@ -96,6 +96,15 @@ object Util {
*/
def decl_0exp(id: Identifier): VariableDeclaration = VariableDeclaration(Seq((id, None)), None)

/**
* shorthand for building the yul expression that declares one variable with a type and no
* initial value
*
* @param id the name of the variable to be declared
* @return the expression declaring the variable
*/
def decl_0exp_t(id: Identifier, t: ObsidianType): VariableDeclaration =
VariableDeclaration(Seq((id, Some(mapObsTypeToABI(t.baseTypeName)))), None)

/**
* shorthand for building the yul expression that declares a sequence (non-empty) of identifiers