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

Run Cargo test failed in location #337

Closed
DaviRain-Su opened this issue Nov 30, 2021 · 9 comments
Closed

Run Cargo test failed in location #337

DaviRain-Su opened this issue Nov 30, 2021 · 9 comments

Comments

@DaviRain-Su
Copy link

warning: field is never read: `name`
   --> src/metadata.rs:139:5
    |
139 |     name: String,
    |     ^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: `subxt` (lib) generated 1 warning
warning: `subxt` (lib) generated 1 warning (1 duplicate)
   Compiling test-runtime v0.1.0 (/Users/davirain/workspace/subxt/test-runtime)
error: failed to run custom build command for `test-runtime v0.1.0 (/Users/davirain/workspace/subxt/test-runtime)`

Caused by:
  process didn't exit successfully: `/Users/davirain/workspace/subxt/target/debug/build/test-runtime-b00db37d3cd82e75/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'Cannot spawn substrate command 'substrate': No such file or directory (os error 2)', test-runtime/build.rs:50:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@jsdw
Copy link
Collaborator

jsdw commented Nov 30, 2021

In order to run the tests, you need to have a suitable substrate binary available on your PATH. It looks like that isn't the case here :)

@DaviRain-Su
Copy link
Author

In order to run the tests, you need to have a suitable substrate binary available on your PATH. It looks like that isn't the case here :)

I want to know if it is possible to use polkadot directly?

@jsdw
Copy link
Collaborator

jsdw commented Nov 30, 2021

I believe (as I've been experimenting with this today) that the latest polkadot binary you can grab is not quite as uptodate as the latest substrate binary we use for CI, and so at the moment you'd need to have a recent substrate binary (we use https://releases.parity.io/substrate/x86_64-debian:stretch/latest/substrate/substrate at the mo) to run the integration tests locally :)

@DaviRain-Su
Copy link
Author

sandly, my local use is an Apple computer

@jsdw
Copy link
Collaborator

jsdw commented Nov 30, 2021

Likewise; that shouldn't prevent you from installing Substrate :)

this guide (paying special attention to the macOS specific bits as needed) should get you going: https://docs.substrate.io/v3/getting-started/installation/

@DaviRain-Su
Copy link
Author

Likewise; that shouldn't prevent you from installing Substrate :)

this guide (paying special attention to the macOS specific bits as needed) should get you going: https://docs.substrate.io/v3/getting-started/installation/

This I know, you can't use the substrate binary provided by subxt itself directly, you need to manually compile it to mac os file format yourself.

btw, I encountered this problem and I wonder if you know exactly where the problem is ?

@jsdw
Copy link
Collaborator

jsdw commented Nov 30, 2021

I'm sorry, I don't quite follow!

The error reported in this issue is hit specifically in the test-runtime/build.rs script; it tries to spawn a substrate binary at that point to generate the subxt code. If that didn't exist, you'd hit the issue at runtime instead when each test attempted to spawn the same binary to run against.

To summarize; you must have a working (recent) substrate binary locally installed in order to run the integration tests.

@DaviRain-Su
Copy link
Author

I see what you mean, it has to be a substrate executable binary file. I have one more such mistake(https://github.com/DaviRain-Su/example-subxt) here I don't know, are you clear?
Related Questions: (#338)

@jsdw
Copy link
Collaborator

jsdw commented Nov 30, 2021

Yup, you got it!

I'll close this now, and we can comment on your other issue separately :)

@jsdw jsdw closed this as completed Nov 30, 2021
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

No branches or pull requests

2 participants