Re: [libgpiod][PATCH V9 7/8] bindings: rust: Add tests for libgpiod crate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, November 9th, 2022 at 10:30, Bartosz Golaszewski <brgl@xxxxxxxx> wrote:


> On Mon, Nov 7, 2022 at 10:58 AM Viresh Kumar viresh.kumar@xxxxxxxxxx wrote:
> 
> > Add tests for the rust bindings, quite similar to the ones in cxx
> > bindings.
> > 
> > Signed-off-by: Viresh Kumar viresh.kumar@xxxxxxxxxx
> 
> 
> Without modifying udev rules on my system - is there a one-liner I
> could use to launch the tests? I guess using cargo as sudo is wrong
> but the executables are there so can I somehow run them all at once as
> if running `cargo test`?
> 
> Bartosz

For running doc tests setting the RUSTDOC env var to a shell script that runs rustdoc as sudo may work. You should probably unset it when using cargo doc though to prevent the generated documentation from being owned by root. For unit tests and integration tests you can set the CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER (adapt for the target triple of your system) env var to "sudo" to run just the tests as root using sudo, but keep cargo running as regular user. The runner env var also applies to cargo run and cargo bench. See [1] for some basic documentation.

[1] https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner

Cheers,
Björn




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux