Skip to content

Commit

Permalink
increase test timeout to cope with RaspberryPI & BeagleBoneBlack perf…
Browse files Browse the repository at this point in the history
…ormance
  • Loading branch information
erossignon committed Aug 16, 2014
1 parent bc7e5a1 commit 5b8df9a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
18 changes: 17 additions & 1 deletion lib/xml2json/lib.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
/**
* @module xml2json
*/
var xml = require("ersatz-node-expat");


var xml;

// use node-expat for speed if installed
// otherwise fall back to ersatz-node-expat , a 100% javascript xml parser based on node-xml, but slower...
try {
xml = require("node-expat");
console.log("FAST: using node-expat");
}
catch(err) {
console.log(" Please install node-expat");
console.log(" npm install -g node-expat");
xml = require("ersatz-node-expat");
console.log("SLOW: using ersatz-node-expat");
}

var fs = require("fs");
var assert = require("better-assert");
var _ = require("underscore");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "test"
},
"scripts": {
"test": "mocha test -R spec --recursive --timeout 8000",
"test": "mocha test -R spec --recursive --timeout 20000",
"generate_doc": "make doc",
"generate_autodoc": "./node_modules/autodoc/bin/autodoc -o _tmp_generated_doc bin/binaryStream.js"
},
Expand Down
4 changes: 2 additions & 2 deletions test/address_space/test_load_nodeset2.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe("testing NodeSet XML file loading",function(){

it("should load a large nodeset xml file",function(done){


this.timeout(10000);
// set a large timeout ( loading the large nodeset xml file could be very slow on RPI)
this.timeout(400000);

var xml_file = __dirname + "/../../nodesets/Opc.Ua.NodeSet2.xml";
require("fs").existsSync(xml_file).should.be.eql(true);
Expand Down
7 changes: 5 additions & 2 deletions test/test_opcua_client_node_crawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ var NodeCrawler = require("../lib/client/node_crawler").NodeCrawler;

describe("NodeCrawler",function(){

this.timeout(10000);

// this test could be particularly slow on RapsberryPi or BeagleBoneBlack
// so we set a big enough timeout
if (process.arch === 'arm' ) {
this.timeout(400000);
}
var server , client,temperatureVariableId,endpointUrl ;

var port = 2001;
Expand Down
6 changes: 6 additions & 0 deletions test/xml2json/test_xml2json.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ describe("XMLToJSON",function(){

});
it("should parse a UTF8 encoded xml file with a BOM",function(done) {

// accomodate for slow RPI
if ( process.arch === "arm" ) {
this.timeout(40000);
this.slow(20000);
}
var xml_file = __dirname + "/../../nodesets/Opc.Ua.NodeSet2.xml";
var parser = new Xml2Json({});
parser.parse(xml_file,function(err) {
Expand Down

0 comments on commit 5b8df9a

Please sign in to comment.