mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
prepare_report.js: Print ERROR in case of an exception during compilation instead of failing
- Our v0.4.11 release raises an exception on some LLL snippets containing returnlll (extracted from its end-to-end tests). - The report comparison will fail anyway because emscripten prints an abort code to stdout in that case but at least we'll be able to continue if we're comparing multiple versions.
This commit is contained in:
parent
17fe96c4d0
commit
7bebcb7871
@ -52,27 +52,41 @@ for (const optimize of [false, true])
|
||||
if (!stripSMTPragmas)
|
||||
input['settings']['modelChecker'] = {engine: 'none'}
|
||||
|
||||
const result = JSON.parse(compiler.compile(JSON.stringify(input)))
|
||||
let serializedOutput
|
||||
let result
|
||||
const serializedInput = JSON.stringify(input)
|
||||
|
||||
let internalCompilerError = false
|
||||
if ('errors' in result)
|
||||
try
|
||||
{
|
||||
for (const error of result['errors'])
|
||||
// JSON interface still returns contract metadata in case of an internal compiler error while
|
||||
// CLI interface does not. To make reports comparable we must force this case to be detected as
|
||||
// an error in both cases.
|
||||
if (['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError'].includes(error['type']))
|
||||
{
|
||||
internalCompilerError = true
|
||||
break
|
||||
}
|
||||
serializedOutput = compiler.compile(serializedInput)
|
||||
}
|
||||
catch (exception)
|
||||
{
|
||||
internalCompilerError = true
|
||||
}
|
||||
|
||||
if (!internalCompilerError)
|
||||
{
|
||||
result = JSON.parse(serializedOutput)
|
||||
|
||||
if ('errors' in result)
|
||||
for (const error of result['errors'])
|
||||
// JSON interface still returns contract metadata in case of an internal compiler error while
|
||||
// CLI interface does not. To make reports comparable we must force this case to be detected as
|
||||
// an error in both cases.
|
||||
if (['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError'].includes(error['type']))
|
||||
{
|
||||
internalCompilerError = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
internalCompilerError ||
|
||||
!('contracts' in result) ||
|
||||
Object.keys(result['contracts']).length === 0 ||
|
||||
Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0) ||
|
||||
internalCompilerError
|
||||
Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0)
|
||||
)
|
||||
// NOTE: do not exit here because this may be run on source which cannot be compiled
|
||||
console.log(filename + ': <ERROR>')
|
||||
|
Loading…
Reference in New Issue
Block a user