gimli-rs / gimli

A library for reading and writing the DWARF debugging format
https://docs.rs/gimli/
Apache License 2.0
853 stars 108 forks source link

Exclude fixtures when publishing the crate #660

Closed afranchuk closed 1 year ago

afranchuk commented 1 year ago

If I understand correctly, the fixtures are all used in the integration tests. To reduce unnecessary files (especially for those of us who mirror/vendor third-party crates), it'd be nice if the fixtures (and maybe the tests/examples?) were excluded when publishing. I realize that e.g. excluding examples will not allow a user to run cargo install --examples -- gimli, but I think that's of fairly little use.

philipc commented 1 year ago

I've previously seen feedback that people want to be able to run the tests on the published crate. Is there a common stance in the rust community for including or excluding tests?

It may not be common, but I can imagine people wanting to run cargo install --example dwarfdump gimli.

afranchuk commented 1 year ago

Ah, if you've had that feedback then I don't see an alternative (aside from downloading the files, either automatically or manually). Though I would be curious why those who say that aren't happy with running tests from a checkout of the repository.

The only sentiment on the matter that I've seen is that when publishing to crates.io, those files are intended to only be for crates.io and package resolution (and notably those files will persist "forever").

bjorn3 commented 1 year ago

Crater runs tests for all crates published on crates.io.

glandium commented 1 year ago

How about moving the tests that need these fixtures in a separately published crate?

philipc commented 1 year ago

I think it's fine to exclude fixtures and the tests/benchmarks that need them (which is all of tests and benches currently).

I prefer not to exclude examples, but moving them to a separate crate is an option.

afranchuk commented 1 year ago

Are you willing to accept a PR for this change, or is it too organizational in nature (e.g. deciding crate names, choosing what code to move, etc)?

philipc commented 1 year ago

Is excluding fixtures enough to meet your immediate need?

For moving the examples, a similar thing was done for the object crate, so my default action would be to do the same thing here, but I'm open to suggestions for better ways to organise things. I think we should also start using object-testfiles for binaries for regression tests.

afranchuk commented 1 year ago

Yes, excluding fixtures will be sufficient (it cuts the crate size down ~45%).