-
Notifications
You must be signed in to change notification settings - Fork 33
Level testing #47
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
Closed
Closed
Level testing #47
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
23db630
Initial setup of mbed level testing
mray190 9c786c8
Working version of dynamic pin testing for L0
mray190 80d2c56
Working state machine for L1/L2 tests
mray190 ca78d45
Failing analog out
mray190 567634c
Working L0-L2 for AnalogIn/Out - intended as the starting framework
mray190 3d4b143
DigitalIO framework setup
mray190 9be016f
Added PWM and DigitalIO tests
mray190 dac97ca
Added I2C and SPI base tests
mray190 e49460f
Finished Level0 tests
mray190 a135774
Added arduino tests
mray190 401ea3f
Additional Level1 and Level2 tests added
mray190 e98b4c8
Merged master into level-testing branch for I2C and SPI changes
mray190 64e3bdc
Halfway through porting over to final version
mray190 786ad08
Final commit for up to level 2
mray190 6f6a274
Finished Level 3 tests
mray190 62b43d9
Made changes outlined in pull request #47
mray190 8e1904d
Update mbed_app.json
mray190 6b956e6
Formated code so that it is uniform between all the tests. Removed un…
4846b7b
Removed unused ANSI_COLOR_<COLOR NAME> defs from TestFramework.hpp
d093ddc
Changed BusInOut so that it creates a bus of 16 pins instead of 15. S…
d15893d
Changed tag from unnecessary int to a bool instead. Updated some comm…
df47ace
Fixed some bugs in TestFramework::run_spi. SPI_CS was not switching …
c9f75d4
Added greater coverage for level0/SPI testing. It now tests all poss…
0015759
Merge pull request #1 from brandonboesch/level-testing
mray190 169500e
Cleaned up SPI code in TestFramework to make it easier to read and fo…
c7ca382
Added K22F to mbed_app.json. Formated Level1/AnalogIn. Added USBTX &&…
f3c379a
Added check to prevent pins already assigned to USBTX && USBRX from g…
285d385
Modified TestFramework::map_pins so that it no longer adds pins if th…
3053b8d
Condensed code in TestFramework for level1 testing
9919bb1
Removed wait() from Level0-spi test, and changed timeout value. Added…
cdf9af1
Merge pull request #2 from brandonboesch/level-testing
mray190 974b776
Merge branch 'master' into level-testing
mray190 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright (c) 2016 ARM Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| #if !DEVICE_ANALOGIN | ||
| #error [NOT_SUPPORTED] AnalogIn not supported on this platform, add 'DEVICE_ANALOGIN' definition to your platform. | ||
| #endif | ||
|
|
||
| #include "mbed.h" | ||
| #include "greentea-client/test_env.h" | ||
| #include "unity.h" | ||
| #include "utest.h" | ||
| #include "ci_test_config.h" | ||
|
|
||
| using namespace utest::v1; | ||
|
|
||
| // Template to set one Analog pin as input and then cycle through the rest as outputs. | ||
| // As you turn more pins on the voltage on the ain pin will go up. | ||
| template <PinName ain_pin> | ||
| void AnalogInput_Test(){ | ||
| AnalogIn ain(ain_pin); | ||
| DEBUG_PRINTF("Tested pin %d for Arduino analog in capabilities\n", ain_pin); | ||
| } | ||
|
|
||
| utest::v1::status_t test_setup(const size_t number_of_cases) { | ||
| GREENTEA_SETUP(30, "default_auto"); | ||
| return verbose_test_setup_handler(number_of_cases); | ||
| } | ||
|
|
||
| utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
| greentea_case_failure_abort_handler(source, reason); | ||
| return STATUS_ABORT; | ||
| } | ||
|
|
||
| Case cases[] = { | ||
| Case("Arduino - Analog Input Constructor on AIN_0", AnalogInput_Test<MBED_CONF_APP_AIN_0>, greentea_failure_handler), | ||
| Case("Arduino - Analog Input Constructor on AIN_1", AnalogInput_Test<MBED_CONF_APP_AIN_1>, greentea_failure_handler), | ||
| Case("Arduino - Analog Input Constructor on AIN_2", AnalogInput_Test<MBED_CONF_APP_AIN_2>, greentea_failure_handler), | ||
| Case("Arduino - Analog Input Constructor on AIN_3", AnalogInput_Test<MBED_CONF_APP_AIN_3>, greentea_failure_handler), | ||
| Case("Arduino - Analog Input Constructor on AIN_4", AnalogInput_Test<MBED_CONF_APP_AIN_4>, greentea_failure_handler), | ||
| Case("Arduino - Analog Input Constructor on AIN_5", AnalogInput_Test<MBED_CONF_APP_AIN_5>, greentea_failure_handler), | ||
| }; | ||
|
|
||
| int main() { | ||
| // Formulate a specification and run the tests based on the Case array | ||
| Specification specification(test_setup, cases); | ||
| return !Harness::run(specification); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright (c) 2016 ARM Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| #if !DEVICE_ANALOGOUT | ||
| #error [NOT_SUPPORTED] AnalogOut not supported on this platform, add 'DEVICE_ANALOGOUT' definition to your platform. | ||
| #endif | ||
|
|
||
| #include "mbed.h" | ||
| #include "greentea-client/test_env.h" | ||
| #include "unity.h" | ||
| #include "utest.h" | ||
| #include "ci_test_config.h" | ||
|
|
||
| using namespace utest::v1; | ||
|
|
||
| template <PinName aout_pin> | ||
| void AnalogOutput_Test(){ | ||
| AnalogOut ain(aout_pin); | ||
| DEBUG_PRINTF("Tested pin %d for Arduino analog out capabilities\n", aout_pin); | ||
| } | ||
|
|
||
| utest::v1::status_t test_setup(const size_t number_of_cases) { | ||
| GREENTEA_SETUP(30, "default_auto"); | ||
| return verbose_test_setup_handler(number_of_cases); | ||
| } | ||
|
|
||
| utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
| greentea_case_failure_abort_handler(source, reason); | ||
| return STATUS_ABORT; | ||
| } | ||
|
|
||
| Case cases[] = { | ||
| Case("Arduino - Analog Output Constructor on AOUT_0", AnalogOutput_Test<MBED_CONF_APP_AOUT>, greentea_failure_handler), | ||
| }; | ||
|
|
||
| int main() { | ||
| // Formulate a specification and run the tests based on the Case array | ||
| Specification specification(test_setup, cases); | ||
| return !Harness::run(specification); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright (c) 2016 ARM Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "mbed.h" | ||
| #include "greentea-client/test_env.h" | ||
| #include "unity.h" | ||
| #include "utest.h" | ||
| #include "ci_test_config.h" | ||
|
|
||
| using namespace utest::v1; | ||
|
|
||
| template <PinName dio_pin> | ||
| void DigitalIO_Test(){ | ||
| DigitalOut dout(dio_pin); | ||
| DigitalIn din(dio_pin); | ||
| DEBUG_PRINTF("Tested pin %d for Arduino digital in/out capabilities\n", dio_pin); | ||
| } | ||
|
|
||
| utest::v1::status_t test_setup(const size_t number_of_cases) { | ||
| GREENTEA_SETUP(30, "default_auto"); | ||
| return verbose_test_setup_handler(number_of_cases); | ||
| } | ||
|
|
||
| utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
| greentea_case_failure_abort_handler(source, reason); | ||
| return STATUS_ABORT; | ||
| } | ||
|
|
||
| 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), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ? |
||
| Case("Arduino - Digital IO Constructor on DIO_2", DigitalIO_Test<MBED_CONF_APP_DIO_2>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_3", DigitalIO_Test<MBED_CONF_APP_DIO_3>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_4", DigitalIO_Test<MBED_CONF_APP_DIO_4>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_5", DigitalIO_Test<MBED_CONF_APP_DIO_5>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_6", DigitalIO_Test<MBED_CONF_APP_DIO_6>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_7", DigitalIO_Test<MBED_CONF_APP_DIO_7>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_8", DigitalIO_Test<MBED_CONF_APP_DIO_8>, greentea_failure_handler), | ||
| Case("Arduino - Digital IO Constructor on DIO_9", DigitalIO_Test<MBED_CONF_APP_DIO_9>, greentea_failure_handler), | ||
| }; | ||
|
|
||
| int main() { | ||
| // Formulate a specification and run the tests based on the Case array | ||
| Specification specification(test_setup, cases); | ||
| return !Harness::run(specification); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright (c) 2016 ARM Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| #if !DEVICE_I2C | ||
| #error [NOT_SUPPORTED] I2C not supported on this platform, add 'DEVICE_I2C' definition to your platform. | ||
| #endif | ||
|
|
||
| #include "mbed.h" | ||
| #include "greentea-client/test_env.h" | ||
| #include "unity.h" | ||
| #include "utest.h" | ||
| #include "ci_test_config.h" | ||
|
|
||
| using namespace utest::v1; | ||
|
|
||
| template <PinName sda, PinName scl> | ||
| void I2C_Test(){ | ||
| I2C i2c(sda, scl); | ||
| DEBUG_PRINTF("Tested sda pin %d and scl pin %d for Arduino I2C capabilities\n", sda, scl); | ||
| } | ||
|
|
||
| utest::v1::status_t test_setup(const size_t number_of_cases) { | ||
| GREENTEA_SETUP(30, "default_auto"); | ||
| return verbose_test_setup_handler(number_of_cases); | ||
| } | ||
|
|
||
| utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
| greentea_case_failure_abort_handler(source, reason); | ||
| return STATUS_ABORT; | ||
| } | ||
|
|
||
| Case cases[] = { | ||
| Case("Arduino - I2C Constructor on I2C_SDA/I2C_SCL", I2C_Test<MBED_CONF_APP_I2C_SDA, MBED_CONF_APP_I2C_SCL>, greentea_failure_handler), | ||
| }; | ||
|
|
||
| int main() { | ||
| // Formulate a specification and run the tests based on the Case array | ||
| Specification specification(test_setup, cases); | ||
| return !Harness::run(specification); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Copyright (c) 2016 ARM Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| #if !DEVICE_PWMOUT | ||
| #error [NOT_SUPPORTED] PWMOUT not supported on this platform, add 'DEVICE_PWMOUT' definition to your platform. | ||
| #endif | ||
|
|
||
| #include "mbed.h" | ||
| #include "greentea-client/test_env.h" | ||
| #include "unity.h" | ||
| #include "utest.h" | ||
| #include "ci_test_config.h" | ||
|
|
||
| using namespace utest::v1; | ||
|
|
||
| template <PinName pwm_pin> | ||
| void PWM_Test(){ | ||
| PwmOut pwm(pwm_pin); | ||
| DEBUG_PRINTF("Tested pin %d for Arduino digital in/out capabilities\n", pwm_pin); | ||
| } | ||
|
|
||
| utest::v1::status_t test_setup(const size_t number_of_cases) { | ||
| GREENTEA_SETUP(30, "default_auto"); | ||
| return verbose_test_setup_handler(number_of_cases); | ||
| } | ||
|
|
||
| utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
| greentea_case_failure_abort_handler(source, reason); | ||
| return STATUS_ABORT; | ||
| } | ||
|
|
||
| Case cases[] = { | ||
| Case("Arduino - PWM Constructor on PWM_0", PWM_Test<MBED_CONF_APP_PWM_0>, greentea_failure_handler), | ||
| Case("Arduino - PWM Constructor on PWM_1", PWM_Test<MBED_CONF_APP_PWM_1>, greentea_failure_handler), | ||
| Case("Arduino - PWM Constructor on PWM_2", PWM_Test<MBED_CONF_APP_PWM_2>, greentea_failure_handler), | ||
| Case("Arduino - PWM Constructor on PWM_3", PWM_Test<MBED_CONF_APP_PWM_3>, greentea_failure_handler), | ||
| }; | ||
|
|
||
| int main() { | ||
| // Formulate a specification and run the tests based on the Case array | ||
| Specification specification(test_setup, cases); | ||
| return !Harness::run(specification); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Copyright (c) 2016 ARM Limited | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| // check if SPI is supported on this device | ||
| #if !DEVICE_SPI | ||
| #error SPI is not supported on this platform, add 'DEVICE_SPI' definition to your platform. | ||
| #endif | ||
|
|
||
| #include "mbed.h" | ||
| #include "greentea-client/test_env.h" | ||
| #include "unity.h" | ||
| #include "utest.h" | ||
| #include "ci_test_config.h" | ||
|
|
||
| using namespace utest::v1; | ||
|
|
||
| template <PinName mosi_pin, PinName miso_pin, PinName clk_pin, PinName cs_pin> | ||
| void SPI_Test(){ | ||
| SPI(mosi_pin, miso_pin, clk_pin); | ||
| DigitalOut cs(cs_pin); | ||
| DEBUG_PRINTF("Tested pins %d, %d, %d, and %d for Arduino SPI capabilities\n", mosi_pin, miso_pin, clk_pin, cs_pin); | ||
| } | ||
|
|
||
| utest::v1::status_t test_setup(const size_t number_of_cases) { | ||
| GREENTEA_SETUP(30, "default_auto"); | ||
| return verbose_test_setup_handler(number_of_cases); | ||
| } | ||
|
|
||
| utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
| greentea_case_failure_abort_handler(source, reason); | ||
| return STATUS_ABORT; | ||
| } | ||
|
|
||
| Case cases[] = { | ||
| Case("Arduino - SPI Constructor", SPI_Test<MBED_CONF_APP_SPI_MOSI, MBED_CONF_APP_SPI_MISO, MBED_CONF_APP_SPI_CLK, MBED_CONF_APP_SPI_CS>, greentea_failure_handler), | ||
| }; | ||
|
|
||
| int main() { | ||
| // Formulate a specification and run the tests based on the Case array | ||
| Specification specification(test_setup, cases); | ||
| return !Harness::run(specification); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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