@zondax/zemu
Advanced tools
Comparing version 0.12.7 to 0.13.0
@@ -67,6 +67,5 @@ "use strict"; | ||
// @ts-ignore | ||
var emuContainer_1 = __importDefault(require("./emuContainer")); | ||
// @ts-ignore | ||
var grpc_1 = __importDefault(require("./grpc")); | ||
var constants_1 = require("./constants"); | ||
var emulator_1 = __importDefault(require("./emulator")); | ||
var Resolve = require('path').resolve; | ||
@@ -125,3 +124,3 @@ var rndstr = require('randomstring'); | ||
var containerName = constants_1.BASE_NAME + rndstr.generate(5); | ||
this.emuContainer = new emuContainer_1["default"](this.elfPath, this.libElfs, constants_1.DEFAULT_EMU_IMG, containerName); | ||
this.emuContainer = new emulator_1["default"](this.elfPath, this.libElfs, constants_1.DEFAULT_EMU_IMG, containerName); | ||
} | ||
@@ -182,3 +181,3 @@ Zemu.prototype.getSession = function () { | ||
}, constants_1.KILL_TIMEOUT); | ||
return [4 /*yield*/, emuContainer_1["default"].killContainerByName(constants_1.BASE_NAME)]; | ||
return [4 /*yield*/, emulator_1["default"].killContainerByName(constants_1.BASE_NAME)]; | ||
case 1: | ||
@@ -196,3 +195,3 @@ _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, emuContainer_1["default"].checkAndPullImage(constants_1.DEFAULT_EMU_IMG)]; | ||
case 0: return [4 /*yield*/, emulator_1["default"].checkAndPullImage(constants_1.DEFAULT_EMU_IMG)]; | ||
case 1: | ||
@@ -213,8 +212,3 @@ _a.sent(); | ||
} | ||
if (model === 'nanos' && elfInfo.entry !== elfCodeNanoS) { | ||
throw new Error("Zemu model is set to 'nanos' but elf file doesn't seem to be nano s build. Did you pass the right elf ?"); | ||
} | ||
if (model === 'nanox' && elfInfo.entry !== elfCodeNanoX) { | ||
throw new Error("Zemu model is set to 'nanox' but elf file doesn't seem to be nano x build. Did you pass the right elf ?"); | ||
} | ||
// FIXME: SDK2.0 entry points have changed | ||
}; | ||
@@ -221,0 +215,0 @@ Zemu.prototype.start = function (options) { |
@@ -84,8 +84,2 @@ "use strict"; | ||
}); | ||
test('Trying to run in nano S mode with a nano X elf', function () { | ||
var t = function () { | ||
src_1["default"].checkElf('nanos', DEMO_APP_PATH_X); | ||
}; | ||
expect(t).toThrow("Zemu model is set to 'nanos' but elf file doesn't seem to be nano s build. Did you pass the right elf ?"); | ||
}); | ||
test('Start&Close-NanoS', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -343,35 +337,18 @@ var sim; | ||
}); }); | ||
test('Load and run a library', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var LITECOIN_PATH, BITCOIN_LIB, sim, testLibWelcome, goldenLibWelcome; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
LITECOIN_PATH = Resolve('bin/litecoin.elf'); | ||
BITCOIN_LIB = { Bitcoin: Resolve('bin/bitcoin.elf') }; | ||
sim = new src_1["default"](LITECOIN_PATH, BITCOIN_LIB); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, , 4, 6]); | ||
return [4 /*yield*/, sim.start(ZEMU_OPTIONS_S) | ||
// If we can see the main screen, then the library has been loaded with success | ||
]; | ||
case 2: | ||
_a.sent(); | ||
// If we can see the main screen, then the library has been loaded with success | ||
return [4 /*yield*/, sim.snapshot('tests/tmp/libWelcome.png')]; | ||
case 3: | ||
// If we can see the main screen, then the library has been loaded with success | ||
_a.sent(); | ||
testLibWelcome = src_1["default"].LoadPng2RGB('tests/tmp/libWelcome.png'); | ||
goldenLibWelcome = src_1["default"].LoadPng2RGB('tests/snapshots/libWelcome.png'); | ||
expect(testLibWelcome).toEqual(goldenLibWelcome); | ||
return [3 /*break*/, 6]; | ||
case 4: return [4 /*yield*/, sim.close()]; | ||
case 5: | ||
_a.sent(); | ||
return [7 /*endfinally*/]; | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
// test('Load and run a library', async () => { | ||
// const LITECOIN_PATH = Resolve('bin/litecoin.elf') | ||
// const BITCOIN_LIB = { Bitcoin: Resolve('bin/bitcoin.elf') } | ||
// const sim = new Zemu(LITECOIN_PATH, BITCOIN_LIB) | ||
// try { | ||
// await sim.start(ZEMU_OPTIONS_S) | ||
// | ||
// // If we can see the main screen, then the library has been loaded with success | ||
// await sim.snapshot('tests/tmp/libWelcome.png') | ||
// const testLibWelcome = Zemu.LoadPng2RGB('tests/tmp/libWelcome.png') | ||
// const goldenLibWelcome = Zemu.LoadPng2RGB('tests/snapshots/libWelcome.png') | ||
// expect(testLibWelcome).toEqual(goldenLibWelcome) | ||
// } finally { | ||
// await sim.close() | ||
// } | ||
// }) | ||
test('GRPC Server start-stop', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -378,0 +355,0 @@ var sim; |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.12.7", | ||
"version": "0.13.0", | ||
"description": "Zemu Testing Framework", | ||
@@ -8,0 +8,0 @@ "main": "./dist/src/index.js", |
@@ -26,4 +26,2 @@ /** ****************************************************************************** | ||
// @ts-ignore | ||
import EmuContainer from './emuContainer' | ||
// @ts-ignore | ||
import GRPCRouter from './grpc' | ||
@@ -45,2 +43,3 @@ import { | ||
} from './constants' | ||
import EmuContainer from './emulator' | ||
@@ -188,10 +187,3 @@ const Resolve = require('path').resolve | ||
} | ||
if (model === 'nanos' && elfInfo.entry !== elfCodeNanoS) { | ||
throw new Error("Zemu model is set to 'nanos' but elf file doesn't seem to be nano s build. Did you pass the right elf ?") | ||
} | ||
if (model === 'nanox' && elfInfo.entry !== elfCodeNanoX) { | ||
throw new Error("Zemu model is set to 'nanox' but elf file doesn't seem to be nano x build. Did you pass the right elf ?") | ||
} | ||
// FIXME: SDK2.0 entry points have changed | ||
} | ||
@@ -198,0 +190,0 @@ |
@@ -50,9 +50,2 @@ /** ****************************************************************************** | ||
test('Trying to run in nano S mode with a nano X elf', () => { | ||
const t = () => { | ||
Zemu.checkElf('nanos', DEMO_APP_PATH_X) | ||
} | ||
expect(t).toThrow("Zemu model is set to 'nanos' but elf file doesn't seem to be nano s build. Did you pass the right elf ?") | ||
}) | ||
test('Start&Close-NanoS', async () => { | ||
@@ -181,19 +174,19 @@ const sim = new Zemu(DEMO_APP_PATH_S) | ||
test('Load and run a library', async () => { | ||
const LITECOIN_PATH = Resolve('bin/litecoin.elf') | ||
const BITCOIN_LIB = { Bitcoin: Resolve('bin/bitcoin.elf') } | ||
const sim = new Zemu(LITECOIN_PATH, BITCOIN_LIB) | ||
try { | ||
await sim.start(ZEMU_OPTIONS_S) | ||
// test('Load and run a library', async () => { | ||
// const LITECOIN_PATH = Resolve('bin/litecoin.elf') | ||
// const BITCOIN_LIB = { Bitcoin: Resolve('bin/bitcoin.elf') } | ||
// const sim = new Zemu(LITECOIN_PATH, BITCOIN_LIB) | ||
// try { | ||
// await sim.start(ZEMU_OPTIONS_S) | ||
// | ||
// // If we can see the main screen, then the library has been loaded with success | ||
// await sim.snapshot('tests/tmp/libWelcome.png') | ||
// const testLibWelcome = Zemu.LoadPng2RGB('tests/tmp/libWelcome.png') | ||
// const goldenLibWelcome = Zemu.LoadPng2RGB('tests/snapshots/libWelcome.png') | ||
// expect(testLibWelcome).toEqual(goldenLibWelcome) | ||
// } finally { | ||
// await sim.close() | ||
// } | ||
// }) | ||
// If we can see the main screen, then the library has been loaded with success | ||
await sim.snapshot('tests/tmp/libWelcome.png') | ||
const testLibWelcome = Zemu.LoadPng2RGB('tests/tmp/libWelcome.png') | ||
const goldenLibWelcome = Zemu.LoadPng2RGB('tests/snapshots/libWelcome.png') | ||
expect(testLibWelcome).toEqual(goldenLibWelcome) | ||
} finally { | ||
await sim.close() | ||
} | ||
}) | ||
test('GRPC Server start-stop', async () => { | ||
@@ -200,0 +193,0 @@ const sim = new Zemu(DEMO_APP_PATH_S) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2913664
2386