Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
9b60d0bb
Commit
9b60d0bb
authored
Oct 12, 2021
by
Aniket-Engg
Committed by
Aniket
Oct 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
artifacts saved on deployment from SUT
parent
06c58058
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
25 additions
and
14 deletions
+25
-14
debugger-api.ts
apps/debugger/src/app/debugger-api.ts
+4
-1
solidityUnittests.spec.ts
apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
+2
-2
test-tab.js
apps/remix-ide/src/app/tabs/test-tab.js
+6
-1
compiler-artefacts.ts
libs/remix-core-plugin/src/lib/compiler-artefacts.ts
+1
-1
compiler.ts
libs/remix-tests/src/compiler.ts
+2
-1
deployer.ts
libs/remix-tests/src/deployer.ts
+3
-2
runTestFiles.ts
libs/remix-tests/src/runTestFiles.ts
+2
-2
runTestSources.ts
libs/remix-tests/src/runTestSources.ts
+4
-4
types.ts
libs/remix-tests/src/types.ts
+1
-0
No files found.
apps/debugger/src/app/debugger-api.ts
View file @
9b60d0bb
...
...
@@ -123,7 +123,10 @@ export const DebuggerApiMixin = (Base) => class extends Base {
debug
(
hash
,
web3
?)
{
this
.
debugHash
=
hash
if
(
web3
)
remixDebug
.
init
.
extendWeb3
(
web3
)
if
(
web3
)
{
this
.
_web3
=
web3
remixDebug
.
init
.
extendWeb3
(
web3
)
}
if
(
this
.
onDebugRequestedListener
)
this
.
onDebugRequestedListener
(
hash
,
web3
)
}
...
...
apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
View file @
9b60d0bb
...
...
@@ -487,7 +487,7 @@ const sources = [
},
'tests/deployError_test.sol'
:
{
content
:
`
pragma solidity ^0.
7
.0;
pragma solidity ^0.
8
.0;
contract failingDeploy {
constructor() {
...
...
@@ -498,7 +498,7 @@ const sources = [
},
'tests/methodFailure_test.sol'
:
{
content
:
`
pragma solidity ^0.
7
.0;
pragma solidity ^0.
8
.0;
contract methodfailure {
function add(uint a, uint b) public {
...
...
apps/remix-ide/src/app/tabs/test-tab.js
View file @
9b60d0bb
...
...
@@ -527,17 +527,22 @@ module.exports = class TestTab extends ViewPlugin {
usingWorker
:
canUseWorker
(
currentVersion
),
runs
}
const
deployCb
=
async
(
file
,
contractAddress
)
=>
{
const
compilerData
=
await
this
.
call
(
'compilerArtefacts'
,
'getCompilerAbstract'
,
file
)
await
this
.
call
(
'compilerArtefacts'
,
'addResolvedContract'
,
contractAddress
,
compilerData
)
}
this
.
testRunner
.
runTestSources
(
runningTests
,
compilerConfig
,
(
result
)
=>
this
.
testCallback
(
result
,
runningTests
),
(
_err
,
result
,
cb
)
=>
this
.
resultsCallback
(
_err
,
result
,
cb
),
deployCb
,
(
error
,
result
)
=>
{
this
.
updateFinalResult
(
error
,
result
,
testFilePath
)
callback
(
error
)
},
(
url
,
cb
)
=>
{
return
this
.
contentImport
.
resolveAndSave
(
url
).
then
((
result
)
=>
cb
(
null
,
result
)).
catch
((
error
)
=>
cb
(
error
.
message
))
}
}
,
{
testFilePath
}
)
}).
catch
((
error
)
=>
{
if
(
error
)
return
// eslint-disable-line
...
...
libs/remix-core-plugin/src/lib/compiler-artefacts.ts
View file @
9b60d0bb
...
...
@@ -4,7 +4,7 @@ import { CompilerAbstract } from '@remix-project/remix-solidity'
const
profile
=
{
name
:
'compilerArtefacts'
,
methods
:
[
'get'
,
'addResolvedContract'
],
methods
:
[
'get'
,
'addResolvedContract'
,
'getCompilerAbstract'
],
events
:
[],
version
:
'0.0.1'
}
...
...
libs/remix-tests/src/compiler.ts
View file @
9b60d0bb
...
...
@@ -171,8 +171,9 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
* @param cb Callback
*/
export
function
compileContractSources
(
sources
:
SrcIfc
,
compilerConfig
:
CompilerConfiguration
,
importFileCb
:
any
,
opts
:
any
,
cb
):
void
{
let
compiler
,
filepath
:
string
let
compiler
const
accounts
:
string
[]
=
opts
.
accounts
||
[]
const
filepath
=
opts
.
testFilePath
||
''
// Iterate over sources keys. Inject test libraries. Inject test library import statements.
if
(
!
(
'remix_tests.sol'
in
sources
)
&&
!
(
'tests.sol'
in
sources
))
{
sources
[
'tests.sol'
]
=
{
content
:
require
(
'../sol/tests.sol.js'
)
}
...
...
libs/remix-tests/src/deployer.ts
View file @
9b60d0bb
...
...
@@ -11,7 +11,7 @@ import { compilationInterface } from './types'
* @param callback Callback
*/
export
function
deployAll
(
compileResult
:
compilationInterface
,
web3
:
Web3
,
withDoubleGas
:
boolean
,
callback
)
{
export
function
deployAll
(
compileResult
:
compilationInterface
,
web3
:
Web3
,
withDoubleGas
:
boolean
,
deployCb
,
callback
)
{
const
compiledObject
=
{}
const
contracts
=
{}
let
accounts
:
string
[]
=
[]
...
...
@@ -70,7 +70,7 @@ export function deployAll (compileResult: compilationInterface, web3: Web3, with
deployObject
.
send
({
from
:
accounts
[
0
],
gas
:
gas
}).
on
(
'receipt'
,
function
(
receipt
)
{
}).
on
(
'receipt'
,
async
function
(
receipt
)
{
contractObject
.
options
.
address
=
receipt
.
contractAddress
contractObject
.
options
.
from
=
accounts
[
0
]
contractObject
.
options
.
gas
=
5000
*
1000
...
...
@@ -79,6 +79,7 @@ export function deployAll (compileResult: compilationInterface, web3: Web3, with
contracts
[
contractName
]
=
contractObject
contracts
[
contractName
].
filename
=
filename
if
(
deployCb
)
await
deployCb
(
filename
,
receipt
.
contractAddress
)
callback
(
null
,
{
receipt
:
{
contractAddress
:
receipt
.
contractAddress
}
})
// TODO this will only work with JavaScriptV VM
}).
on
(
'error'
,
function
(
err
)
{
console
.
error
(
err
)
...
...
libs/remix-tests/src/runTestFiles.ts
View file @
9b60d0bb
...
...
@@ -61,13 +61,13 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3
for
(
const
filename
in
asts
)
{
if
(
filename
.
endsWith
(
'_test.sol'
))
{
sourceASTs
[
filename
]
=
asts
[
filename
].
ast
}
}
deployAll
(
compilationResult
,
web3
,
false
,
(
err
,
contracts
)
=>
{
deployAll
(
compilationResult
,
web3
,
false
,
null
,
(
err
,
contracts
)
=>
{
if
(
err
)
{
// If contract deployment fails because of 'Out of Gas' error, try again with double gas
// This is temporary, should be removed when remix-tests will have a dedicated UI to
// accept deployment params from UI
if
(
err
.
message
.
includes
(
'The contract code couldn
\'
t be stored, please check your gas limit'
))
{
deployAll
(
compilationResult
,
web3
,
true
,
(
error
,
contracts
)
=>
{
deployAll
(
compilationResult
,
web3
,
true
,
null
,
(
error
,
contracts
)
=>
{
if
(
error
)
next
([{
message
:
'contract deployment failed after trying twice: '
+
error
.
message
,
severity
:
'error'
}])
// IDE expects errors in array
else
next
(
null
,
compilationResult
,
contracts
)
})
...
...
libs/remix-tests/src/runTestSources.ts
View file @
9b60d0bb
...
...
@@ -39,7 +39,7 @@ export class UnitTestRunner {
* @param importFileCb Import file callback
* @param opts Options
*/
async
runTestSources
(
contractSources
:
SrcIfc
,
compilerConfig
:
CompilerConfiguration
,
testCallback
,
resultCallback
,
finalCallback
:
any
,
importFileCb
,
opts
:
Options
)
{
async
runTestSources
(
contractSources
:
SrcIfc
,
compilerConfig
:
CompilerConfiguration
,
testCallback
,
resultCallback
,
deployCb
:
any
,
finalCallback
:
any
,
importFileCb
,
opts
:
Options
)
{
opts
=
opts
||
{}
const
sourceASTs
:
any
=
{}
const
web3
=
opts
.
web3
||
await
this
.
createWeb3Provider
()
...
...
@@ -53,19 +53,19 @@ export class UnitTestRunner {
})
},
(
next
)
=>
{
compileContractSources
(
contractSources
,
compilerConfig
,
importFileCb
,
{
accounts
,
event
:
this
.
event
},
next
)
compileContractSources
(
contractSources
,
compilerConfig
,
importFileCb
,
{
accounts
,
testFilePath
:
opts
.
testFilePath
,
event
:
this
.
event
},
next
)
},
function
deployAllContracts
(
compilationResult
:
compilationInterface
,
asts
:
ASTInterface
,
next
)
{
for
(
const
filename
in
asts
)
{
if
(
filename
.
endsWith
(
'_test.sol'
))
{
sourceASTs
[
filename
]
=
asts
[
filename
].
ast
}
}
deployAll
(
compilationResult
,
web3
,
false
,
(
err
,
contracts
)
=>
{
deployAll
(
compilationResult
,
web3
,
false
,
deployCb
,
(
err
,
contracts
)
=>
{
if
(
err
)
{
// If contract deployment fails because of 'Out of Gas' error, try again with double gas
// This is temporary, should be removed when remix-tests will have a dedicated UI to
// accept deployment params from UI
if
(
err
.
message
.
includes
(
'The contract code couldn
\'
t be stored, please check your gas limit'
))
{
deployAll
(
compilationResult
,
web3
,
true
,
(
error
,
contracts
)
=>
{
deployAll
(
compilationResult
,
web3
,
true
,
deployCb
,
(
error
,
contracts
)
=>
{
if
(
error
)
next
([{
message
:
'contract deployment failed after trying twice: '
+
error
.
message
,
severity
:
'error'
}])
// IDE expects errors in array
else
next
(
null
,
compilationResult
,
contracts
)
})
...
...
libs/remix-tests/src/types.ts
View file @
9b60d0bb
...
...
@@ -49,6 +49,7 @@ export interface ResultCbInterface {
export
interface
Options
{
accounts
?:
string
[]
|
null
,
testFilePath
?:
string
web3
?:
any
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment