moving to testbed infrastructure
This commit is contained in:
parent
4917cc4f0a
commit
3d6a5619b0
2 changed files with 31 additions and 8 deletions
|
@ -23,6 +23,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^2.6.1",
|
"async": "^2.6.1",
|
||||||
"serialport": "^6.2.2",
|
"serialport": "^6.2.2",
|
||||||
"tape": "^4.9.1"
|
"tape": "^4.9.1",
|
||||||
|
"testbed-query-fixtures": "^1.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"homedir": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
test/test.js
33
test/test.js
|
@ -1,16 +1,35 @@
|
||||||
var async = require("async");
|
var async = require("async");
|
||||||
|
var homedir = require("homedir")();
|
||||||
var spawn = require("child_process").spawn;
|
var spawn = require("child_process").spawn;
|
||||||
var SerialPort = require("serialport");
|
var SerialPort = require("serialport");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var test = require("tape");
|
var test = require("tape");
|
||||||
|
var testbed = require("testbed-query-fixtures");
|
||||||
|
|
||||||
const exec = path.join(process.env.IDF_PATH, "components", "esptool_py", "esptool", "esptool.py");
|
const exec = path.join(process.env.IDF_PATH, "components", "esptool_py", "esptool", "esptool.py");
|
||||||
const portString = "/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_SERIAL_ID-if00-port0";
|
|
||||||
|
|
||||||
const buildPath = path.join(__dirname, "lora32", "build");
|
const buildPath = path.join(__dirname, "lora32", "build");
|
||||||
|
|
||||||
const TB_DEV1 = process.env.TB_DEV1 || "0000";
|
try {
|
||||||
const TB_DEV2 = process.env.TB_DEV2 || "0001";
|
var testbedConfig = require(path.join(homedir, ".testbed.json"));
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
console.error("testbed.json fixture file not found.");
|
||||||
|
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var devices = testbed({
|
||||||
|
f: [ "esp32", "lora" ],
|
||||||
|
fixtures: testbedConfig.fixtures
|
||||||
|
});
|
||||||
|
|
||||||
|
if(devices.length < 2) {
|
||||||
|
throw new Error("Not enough test devices available");
|
||||||
|
}
|
||||||
|
|
||||||
|
const TB_DEV1 = devices[0].DEVNAME;
|
||||||
|
const TB_DEV2 = devices[1].DEVNAME;
|
||||||
|
|
||||||
var args = [
|
var args = [
|
||||||
"--chip",
|
"--chip",
|
||||||
|
@ -108,20 +127,20 @@ async.series([
|
||||||
|
|
||||||
async.parallel([
|
async.parallel([
|
||||||
function(done) {
|
function(done) {
|
||||||
flash(portString.replace("SERIAL_ID", TB_DEV1), done);
|
flash(TB_DEV1, done);
|
||||||
}, function(done) {
|
}, function(done) {
|
||||||
flash(portString.replace("SERIAL_ID", TB_DEV2), done);
|
flash(TB_DEV2, done);
|
||||||
}], next);
|
}], next);
|
||||||
},
|
},
|
||||||
|
|
||||||
function(next) {
|
function(next) {
|
||||||
async.parallel({
|
async.parallel({
|
||||||
dev1: function(done) {
|
dev1: function(done) {
|
||||||
serial(portString.replace("SERIAL_ID", TB_DEV1), done);
|
serial(TB_DEV1, done);
|
||||||
},
|
},
|
||||||
|
|
||||||
dev2: function(done) {
|
dev2: function(done) {
|
||||||
serial(portString.replace("SERIAL_ID", TB_DEV2), done);
|
serial(TB_DEV2, done);
|
||||||
}
|
}
|
||||||
}, next);
|
}, next);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue