Skip to content
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

Closed
wants to merge 32 commits into from
Closed

Level testing #47

wants to merge 32 commits into from

Conversation

mray190
Copy link
Contributor

@mray190 mray190 commented Mar 27, 2017

Full refactor of how testing is done with the CI test shield. Details of each level found below:

  1. Bare Implementation - First stage of development.
  • Constructors / destructors
  • Assumptions
  • At least 1 of every peripheral possible implimented
  1. Basic Compliance - things actually start working.
  • Basic Read / Write operations for each API implimented
  • Single instance of each peripheral works
  • Timing of API measured to 10%
  1. mbed Enabled Compliance - required to be mbed enabled, this level must pass for it to be marked public
  • At least one of each peripheral is broken out to Arduino Hardware spec header
  • Full API implimented
  • Every pin available is tested with single instance
  • Multiple instances of each peripheral can be implimented at same time
  • peripherals work in interrupt context
  • Timing of API measured to 5%
  1. Corner Case Compliance - Goal level, not everyone will get here, sets goals for the best platforms to achieve
  • Edge / Corner case tests
  • Timing of API measured to 1%
  • Check for corner cases (really beat on the API hard)
  • Instantiate everything and test all at once

Full documentation can be found here: https://gist.github.com/BlackstoneEngineering/e3db036272daa2e5424076fbca8b9d43

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));
Copy link
Contributor

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?

Copy link
Contributor Author

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

@jeromecoutant
Copy link
Contributor

Hi
It seems that level0 tests are not related to ci-shield ?
So this part should/can be moved to mbed-os level ?

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);
Copy link
Contributor

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

Copy link
Contributor Author

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

@mray190
Copy link
Contributor Author

mray190 commented Mar 28, 2017

@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
Copy link
Collaborator

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?

Copy link
Contributor

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() {
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Contributor

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();

static bool check_size(Type pintype);
Copy link
Collaborator

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

Copy link
Contributor

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?

Copy link
Collaborator

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
Copy link
Collaborator

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

Copy link
Contributor

@BlackstoneEngineering BlackstoneEngineering Apr 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author Michael Ray
Copy link
Collaborator

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).

Copy link
Contributor

@BlackstoneEngineering BlackstoneEngineering Apr 4, 2017

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

Copy link
Collaborator

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).

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");
Copy link
Collaborator

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

int i = 0;
while(pinmap[i].pin != (PinName)NC) {
bool alreadyExists = false;
// printf("Pin %d\n", pinmap[i].pin);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug printf or removed?

// State: End case
// Pin was found, but execution had already occurred so queue up another test case
if (tag) {
TEST_ASSERT(true);
Copy link
Collaborator

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?

@0xc0170
Copy link
Collaborator

0xc0170 commented Apr 3, 2017

Any update?

@mray190
Copy link
Contributor Author

mray190 commented Apr 3, 2017

@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

@BlackstoneEngineering
Copy link
Contributor

Need to run these tests on boards that are known to have corner cases to verify that we are not missing something.
I reccomend

  • ST 401RE (has UART issue on D0/D1)
  • OnSemi board (does not have A4/5)
  • Silicon Labs board (Does not have arduino headers)
  • NRF52 DK - no particular reason, just want to see what happends
  • NRF51 EK - does not have Arduino Headers

@BlackstoneEngineering
Copy link
Contributor

@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::TestFramework() {
map_pins(PinMap_ADC, AnalogInput);
map_pins(PinMap_DAC, AnalogOutput);
Copy link
Contributor

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 ?

@jeromecoutant
Copy link
Contributor

Hi

What about small targets ?
I noticed, for example, that all Level0 tests need more than 200K of flash and 64K RAM

From ST point of view, check with NUCLEO_F070RB, NUCLEO_F072RB, NUCLEO_F103RB, NUCLEO_L073RZ, NUCLEO_F410RB

@BlackstoneEngineering
Copy link
Contributor

@jeromecoutant Noted on the small target issue. I will make sure we address this before these changes to mainline.

@jeromecoutant
Copy link
Contributor

Hi
Any updates ? :-)

@mray190
Copy link
Contributor Author

mray190 commented Jun 22, 2017

@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

brandonboesch and others added 15 commits June 28, 2017 13:03
…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
…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...
@jeromecoutant
Copy link
Contributor

Hi

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.

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),
Copy link
Contributor

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);
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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);
}
Copy link
Contributor

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

@0xc0170 0xc0170 dismissed their stale review July 17, 2017 09:32

Will rereview again

template <PinName ain_pin>
void AnalogInput_Test(){
AnalogIn ain(ain_pin);
DEBUG_PRINTF("Tested pin %d for Arduino analog in capabilities\n", ain_pin);
Copy link
Contributor

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

@jeromecoutant
Copy link
Contributor

@BlackstoneEngineering

Noted on the small target issue. I will make sure we address this before these changes to mainline.

Is it still valid ? (I can't test NUCLEO_F070RB for ex)

@mray190
Copy link
Contributor Author

mray190 commented Jul 17, 2017

@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.

@mray190 mray190 closed this Jul 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants