Skip to content

Commit

Permalink
allow passing directory and image filename
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed Apr 8, 2020
1 parent fff972f commit cd71c8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/emuContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************* */
const path = require('path');

export const SCP_PRIVKEY = "ff701d781f43ce106f72dc26a46b6a83e053b5d07bb3d4ceab79c91ca822a66b";
export const BOLOS_SDK = "/project/deps/nanos-secure-sdk";
export const DEFAULT_APP_PATH = "/project/app/bin";
export const DEFAULT_APP_NAME = "app.elf";
export const DEFAULT_APP_PATH = "/project/app/bin/app.elf";
export const DEFAULT_VNC_PORT = "8001";

export default class EmuContainer {
Expand All @@ -33,8 +33,11 @@ export default class EmuContainer {
const Docker = require("dockerode");
const docker = new Docker();

const appPathBinding = `${this.elfLocalPath}:${DEFAULT_APP_PATH}`;
const command = `/home/zondax/speculos/speculos.py --display headless --vnc-port ${DEFAULT_VNC_PORT} ${DEFAULT_APP_PATH}/${DEFAULT_APP_NAME}`;
const app_filename = path.basename(this.elfLocalPath);
const app_dir = path.dirname(this.elfLocalPath);

const appPathBinding = `${app_dir}:${DEFAULT_APP_PATH}`;
const command = `/home/zondax/speculos/speculos.py --display headless --vnc-port ${DEFAULT_VNC_PORT} ${DEFAULT_APP_PATH}/${app_filename}`;

docker.createContainer({
Image: this.image,
Expand Down
2 changes: 1 addition & 1 deletion tests/basic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Zemu from "../src";
const Resolve = require("path").resolve;

jest.setTimeout(10000);
const DEMO_APP_PATH = Resolve("bin/demoApp");
const DEMO_APP_PATH = Resolve("bin/demoApp/app.elf");

test("Zemu-Start&Close", async () => {
const sim = new Zemu(DEMO_APP_PATH);
Expand Down

0 comments on commit cd71c8a

Please sign in to comment.