mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix bytecode tests for solc-js
This commit is contained in:
parent
28d98d61ef
commit
6ed3765941
@ -41,14 +41,15 @@ TMPDIR=$(mktemp -d)
|
|||||||
if [[ "$SOLC_EMSCRIPTEN" = "On" ]]
|
if [[ "$SOLC_EMSCRIPTEN" = "On" ]]
|
||||||
then
|
then
|
||||||
# npm install solc
|
# npm install solc
|
||||||
git clone --depth 1 https://github.com/ethereum/solc-js.git solc
|
git clone --depth 1 https://github.com/ethereum/solc-js.git solc-js
|
||||||
cp "$REPO_ROOT/build/libsolc/soljson.js" .
|
( cd solc-js; npm install )
|
||||||
|
cp "$REPO_ROOT/build/libsolc/soljson.js" solc-js/
|
||||||
cat > solc <<EOF
|
cat > solc <<EOF
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
var process = require('process')
|
var process = require('process')
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
|
|
||||||
var compiler = require('solc/wrapper.js')(require('./soljson.js'))
|
var compiler = require('./solc-js/wrapper.js')(require('./solc-js/soljson.js'))
|
||||||
|
|
||||||
for (var optimize of [false, true])
|
for (var optimize of [false, true])
|
||||||
{
|
{
|
||||||
@ -58,7 +59,15 @@ for (var optimize of [false, true])
|
|||||||
{
|
{
|
||||||
var inputs = {}
|
var inputs = {}
|
||||||
inputs[filename] = fs.readFileSync(filename).toString()
|
inputs[filename] = fs.readFileSync(filename).toString()
|
||||||
var result = compiler.compile({sources: inputs}, optimize)
|
var input = {
|
||||||
|
language: 'Solidity',
|
||||||
|
sources: inputs,
|
||||||
|
settings: {
|
||||||
|
optimizer: { enabled: optimize },
|
||||||
|
outputSelection: { '*': { '*': ['evm.bytecode.object', 'metadata'] } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var result = JSON.parse(compiler.compile(JSON.stringify(input)))
|
||||||
if (!('contracts' in result) || Object.keys(result['contracts']).length === 0)
|
if (!('contracts' in result) || Object.keys(result['contracts']).length === 0)
|
||||||
{
|
{
|
||||||
console.log(filename + ': ERROR')
|
console.log(filename + ': ERROR')
|
||||||
@ -67,7 +76,7 @@ for (var optimize of [false, true])
|
|||||||
{
|
{
|
||||||
for (var contractName in result['contracts'])
|
for (var contractName in result['contracts'])
|
||||||
{
|
{
|
||||||
console.log(contractName + ' ' + result['contracts'][contractName].bytecode)
|
console.log(contractName + ' ' + result['contracts'][contractName].evm.bytecode.object)
|
||||||
console.log(contractName + ' ' + result['contracts'][contractName].metadata)
|
console.log(contractName + ' ' + result['contracts'][contractName].metadata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user