-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
const { execSync } = require('child_process'); | ||
const contract = process.argv[2]; | ||
const util = require('util'); | ||
const asyncExec = util.promisify(require('child_process').exec); | ||
|
||
const exec = commands => { | ||
async function getBrewPrefixPath() { | ||
try { | ||
execSync(commands, { stdio: 'inherit', shell: true }); // Specify the shell if needed | ||
} catch (error) {} | ||
}; | ||
const { stdout } = await asyncExec('brew --prefix'); | ||
console.log(`Homebrew prefix path: ${stdout.trim()}`); | ||
fuzzTestByEchidna(stdout.trim()); | ||
} catch (error) { | ||
console.error(`Error: ${error}`); | ||
} | ||
} | ||
|
||
getBrewPrefixPath(); | ||
|
||
function fuzzTestByEchidna(brewPrefix) { | ||
const contract = process.argv[2]; | ||
const exec = commands => { | ||
try { | ||
execSync(commands, { stdio: 'inherit', shell: true }); // Specify the shell if needed | ||
} catch (error) {} | ||
}; | ||
|
||
const echidnaPath = '/usr/local/bin/echidna'; | ||
console.log(echidnaPath); | ||
switch (contract) { | ||
case 'Operators': | ||
exec(echidnaPath + ' --config echidna.yaml --contract Operators contracts/echidna/Operators.sol'); | ||
break; | ||
case 'Clusters': | ||
exec(echidnaPath + ' --config echidna.yaml --contract Clusters contracts/echidna/Clusters.sol'); | ||
break; | ||
case 'DAO': | ||
exec(echidnaPath + ' --config echidna.yaml --contract DAO contracts/echidna/DAO.sol'); | ||
break; | ||
default: | ||
console.log('Invalid contract name. Use Operators, Clusters, or DAO.'); | ||
console.log('npm run echidna <Operators | Clusters | DAO>'); | ||
const echidnaPath = brewPrefix + '/bin/echidna'; | ||
console.log(echidnaPath); | ||
switch (contract) { | ||
case 'Operators': | ||
exec(echidnaPath + ' --config echidna.yaml --contract Operators contracts/echidna/Operators.sol'); | ||
break; | ||
case 'Clusters': | ||
exec(echidnaPath + ' --config echidna.yaml --contract Clusters contracts/echidna/Clusters.sol'); | ||
break; | ||
case 'DAO': | ||
exec(echidnaPath + ' --config echidna.yaml --contract DAO contracts/echidna/DAO.sol'); | ||
break; | ||
default: | ||
console.log('Invalid contract name. Use Operators, Clusters, or DAO.'); | ||
console.log('npm run echidna <Operators | Clusters | DAO>'); | ||
} | ||
} |