Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"sign" and "version" tests fail #1

Closed
adrianbrink opened this issue Feb 12, 2019 · 2 comments · Fixed by #2
Closed

"sign" and "version" tests fail #1

adrianbrink opened this issue Feb 12, 2019 · 2 comments · Fixed by #2

Comments

@adrianbrink
Copy link
Contributor

adrianbrink commented Feb 12, 2019

On macOS signing and getting the version fails but getting the pubkey works.

➜  ledger-cosmos-rs git:(master) cargo test -- --nocapture
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running target/debug/deps/ledger_cosmos-98c78c5de6cb8c80

running 6 tests
test tests::derivation_path ... ok
>> [56, 1, 0, 0, 15, 5, 2C, 0, 0, 80, 76, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 80]
thread 'tests::sign_empty' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
test tests::sign_empty ... FAILED
thread 'tests::sign_many' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
test tests::sign_many ... FAILED
thread 'tests::sign_verify' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
test tests::sign_verify ... FAILED
thread 'tests::version' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
test tests::version ... FAILED
<< [E7, E8, 70, 7, 3, 8, 93, 9, 7E, 73, EE, 86, C7, B9, 5F, BD, 17, 13, D4, A7, C7, A6, 63, CC, 75, AA, 53, 70, 48, C2, E2, 8B, 90, 0]
PK [E7, E8, 70, 7, 3, 8, 93, 9, 7E, 73, EE, 86, C7, B9, 5F, BD, 17, 13, D4, A7, C7, A6, 63, CC, 75, AA, 53, 70, 48, C2, E2, 8B]
test tests::public_key ... ok

failures:

failures:
    tests::sign_empty
    tests::sign_many
    tests::sign_verify
    tests::version

test result: FAILED. 2 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--lib'

On Ubuntu 18.01 only the derivation path test works.

➜  ledger-cosmos-rs git:(master) cargo test -- --nocapture
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running target/debug/deps/ledger_cosmos-b1aaca15beb526da

running 6 tests
test tests::derivation_path ... ok
thread 'tests::sign_empty' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }))', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
test tests::sign_empty ... FAILED
thread 'tests::sign_many' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }))', src/libcore/result.rs:997:5
test tests::sign_many ... FAILED
thread 'tests::public_key' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }))', src/libcore/result.rs:997:5
test tests::public_key ... FAILED
thread 'tests::sign_verify' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }))', src/libcore/result.rs:997:5
test tests::sign_verify ... FAILED
thread 'tests::version' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" }))', src/libcore/result.rs:997:5
test tests::version ... FAILED

failures:

failures:
    tests::public_key
    tests::sign_empty
    tests::sign_many
    tests::sign_verify
    tests::version

test result: FAILED. 1 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--lib'

Most likely this is due to permission problems on Ubuntu as described here Zondax/ledger-rs#3 .

@adrianbrink
Copy link
Contributor Author

On macOS I also managed to get this output. derivation_path and sign_many worked, but pub_key didn't anymore.

➜  ledger-cosmos-rs git:(master) cargo test -- --nocapture
   Compiling ledger-cosmos v0.2.0 (/Users/adrian/code/tendermint/ledger-cosmos-rs)
warning: unused import: `sha2::Digest`
   --> src/lib.rs:354:21
    |
354 |                 use sha2::Digest;
    |                     ^^^^^^^^^^^^
    |
    = note: #[warn(unused_imports)] on by default

    Finished dev [unoptimized + debuginfo] target(s) in 2.00s
     Running target/debug/deps/ledger_cosmos-98c78c5de6cb8c80

running 6 tests
PubKey Test
SignEmpty Test
SignMany Test
SignVerify Test
test tests::derivation_path ... ok
>> [56, 1, 0, 0, 15, 5, 2C, 0, 0, 80, 76, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 80]
thread 'tests::public_key' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
test tests::public_key ... FAILED
thread 'tests::sign_empty' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
test tests::sign_empty ... FAILED
thread 'tests::sign_verify' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
test tests::sign_verify ... FAILED
thread 'tests::version' panicked at 'called `Result::unwrap()` on an `Err` value: Ledger(Hid(OpenHidDeviceError))', src/libcore/result.rs:997:5
test tests::version ... FAILED
<< [E7, E8, 70, 7, 3, 8, 93, 9, 7E, 73, EE, 86, C7, B9, 5F, BD, 17, 13, D4, A7, C7, A6, 63, CC, 75, AA, 53, 70, 48, C2, E2, 8B, 90, 0]
[231, 232, 112, 7, 3, 8, 147, 9, 126, 115, 238, 134, 199, 185, 95, 189, 23, 19, 212, 167, 199, 166, 99, 204, 117, 170, 83, 112, 72, 194, 226, 139]
>> [56, 2, 1, 1, 21, 8, 1, 11, 32, 0, 0, 0, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 0, 0, 0, 22, B, 8, 80, 92, B8, C3, 98, FE, FF, FF, FF, 1]
<< [90, 0]
Err NoSignature
>> [56, 2, 1, 1, 21, 8, 1, 11, 33, 0, 0, 0, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 0, 0, 0, 22, B, 8, 80, 92, B8, C3, 98, FE, FF, FF, FF, 1]
<< [EB, E3, 54, C8, 61, 85, 7F, 86, A, F9, DC, F6, 6, 72, 3F, 56, 48, EE, 60, 58, AF, 52, E5, 9A, AB, 7E, 7E, D1, 33, CB, 98, 9B, 25, A1, 5C, D2, 74, 79, 9D, DE, 5, 37, 57, F, 19, A6, F8, 7D, 2D, A9, 8E, 0, A2, 8, EB, 46, 57, B9, C1, C6,
C8, F6, 75, 3, 90, 0]
[
    235,
    227,
    84,
    200,

I've truncated the output of sign_many.

@adrianbrink
Copy link
Contributor Author

adrianbrink commented Feb 12, 2019

Individually the tests pass but together they fail. This is due to every test connecting to the Ledger.

We need to investigate why the Ledger application is not dropped correctly after each test returns and also how to properly close the connection with the Ledger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant