Re: [PATCH V7 7/8] libgpiod: Add rust tests

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

 



On Mon, Oct 17, 2022 at 09:00:43PM +0800, Kent Gibson wrote:
> On Fri, Oct 14, 2022 at 04:17:24PM +0530, Viresh Kumar wrote:
> > Add tests for the rust bindings, quite similar to the ones in cxx
> > bindings.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> > ---
> 
> <snip>
> > +
> > +        #[test]
> > +        fn clock() {
> 
> My preference would be event_clock(), but I can live with clock().
> 
> > +            let mut config = TestConfig::new(NGPIO).unwrap();
> > +            config.lconfig_add_settings(&[0]);
> > +            config.request_lines().unwrap();
> > +            let info = config.chip().line_info(0).unwrap();
> > +            assert_eq!(info.event_clock().unwrap(), EventClock::Monotonic);
> > +
> > +            let mut config = TestConfig::new(NGPIO).unwrap();
> > +            config.lconfig_clock(EventClock::Monotonic);
> > +            config.lconfig_add_settings(&[0]);
> > +            config.request_lines().unwrap();
> > +            let info = config.chip().line_info(0).unwrap();
> > +            assert_eq!(info.event_clock().unwrap(), EventClock::Monotonic);
> > +
> > +            let mut config = TestConfig::new(NGPIO).unwrap();
> > +            config.lconfig_clock(EventClock::Realtime);
> > +            config.lconfig_add_settings(&[0]);
> > +            config.request_lines().unwrap();
> > +            let info = config.chip().line_info(0).unwrap();
> > +            assert_eq!(info.event_clock().unwrap(), EventClock::Realtime);
> > +
> > +            let mut config = TestConfig::new(NGPIO).unwrap();
> > +            config.lconfig_clock(EventClock::HTE);
> > +            config.lconfig_add_settings(&[0]);
> > +            config.request_lines().unwrap();
> > +            let info = config.chip().line_info(0).unwrap();
> > +            assert_eq!(info.event_clock().unwrap(), EventClock::HTE);
> 
> I was surprised to find HTE tests passing on a kernel without CONFIG_HTE.
> I take that as being a kernel bug (GPIO_V2_LINE_VALID_FLAGS includes the
> HTE flag unconditionally - which is wrong IMHO).
> 

Bah, I was running an old-ish kernel (5.19) in my test setup.

A check for this was added in my HTE tidy up -
commit 272ddba0047 "gpiolib: cdev: compile out HTE unless CONFIG_HTE selected"

So the HTE tests now do fail with a more recent kernel (6.0+) - unless you
have HTE support.

Cheers,
Kent.

> You probably shouldn't assume HTE works - unless you have a system that
> supports HTE.
> 
> Other than that the tests look good to me, though as with the Python
> bindings I've only skimmed them.
> 
> Cheers,
> Kent.



[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