-
Notifications
You must be signed in to change notification settings - Fork 36
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
Level testing #47
Level testing #47
Conversation
TestFramework.cpp
Outdated
pinout[CITS_AnalogInput].push_back(construct_pinmap(MBED_CONF_APP_AIN_4)); | ||
pinout[CITS_AnalogInput].push_back(construct_pinmap(MBED_CONF_APP_AIN_5)); | ||
pinout[CITS_AnalogOutput].push_back(construct_pinmap(MBED_CONF_APP_AOUT)); | ||
pinout[CITS_DigitalIO].push_back(construct_pinmap(MBED_CONF_APP_DIO_0)); |
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.
Hi
Note that for some platform, D0 and D1 are used for the debug serial channel...
So tests will be failed?
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.
Valid point. The D0/D1 lines of code don't actually do anything anyway because when I dynamically find digital pins to test, the D0/D1 pins aren't pulled into the list because they are associated with UART and not Digital or PWM pinmaps. Therefore when the dynamic pin list is cross referenced with the CI Test Shield pins, the MBED_CONF_APP_DIO0/1 pins won't be used. I will remove lines 64 and 65 anyway to remove confusion
Hi |
TESTS/Level2/Pwm/Pwm.cpp
Outdated
int main() { | ||
// Formulate a specification and run the tests based on the Case array | ||
Specification specification(TestFramework::test_setup<200>, cases); | ||
return !Harness::run(specification); |
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.
200 s seems not enough ?
For NUCLEO_L476RG, I need 300
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 can move to 300s. I tested with the K64F and Nucleo_F429ZI in which 200s was enough. Forgot that additional targets will have more PWMs which will increase the time
@jeromecoutant - there are still some things I have to review with @BlackstoneEngineering. This PR should stay in an open state until Austin has gone over it with me as he created the specifications |
@@ -1 +0,0 @@ | |||
https://developer.mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac |
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.
why is this being removed?
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.
It is being replaced by the more generic I2CEeprom.lib file. This new library also future proofs us and enables use of the File System API's.
Case("Arduino - Analog Output Constructor on AOUT_0", AnalogOutput_Test<MBED_CONF_APP_AOUT>, greentea_failure_handler), | ||
}; | ||
|
||
int main() { |
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.
fix formatting, also indentation
@@ -31,7 +31,7 @@ | |||
"PWM_1": "D5", | |||
"PWM_2": "D6", | |||
"PWM_3": "D9", | |||
"DEBUG_MSG": 0 | |||
"DEBUG_MSG": 1 |
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.
Debug messages on by default? I would expect to set them to 1 once something is failing.
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.
Correct, needs to have Debug Messages off by default.
TestFramework.hpp
Outdated
|
||
TestFramework(); | ||
|
||
static bool check_size(Type pintype); |
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.
Move doxy docs from .ccp file to .h file please
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.
@0xc0170 Is this standard practice? What is the rationale behind this?
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.
Yes, it is. The header file is for declarations, I believe it is stated in our coding standard. The header file provides a declaration, implementation follows it (not the other way around).
@@ -0,0 +1,42 @@ | |||
from mbed_host_tests import BaseHostTest |
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.
license header comment should be in each file
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.
+1
TESTS/Level3/SPI/SPI.cpp
Outdated
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* @author Michael Ray |
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.
why are you putting this info in the files? we got version control (git in our case) to hold that information. these will be soon left behind (out-dated).
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.
So it looks awesome on his resume. Also so we know who to ask / blame later? :-P
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.
It will be outdated soon, please remove it. we got version control. No one will touch this ever after editing the file (we don't do it automatically).
TESTS/Level3/Pwm/Pwm.cpp
Outdated
TEST_ASSERT_MESSAGE( std::abs(rc-fc) <= calculated_percent, "There was more than a specific variance in number of rise vs fall cycles"); | ||
TEST_ASSERT_MESSAGE( std::abs(waveform_count - rc) <= calculated_percent, "There was more than a specific variance in number of rise cycles seen and number expected."); | ||
TEST_ASSERT_MESSAGE( std::abs(waveform_count - fc) <= calculated_percent, "There was more than a specific variance in number of fall cycles seen and number expected."); | ||
// TEST_ASSERT_MESSAGE( std::abs(expectedTime - avgTime) <= calculated_percent,"Greater than a specific variance between expected and measured duty cycle"); |
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.
shall we remove all these dead code or provide a reason there why we are keeping it in the file?
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.
+1
TestFramework.cpp
Outdated
int i = 0; | ||
while(pinmap[i].pin != (PinName)NC) { | ||
bool alreadyExists = false; | ||
// printf("Pin %d\n", pinmap[i].pin); |
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.
debug printf or removed?
TestFramework.cpp
Outdated
// State: End case | ||
// Pin was found, but execution had already occurred so queue up another test case | ||
if (tag) { | ||
TEST_ASSERT(true); |
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.
whats the use for this assert?
Any update? |
@0xc0170 Made those changes but still have to discuss everything with @BlackstoneEngineering. This PR should stay in a 'Changes requested' state until everything has been approved by Austin. I will push those changes regardless |
Need to run these tests on boards that are known to have corner cases to verify that we are not missing something.
|
@andcor02 Can you also please review / be familiar with the proposed changes as you help maintain the HW and any changes should have you looped in on |
TestFramework.cpp
Outdated
**/ | ||
TestFramework::TestFramework() { | ||
map_pins(PinMap_ADC, AnalogInput); | ||
map_pins(PinMap_DAC, AnalogOutput); |
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.
You should add some capability test like
#if !DEVICE_ANALOGOUT
for each map_pins call ?
Hi What about small targets ? From ST point of view, check with NUCLEO_F070RB, NUCLEO_F072RB, NUCLEO_F103RB, NUCLEO_L073RZ, NUCLEO_F410RB |
@jeromecoutant Noted on the small target issue. I will make sure we address this before these changes to mainline. |
Hi |
@jeromecoutant - A lot of the code presented in this PR is a 'hack' around the current HAL setup. We are working with the mbed-os team to integrate some of this code into a library in mbed-OS HAL in a more efficient/cleaner way. Once the changes to mbed-os have been completed, I will refactor this PR to satisfy those changes |
…necessary TEST_ASSERT(true) from all tests
…light formatting corrections to TestFramework.cpp
…ins throughout the different test iterations
…ble pin assignments that a user could configure. Fixed typo found in SPI.cpp, construct_i2c->construct_spi. Added wait(0.1) to SPI.cpp so that the print statement can finish printing in the event of an error
Formatted code, removed TEST_ASSERT(true), fixed bugs, added comments
… USBRX check in Level0/AnalogIn as it was failing when running on the K22F. It was failing because one of its analogIn in pins is tied and already assigned to USBTX
…etting reassigned
…ey are already assigned to the USB_UART. I check here now instead of the individual tests since we should never be reassigning the USB_UART pins in any test
… DebugPrintf to Level1-AnalogIn. Uncommented line in constructor so that more spi pins get added to DIO map.
Cleaned up code, added more checks, updated mbed_app.json...
Hi
I don't see any mbed-os change ? :-) |
|
||
Case cases[] = { | ||
Case("Arduino - Digital IO Constructor on DIO_0", DigitalIO_Test<MBED_CONF_APP_DIO_0>, greentea_failure_handler), | ||
Case("Arduino - Digital IO Constructor on DIO_1", DigitalIO_Test<MBED_CONF_APP_DIO_1>, greentea_failure_handler), |
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.
Are you sure you want to test D0 and D1 as they are often used for printf ?
/////////////////////////////////////////////////////////////////////////////*/ | ||
TestFramework::TestFramework() { | ||
map_pins(PinMap_ADC, AnalogInput); | ||
map_pins(PinMap_DAC, AnalogOutput); |
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.
For targets which doesn't support DAC, this file doesn't compile.
Maybe we should add some #if DEVICE_ANALOGOUT for each line ?
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 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 will look into adding #ifdef guards for these calls.
// Formulate a specification and run the tests based on the Case array | ||
Specification specification(TestFramework::test_setup<200>, cases); | ||
return !Harness::run(specification); | ||
} |
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 don't think that level3 PWM test is working?
mbedgt: test suite 'tests-level3-pwm' ................................................................ OK in 17.67 sec
test case: 'Level 3 - PWM randomized' ........................................................ ERROR in 0.00 sec
template <PinName ain_pin> | ||
void AnalogInput_Test(){ | ||
AnalogIn ain(ain_pin); | ||
DEBUG_PRINTF("Tested pin %d for Arduino analog in capabilities\n", ain_pin); |
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.
Global comment: from my side, I would prefer a debug printf as %#x instead of %d for pin number
Is it still valid ? (I can't test NUCLEO_F070RB for ex) |
@jeromecoutant - All of these comments are great comments and we will incorporate the suggested changes. The functionality that this PR brings to the CI test shield won't be ready for a bit - the mbed-OS changes still need to occur, and some other changes need to happen before this can be mainlined. Closing the PR until the branch is ready again. |
Full refactor of how testing is done with the CI test shield. Details of each level found below:
Full documentation can be found here: https://gist.github.com/BlackstoneEngineering/e3db036272daa2e5424076fbca8b9d43