diff options
Diffstat (limited to 'RPCTests')
-rw-r--r-- | RPCTests/main.js | 7 | ||||
-rw-r--r-- | RPCTests/modules/testutils.js | 49 | ||||
-rw-r--r-- | RPCTests/modules/utils.js | 21 | ||||
-rw-r--r-- | RPCTests/scripts/tests/AddPeer/step00_node02_AddPeer.js (renamed from RPCTests/scripts/test00_node02_AddPeer.js) | 0 | ||||
-rw-r--r-- | RPCTests/scripts/tests/AddPeer/step01_node01_getPeerCount.js.js (renamed from RPCTests/scripts/test01_node01_getPeerCount.js) | 1 | ||||
-rw-r--r-- | RPCTests/scripts/tests/MineBlocks/step00_node01_mineBlocks.js (renamed from RPCTests/scripts/test02_node01_mineBlocks.js) | 1 | ||||
-rw-r--r-- | RPCTests/scripts/tests/MineBlocks/step01_node02_getBlockHash.js (renamed from RPCTests/scripts/test03_node02_getBlockHash.js) | 1 | ||||
-rw-r--r-- | RPCTests/scripts/tests/MineBlocks2/step00_node02_mineBlocks.js (renamed from RPCTests/scripts/test04_node02_mineBlocks.js) | 0 | ||||
-rw-r--r-- | RPCTests/scripts/tests/MineBlocks2/step01_node01_getBlockHash.js (renamed from RPCTests/scripts/test05_node01_getBlockHash.js) | 0 |
9 files changed, 54 insertions, 26 deletions
diff --git a/RPCTests/main.js b/RPCTests/main.js index ffb5cfa62..e3089f0d0 100644 --- a/RPCTests/main.js +++ b/RPCTests/main.js @@ -16,10 +16,10 @@ function cb(){} function main() { -testutils.readTestsInFolder("./scripts"); +testutils.readTestsInFolder("./scripts/tests"); async.series([ function(cb) { - utils.setDebug(false); + utils.setDebug(true); ethconsole.startNode(ethpath, testdir + "/ethnode1", testdir + "/genesis.json", 30305, cb); }, function(cb) { @@ -53,7 +53,7 @@ function(cb) { function prepareDynamicVars(finished) { async.series([ - function(cb) { + function(cb) { ethconsole.runScriptOnNode(testdir + "/ethnode1", "./scripts/testNewAccount.js", {}, cb); }, function(cb) { @@ -117,3 +117,4 @@ function runAllTests(finished) } main(); +//testutils.readTestsInFolder("./scripts/tests"); diff --git a/RPCTests/modules/testutils.js b/RPCTests/modules/testutils.js index 7128c6972..54cd64525 100644 --- a/RPCTests/modules/testutils.js +++ b/RPCTests/modules/testutils.js @@ -26,31 +26,40 @@ generateCustomGenesis: function generateCustomGenesis(path, originalPath, accoun readTestsInFolder: function readTestsInFolder(path) { - var res = utils.listFiles(path); - res.forEach(function(file) { - var testn = file.indexOf("test"); - var slashn = file.indexOf("_"); - if (testn != -1 && slashn != -1) - { - testNumber = parseInt(file.substring(testn + 4, slashn)); - var noden = file.indexOf("node"); - var slashn = file.indexOf("_", slashn+1); - var tmpFile = file.indexOf("~"); - if (noden != -1 && slashn != -1 && tmpFile == -1) + var testNumber = 0; + var folders = utils.listFolders(path); + folders.forEach(function(folder) { + + var res = utils.listFiles(folder); + res.forEach(function(file) { + + var testn = file.indexOf("step"); + var slashn = file.indexOf("_"); + if (testn != -1 && slashn != -1) { - if (tests[testNumber]) - console.log("Error: dublicate test found " + file); - else + //testNumber = parseInt(file.substring(testn + 4, slashn)); + var noden = file.indexOf("node"); + var slashn = file.indexOf("_", slashn+1); + var tmpFile = file.indexOf("~"); + if (noden != -1 && slashn != -1 && tmpFile == -1) { - var testObject = {}; - testObject.file = file; - testObject.node = file.substring(noden + 4, slashn); - tests[testNumber] = testObject; - testCount++; + if (tests[testNumber]) + console.log("Error: dublicate test found " + file); + else + { + var testObject = {}; + testObject.file = file; + testObject.node = file.substring(noden + 4, slashn); + tests[testNumber] = testObject; + testCount++; + testNumber++; + } } } - } + }); }); + + //console.log(tests); }, getTestCount: function getTestCount() diff --git a/RPCTests/modules/utils.js b/RPCTests/modules/utils.js index 24e9bd811..5d32ec771 100644 --- a/RPCTests/modules/utils.js +++ b/RPCTests/modules/utils.js @@ -45,19 +45,34 @@ module.exports = { fs.writeFile(path, data, (err) => { if (err) throw err;}); }, - listFiles: function listFiles(dir) { + listFiles: function listFiles(dir, recursive = false) { var results = []; fs.readdirSync(dir).forEach(function(file) { file = dir+'/'+file; var stat = fs.statSync(file); - if (stat && stat.isDirectory()) { - results = results.concat(listFiles(file)) + if (stat && stat.isDirectory() && recursive) { + results = results.concat(listFiles(file, recursive)) } else results.push(file); }); return results; + }, + + listFolders: function listFolders(dir) { + + var results = []; + fs.readdirSync(dir).forEach(function(file) { + file = dir+'/'+file; + var stat = fs.statSync(file); + + if (stat && stat.isDirectory()) { + results.push(file); + } + }); + + return results; } } //exports diff --git a/RPCTests/scripts/test00_node02_AddPeer.js b/RPCTests/scripts/tests/AddPeer/step00_node02_AddPeer.js index 233648dc3..233648dc3 100644 --- a/RPCTests/scripts/test00_node02_AddPeer.js +++ b/RPCTests/scripts/tests/AddPeer/step00_node02_AddPeer.js diff --git a/RPCTests/scripts/test01_node01_getPeerCount.js b/RPCTests/scripts/tests/AddPeer/step01_node01_getPeerCount.js.js index 155846dbf..1f53480ff 100644 --- a/RPCTests/scripts/test01_node01_getPeerCount.js +++ b/RPCTests/scripts/tests/AddPeer/step01_node01_getPeerCount.js.js @@ -9,3 +9,4 @@ onResult = function (err,res) console.log("FAILED"); callback(err, res); } + diff --git a/RPCTests/scripts/test02_node01_mineBlocks.js b/RPCTests/scripts/tests/MineBlocks/step00_node01_mineBlocks.js index 14bc0bb63..4abcdbd40 100644 --- a/RPCTests/scripts/test02_node01_mineBlocks.js +++ b/RPCTests/scripts/tests/MineBlocks/step00_node01_mineBlocks.js @@ -29,3 +29,4 @@ onGetBlockNumber = function (err, res) console.log("FAILED"); callback(err, res); } + diff --git a/RPCTests/scripts/test03_node02_getBlockHash.js b/RPCTests/scripts/tests/MineBlocks/step01_node02_getBlockHash.js index fc09f8423..92be98acf 100644 --- a/RPCTests/scripts/test03_node02_getBlockHash.js +++ b/RPCTests/scripts/tests/MineBlocks/step01_node02_getBlockHash.js @@ -11,3 +11,4 @@ onResult = function (err,res) console.log("FAILED"); callback(err, res); } + diff --git a/RPCTests/scripts/test04_node02_mineBlocks.js b/RPCTests/scripts/tests/MineBlocks2/step00_node02_mineBlocks.js index 70936cc41..70936cc41 100644 --- a/RPCTests/scripts/test04_node02_mineBlocks.js +++ b/RPCTests/scripts/tests/MineBlocks2/step00_node02_mineBlocks.js diff --git a/RPCTests/scripts/test05_node01_getBlockHash.js b/RPCTests/scripts/tests/MineBlocks2/step01_node01_getBlockHash.js index d3a3b0bbf..d3a3b0bbf 100644 --- a/RPCTests/scripts/test05_node01_getBlockHash.js +++ b/RPCTests/scripts/tests/MineBlocks2/step01_node01_getBlockHash.js |