aboutsummaryrefslogtreecommitdiffstats
path: root/RPCTests/main.js
diff options
context:
space:
mode:
authorDimitry <winsvega@mail.ru>2017-01-28 00:31:19 +0800
committerDimitry <winsvega@mail.ru>2017-01-28 00:31:19 +0800
commitea7e06b2970a01cd11b3a062425f5c5cafc19ee7 (patch)
tree82f0dad0a0c0c37591e8c8d542710b8d909f086d /RPCTests/main.js
parentbc8ad7422d32a940bab194173083a684adcc2706 (diff)
downloaddexon-tests-ea7e06b2970a01cd11b3a062425f5c5cafc19ee7.tar.gz
dexon-tests-ea7e06b2970a01cd11b3a062425f5c5cafc19ee7.tar.zst
dexon-tests-ea7e06b2970a01cd11b3a062425f5c5cafc19ee7.zip
rpc tests on js
Diffstat (limited to 'RPCTests/main.js')
-rw-r--r--RPCTests/main.js151
1 files changed, 102 insertions, 49 deletions
diff --git a/RPCTests/main.js b/RPCTests/main.js
index 0cba752eb..ffb5cfa62 100644
--- a/RPCTests/main.js
+++ b/RPCTests/main.js
@@ -1,66 +1,119 @@
-var exec = require('child_process').exec;
+//requires installed node v6
+//requires ETHEREUM_TEST_PATH env variable set (for full path to the ipc sockets)
+//requires ethereum eth path
+var async = require("./modules/async");
var utils = require('./modules/utils.js');
-var startNode = require('./modules/startnode.js');
+var testutils = require('./modules/testutils.js');
+var ethconsole = require('./modules/ethconsole.js');
var ethpath = '/home/wins/Ethereum/cpp-ethereum/build/eth/eth';
var testdir = process.env.ETHEREUM_TEST_PATH + "/RPCTests/dynamic";
-var async = require("./modules/async");
-
-function cb(err, data)
-{
-console.log(data);
-}
+var dynamic = {};
-function main(goto, args)
+function cb(){}
+function main()
{
+testutils.readTestsInFolder("./scripts");
async.series([
-function(cb) { utils.readFile('./scripts/genesis.json', cb); },
-function(cb) { cb(); console.log("as2"); },
-function(cb) { cb(); console.log("as3"); }
-], function() { console.log("as4") })
-
-/*utils.sleep(2000).then(() => {
- console.log('Result: ');
-});*/
-
-/*switch(goto)
-{
-case 1: utils.mkdir('./dynamic', main, 2); break;
-case 2: utils.readFile('./scripts/genesis.json', main, 3); break;
-case 3: console.log(args); break;
-}*/
-
-
-//utils.writeFile('./dynamic/genesis.json', data, (err) => { if (err) throw err;});
-//startNode(ethpath, testdir + "/ethnode1", testdir + "/genesis.json", 30305);
+function(cb) {
+ utils.setDebug(false);
+ ethconsole.startNode(ethpath, testdir + "/ethnode1", testdir + "/genesis.json", 30305, cb);
+},
+function(cb) {
+ prepareDynamicVars(cb);
+},
+function(cb) {
+ ethconsole.stopNode(testdir + "/ethnode1", cb);
+},
+function(cb) {
+ ethconsole.startNode(ethpath, testdir + "/ethnode1", testdir + "/genesis.json", 30305, cb);
+ dynamic["node1_port"] = "30305";
+},
+function(cb) {
+ ethconsole.startNode(ethpath, testdir + "/ethnode2", testdir + "/genesis.json", 30306, cb);
+ dynamic["node2_port"] = "30306";
+},
+function(cb) {
+ runAllTests(cb);
+},
+function(cb) {
+ ethconsole.stopNode(testdir + "/ethnode1", cb);
+ ethconsole.stopNode(testdir + "/ethnode2", cb);
}
-
-/*var callback1 = function (err, data) {};
-fs.readFile('./scripts/genesis.json', 'utf8', (err, data) => { callback1 (err,data) });
-startNode = require('./modules/startnode.js');
+], function() {
+ utils.rmdir(testdir); }
+)
+}//main
-callback1 = function (err, data)
+function prepareDynamicVars(finished)
{
- if (err) throw err;
- data = data.replace("[ADDRESS]", "0x112233445566778899");
- mkdir('./dynamic');
- fs.writeFile('./dynamic/genesis.json', data, (err) => { if (err) throw err;});
-
-
- exec('pwd', function callback(error, stdout, stderr){
- dir = stdout;
- startNode(ethpath, 'privatechain', testdir + "/ethnode1", 30305);
- });
-
- //rmdir('./dynamic');
-}*/
-
-
-main(1);
+ async.series([
+ function(cb) {
+ ethconsole.runScriptOnNode(testdir + "/ethnode1", "./scripts/testNewAccount.js", {}, cb);
+ },
+ function(cb) {
+ dynamic["account"] = ethconsole.getLastResponse();
+ utils.mkdir(testdir);
+ testutils.generateCustomGenesis(testdir + '/genesis.json', "./scripts/genesis.json", dynamic["account"], cb);
+ },
+ function(cb) {
+ ethconsole.runScriptOnNode(testdir + "/ethnode1", "./scripts/getNodeInfo.js", {}, cb);
+ },
+ function(cb) {
+ dynamic["node1_ID"] = ethconsole.getLastResponse().id;
+ cb();
+ }
+ ], function() { finished(); })
+}
+function runAllTests(finished)
+{
+ var currentTest = -1;
+ var updateDynamic = function(){};
+
+ function nextTest()
+ {
+ currentTest++;
+ if (currentTest == testutils.getTestCount())
+ finished();
+ else
+ {
+ var testObject = testutils.getTestNumber(currentTest);
+ var nodepath;
+ if (testObject.node == '01')
+ nodepath = testdir + "/ethnode1";
+ if (testObject.node == '02')
+ nodepath = testdir + "/ethnode2";
+
+ ethconsole.runScriptOnNode(nodepath, testObject.file, dynamic, updateDynamic);
+ }
+ }
+
+ updateDynamic = function updateDynamic()
+ {
+ async.series([
+ function(cb) {
+ ethconsole.runScriptOnNode(testdir + "/ethnode1", "./scripts/getLastBlock.js", {}, cb);
+ },
+ function(cb) {
+ dynamic["node1_lastblock"] = ethconsole.getLastResponse();
+ cb();
+ },
+ function(cb) {
+ ethconsole.runScriptOnNode(testdir + "/ethnode2", "./scripts/getLastBlock.js", {}, cb);
+ },
+ function(cb) {
+ dynamic["node2_lastblock"] = ethconsole.getLastResponse();
+ cb();
+ }
+ ], function() { nextTest(); });
+ }
+ nextTest();
+}
+main();
olspan='5' class='logmsg'> --fillchain on GeneralStateTests/stQuadraticComplexityTest | * | | | --fillchain on GeneralStateTests/stQuadraticComplexityTestYoichi Hirai2017-08-2930-1410/+1200 | | | | | | | | | | | | | | | | | | | | This will eliminate around 30 errors from `testeth -t BCGeneralStateTests/stQuadraticComplexityTest -- --all` * | | | | Merge pull request #284 from holgerd77/add-docsYoichi Hirai2017-08-3014-1/+890 |\ \ \ \ \ | |_|/ / / |/| | | | Integrate test documentation from Homestead docs | * | | | Some updates on state tests, note on outdated structureholgerd772017-08-301-4/+19 | | | | | | * | | | Updated the test structure of BlockchainTests, removed outdated informationholgerd772017-08-301-82/+91 | | | | | | * | | | Added note on outdated docs, seek for helpholgerd772017-08-302-1/+7 | | | | | | * | | | Updated test doc URL in README, added some contribution notesholgerd772017-08-303-1/+21 | | | | | | * | | | Added doc rst files from the Homestead docsholgerd772017-08-309-8/+598 | | | | | | * | | | Add initial Sphinx docs directory, added docs/_build/ folder to .gitignoreholgerd772017-08-305-0/+249 |/ / / / * | | | Merge pull request #288 from ethereum/fillchain-stRandomYoichi Hirai2017-08-301-54/+40 |\ \ \ \ | |/ / / |/| | | --fillchain randomStatetest642_d0g0v0.json | * | | --fillchain ↵Yoichi Hirai2017-08-301-54/+40 |/ / / | | | | | | | | | BlockchainTests/GeneralStateTests/stRandom/randomStatetest642_d0g0v0.json * | | Merge pull request #285 from ethereum/log-as-hashYoichi Hirai2017-08-291-1509/+128 |\ \ \ | | | | | | | | Replace the remaining log arrays with log hashes | * | | Replace the remaining log arrays with log hashesYoichi Hirai2017-08-291-1509/+128 | | | | | | | | | | | | | | | | | | | | | | | | testeth changed the log formats recently. The test cases are not supposed to contain logs, but only the hash of the logs. `test/testeth -t 'VMTests' -- --all` passes after this commit. * | | | Merge pull request #283 from ethereum/returndatasize_after_staticcallYoichi Hirai2017-08-298-0/+772 |\ \ \ \ | |/ / / |/| | | Add new `returndatasize/returndatacopy` state tests | * | | add 'returndatacopy_after_successful_delegatecall' state testJared Wasinger2017-08-292-0/+193 | | | | | * | | add 'returndatacopy_after_successful_callcode' state testJared Wasinger2017-08-292-0/+193 | | | | | * | | add 'returndatasize_after_successful_delegatecall' state testJared Wasinger2017-08-292-0/+193 | | | | | * | | add 'returndatasize_after_successful_staticcall' state testJared Wasinger2017-08-292-0/+193 |/ / / * | | Merge pull request #282 from ethereum/precompiled-failure-means-balance-revertYoichi Hirai2017-08-291-3/+3 |\ \ \ | | | | | | | | Precompiled failure means reverting the balance transfer | * | | This change is a part of the fix to ↵Yoichi Hirai2017-08-281-3/+3 |/ / / | | | | | | | | | https://github.com/ethereum/cpp-ethereum/issues/4416 * / / add randomTest642 that fails on geth. a call to precompiled 007Dimitry2017-08-283-0/+896 |/ / * | Merge pull request #279 from ethereum/filled-hive-testsYoichi Hirai2017-08-283036-141382/+244798 |\ \ | | | | | | Translate GeneralStateTests into BlockchainTests/GeneralStateTests | * | Translate GeneralStateTests into BlockahtinTests/GeneralStateTestsYoichi Hirai2017-08-283036-141382/+244798 | | | * | | Merge pull request #278 from ethereum/returndatasize_after_callcodeYoichi Hirai2017-08-282-0/+192 |\ \ \ | |/ / |/| | add state test 'returndatasize_after_callcode' | * | add state test 'returndatasize_after_callcode'Jared Wasinger2017-08-282-0/+192 |/ / * | Merge pull request #268 from ethereum/bc-schemaYoichi Hirai2017-08-265-4/+507 |\ \ | | | | | | Add blockchain test linting | * | add blockchain test linting to travisJared Wasinger2017-08-265-4/+507 |/ / * | Merge pull request #275 from ethereum/bc-schema-test-fixesYoichi Hirai2017-08-264-1549/+1532 |\ \ | |/ |/| fix tests that don't conform to blockchain test schema | * fix tests that don't conform to blockchain test schemaJared Wasinger2017-08-264-1549/+1532 |/ * Merge pull request #273 from ethereum/vmIO-fixYoichi Hirai2017-08-252-146/+145 |\ | | | | Fix the filler and fill vmIOandFlowOperationsTest | * Fix the filler and fill vmIOandFlowOperationsTestYoichi Hirai2017-08-242-146/+145 | | * | Merge pull request #274 from ethereum/log-new-formatYoichi Hirai2017-08-253-76969/+38570 |\ \ | |/ |/| Replace more logs with hashes | * Replace more logs with log hashesYoichi Hirai2017-08-242-76924/+38463 | | | * Replace logs with log hashesYoichi Hirai2017-08-241-45/+107 |/ * Merge pull request #271 from ethereum/address-collision-failsYoichi Hirai2017-08-246-112/+22 |\ | | | | EIP 684: contract creation fails on nonempty code or nonzero nonce | * Changes for EIP-684Yoichi Hirai2017-08-246-112/+22 |/ | | | The change was agreed on the last coredev call and this morning I got an OK from @arkpar. * Merge pull request #267 from ethereum/some-vm-test-failuresYoichi Hirai2017-08-2419-1468/+3457 |\ | | | | Replace logs with hashes in VM tests | * Replace logs with hashesYoichi Hirai2017-08-238-17/+9 | | | * Fix some VMTest filling failuresYoichi Hirai2017-08-2311-1451/+3448 |/ * Merge pull request #269 from ethereum/eip649Yoichi Hirai2017-08-23224-36522/+36848 |\ | | | | EIP649: difficulty and reward changes | * Fix uncleHeaderAt2ByzantiumFiller with a correct state root hashYoichi Hirai2017-08-232-3/+705 | | | | | | | | See https://github.com/ethereum/tests/pull/269#discussion_r134723534 | * Fix uncleBloomNot0_2 with the expected state root hashYoichi Hirai2017-08-232-97/+148 | | | | | | | | See https://github.com/ethereum/tests/pull/269#discussion_r134723381 | * Fix futureUncleTimestampDifficultyDrop2Yoichi Hirai2017-08-232-98/+149 | | | | | | | | See https://github.com/ethereum/tests/pull/269#discussion_r134722457 | * Fill more testsYoichi Hirai2017-08-2247-1338/+1551 | | | * Fill more testsYoichi Hirai2017-08-2247-1695/+1482 | | | * Fill more tests on eip649 branchYoichi Hirai2017-08-2221-788/+762 | | | * Fill in more testsYoichi Hirai2017-08-2216-1369/+917 | | | * Refill more straightforward BlockchainTestsYoichi Hirai2017-08-2278-6787/+6787 | | | * Refill straightforward casesYoichi Hirai2017-08-2272-26077/+26077 | | * | Merge pull request #266 from ethereum/0x-fieldswinsvega2017-08-234-1563/+1563 |\ \ | | | | | | Refilled tests again so that 0x is in front of byte sequences | * | Refilled tests again so that 0x is in front of byte sequencesYoichi Hirai2017-08-224-1563/+1563 | | | * | | Merge pull request #213 from jwasinger/issue-204Yoichi Hirai2017-08-234-1/+688 |\ \ \ | | | | | | | | JSON schema for state tests | * | | add storage and code restrictions to json schemacdetrio2017-08-082-3/+25 | | | | | * | | replace Metropolis with Byzantium and Constantinople in state test schemacdetrio2017-08-081-1/+4 | | | | | * | | add schema for state test fillerscdetrio2017-08-082-0/+258 | | | | | * | | use more type definitions in schemacdetrio2017-08-081-116/+214 | | | | | * | | validate.js takes schema file as argumentcdetrio2017-08-082-2/+4 | | | | | * | | improve type checking.Jared Wasinger2017-08-081-148/+190 | | | | | * | | remove es6 syntax from validation script.Jared Wasinger2017-08-081-1/+1 | | | | | * | | make travis use node8Jared Wasinger2017-08-081-1/+1 | | | | | * | | make log ordering consistentJared Wasinger2017-08-081-0/+11 | | | | | * | | add ECDSA parameters r, s, v. Make sure certain fields are marked as ↵Jared Wasinger2017-08-081-8/+25 | | | | | | | | | | | | | | | | required. Add regex for GasAmount. | * | | make error output more informative. Make schema more comprehensive. Add ↵Jared Wasinger2017-08-083-38/+81 | | | | | | | | | | | | | | | | exit code of -1 upon failure | * | | fix process errorJared Wasinger2017-08-081-1/+0 | | | | | * | | format code. Remove unused python codeJared Wasinger2017-08-083-132/+105 | | | | | * | | use JS for json schema validation because the Node 'jsonschema' library is ↵Jared Wasinger2017-08-083-8/+15 | | | | | | | | | | | | | | | | the only one (that I have found) to correctly handle 'additionalProperties' as a boolean (https://spacetelescope.github.io/understanding-json-schema/reference/object.html) | * | | add schema validation with Travis integration.Jared Wasinger2017-08-084-20/+42 | | | | | * | | add "explanation" field. Reduce number of schema errorsJared Wasinger2017-08-084-2/+7 | | | | | * | | modify validation script to run against all test cases under GeneralStateTestsJared Wasinger2017-08-082-27/+9 | | | | | * | | add working schema outlineJared Wasinger2017-08-083-62/+194 | | | | | * | | add JSON schema skeleton for #204Jared Wasinger2017-08-081-0/+71 | | | | * | | | Merge pull request #253 from cdetrio/fix-data-0xYoichi Hirai2017-08-2334-138/+138 |\ \ \ \ | |_|/ / |/| | | add 0x prefix to state test transaction data | * | | add 0x prefix to state test transaction datacdetrio2017-08-0834-138/+138 | |/ / * | | Merge pull request #265 from ethereum/refill-wallet-testswinsvega2017-08-224-1727/+1727 |\ \ \ | |_|/ |/| | Refill bcWalletTest | * | Refill bcWalletTestYoichi Hirai2017-08-224-1727/+1727 |/ / | | | | | | Last time I filled these tests, I used a broken version of testeth, and "0x" prefix was missing everywhere * | refill opcodes test with logsDimitry2017-08-221-469/+235 | | * | Merge pull request #264 from ethereum/refill-empty-accountwinsvega2017-08-224-2315/+2287 |\ \ | | | | | | Refill some tests whose postState contained empty accounts | * | Refill wallet testsYoichi Hirai2017-08-224-1984/+1963 | | | | | | | | | | | | Before this commit, some empty accounts appeared in the postState | * | Refill the test wallet2outOf3txsRevoke.jsonYoichi Hirai2017-08-221-595/+588 | | | | | | | | | | | | Fixes #4362 * | | Merge pull request #263 from ethereum/logswinsvega2017-08-212726-89623/+23638 |\ \ \ | | | | | | | | remove old log fields from randomTestFillers | * | | make all logs hexDimitry2017-08-212193-81494/+17073 | | | | | * | | remove old fields from random testsDimitry2017-08-211081-8677/+7113 |/ / / | | | | | | | | | make logs hash * | | Merge pull request #261 from jwasinger/masterwinsvega2017-08-213-1/+2523 |\ \ \ | | | | | | | | Add State Tests for Unused Opcodes | * | | check for all possible invalid opcodes.Jared Wasinger2017-08-178-640/+2477 | | | | | * | | fix tests to conform to schemaJared Wasinger2017-08-175-7/+7 | | | | | * | | add SLOADBYTESJared Wasinger2017-08-173-1/+189 | | | | | * | | add badOpcode tests for SLOADBYTES and SSIZEJared Wasinger2017-08-175-3/+313 | | | | | * | | add badOpcode state test for SSIZEJared Wasinger2017-08-172-0/+187 | | | | * | | | Merge pull request #254 from cdetrio/fix-filler-storagewinsvega2017-08-2118-26/+26 |\ \ \ \ | |_|/ / |/| | | use hex for storage keys and values in state test fillers | * | | use hex for storage keys and values in state test fillerscdetrio2017-08-0818-26/+26 | | |/ | |/| * | | Merge pull request #262 from ethereum/eip96-to-constantinopleYoichi Hirai2017-08-17221-36812/+35337 |\ \ \ | |_|/ |/| | Move EIP96 to Constantinople | * | Fix more BlockchainTestsYoichi Hirai2017-08-1719-2908/+2826 | | | | * | fill BlockchainTests after delaying EIP96 to ConstantinopleYoichi Hirai2017-08-16206-34380/+32987 |/ / * | update comments in dao transition testsDimitry2017-08-157-472/+472 | | * | Merge pull request #260 from ethereum/bigger-memory-allocwinsvega2017-08-154-133/+133 |\ \ | | | | | | Fix the modexpFiller about large base length and large exp length | * | Fix the modexpFiller about large base length and large exp lengthYoichi Hirai2017-08-144-133/+133 |/ / * | fix test name zeroSigTransactionCreateDimitry2017-08-144-5/+787 | | * | Merge pull request #258 from cdetrio/returndata-caseswinsvega2017-08-1110-0/+891 |\ \ | | | | | | more returndata test cases | * | more returndata test casescdetrio2017-08-1110-0/+891 | | | * | | Update and rename zeroSigTransacrionCreate.json to zeroSigTransactionCreate.jsonwinsvega2017-08-111-2/+2 |/ / * | Merge pull request #255 from ethereum/revert-returndatacopywinsvega2017-08-093-0/+953 |\ \ | |/ |/| Add a test case that RETURNDATACOPYs REVERTed data | * Add a test case that RETURNDATACOPYs REVERTed dataYoichi Hirai2017-08-083-0/+953 |/ * Merge pull request #250 from cdetrio/filler-valid-jsonYoichi Hirai2017-08-0721-554/+554 |\ | | | | fix invalid json state test fillers | * fix invalid json fillerscdetrio2017-08-0621-554/+554 | | * | Merge pull request #248 from ethereum/odd-length-hex-in-vm-fillerwinsvega2017-08-064-89/+439 |\ \ | | | | | | Fix some formatting issues in VMTest fillers | * | Fix some formatting issues in VMTest fillersYoichi Hirai2017-08-054-89/+439 | |/ * | Merge pull request #246 from ethereum/filled-vm-test-no-expectwinsvega2017-08-063-68/+0 |\ \ | | | | | | Remove "expect" sections from VM tests | * | Remove "expect" sections from VM testsYoichi Hirai2017-08-053-68/+0 | |/ * | Merge pull request #251 from ethereum/hivetestswinsvega2017-08-062851-164758/+619483 |\ \ | |/ |/| Hive tests with Byzantine | * Hive tests with ByzantineDimitry2017-08-062851-164758/+619483 |/ * Merge pull request #245 from ethereum/blockhashtestYoichi Hirai2017-08-042-102/+155 |\ | | | | blockhash test on Byzantine transition | * blockhash test on Byzantine transitionDimitry2017-08-042-102/+155 | | * | Merge pull request #244 from ethereum/clear-storage-after-initwinsvega2017-08-043-80/+226 |\ \ | |/ |/| Change tests so that the storage is cleared before, not after contract initialization | * Fix the filler as wellYoichi Hirai2017-08-041-1/+5 | | | * Change tests so that the storage is cleared before, not after contract ↵Yoichi Hirai2017-08-042-79/+221 |/ | | | initialization * Merge pull request #241 from ethereum/metrosplitwinsvega2017-08-043205-75436/+304768 |\ | | | | Metrosplit | * Transition tests with ByzantiumDimitry2017-08-0315-3448/+865 | | | * split metropolisDimitry2017-08-03