-
Notifications
You must be signed in to change notification settings - Fork 585
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
Adding RPI dtoverlay to check in configuration file #2058
Conversation
cc @pgrawehr This is one of the changes that might benefit from running the Arduino pipeline on demand. We should probably wait before merging this (or adding those changes here as well) in order to ensure that these changes aren't breaking the Arduino Board and compiler build. |
Basically a nice idea, but I have some reservations regarding stability. Text comparisons aren't really stable for things like this, and we wouldn't even know whether the configuration file is the one that was used during boot. What problem are you trying to solve? |
Main problem we're trying to solve is find a way to know in our test if a specific function is activated on the hardware. We know that one of the RPI do not have PWM but we don't know which one. And with a bit of a hack, still in the tests, we can add the potential missing string and reboot the board so next time the function will be activated. And if you think about it, it may help so we don't really need anyone to physically connect to the machines, adjust the config file. The other element is for people to know if a specific function is activated or not. And we may even build like what we want to do for the test the string they have to add in the config file.
In general, I agree, in this case, if you don't have those exact strings, it won't get activated.
On RPI, it's always the same by default. And for people who'll really have to use this, the chances they'll change the file is very very low! Now, as you've seen, you can as well specify a path to any file, so if you've changed it and still want to check, then you can. That's what I am using for the tests. We can as well add serial and few others btw. |
[Fact] | ||
public void CheckI2cConfig() | ||
{ | ||
board.ConfigurationFile = Path.Combine("ConfigFiles", "config.I2c.txt"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we also want to add actual tests for System.Device.Gpio.Tests? You could do similar test but use default path (make sure to add [Trait(...)]
attribute similar to what there already is for PWM/SPI/I2C tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a specific test that output the configuration. It will always pass, it's not intended to fail, just outputting the configuration. I guess it's a good compromise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can once merged find the best way to use it in the other tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, it would be good to use these in System.Device.Gpio.Tests - that would simplify diagnostics of CI failures
I think I will have to write specific tests to see what's activated because it's a bit of a chicken and egg then. If System.Device.Gpio.Tests depends on Board which depends back on System.Device.Gpio, not sure how that can work ;-) So I was more think of a simple test just outputting the results of the I2C activation, SPI, PWM. So we know if it's there or not. And if there, the result for the pins setup as well. Makes sense? |
Yea, but wouldn't we just fail anyway, because the corresponding
What about spaces and other white space in the strings? Wouldn't the settings still be valid? Or parameters in different order?
Yes, it's physically the same file. But it might have been changed without a reboot. So the current state of
|
We would. It's just that you can know if things are setup properly or not.
Spaces removed from beginning and trailing. They are not allowed in the middle of the string. The setup already take into consideration those. There maybe edge cases and I need to run few physical checks for some of those. The good news is that it's very strict all up. |
src/devices/Board/config.Spi.txt
Outdated
@@ -0,0 +1,2 @@ | |||
dtparam=spi=on" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a config.Spi.txt
also in the tests\ConfigFiles
folder. I think this one is a duplicate.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Thanks @Ellerbach |
Adding RPI dtoverlay to check in configuration file. This is complementary from the existing elements that will return the default pins and configurations.
Those extra functions will actually check that the /boot/config.txt file contains the proper activation and will return the actual pin setup based o this.
Microsoft Reviewers: Open in CodeFlow