Skip to content

Adding NOT_SUPPORTED errors to tests #1578

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

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libraries/tests/mbed/analog/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#if !DEVICE_ANALOGIN
#error [NOT_SUPPORTED] AnalogIn not supported
#endif

#if !DEVICE_ANALOGOUT
#error [NOT_SUPPORTED] AnalogOut not supported
#endif

#include "test_env.h"

#if defined(TARGET_K64F) | defined (TARGET_K22F)
Expand Down
8 changes: 6 additions & 2 deletions libraries/tests/mbed/analog_pot/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_ANALOGIN
#error [NOT_SUPPORTED] AnalogIn not supported
#endif

#include "mbed.h"
#include "test_env.h"

Expand All @@ -15,11 +19,11 @@ int main(void) {

bool result = false;
float val1, val2;

for (int i = 0; i < TEST_ITERATIONS; i++) {
val1 = pot1.read();
val2 = pot2.read();

const char *succes_str = val1 > MEASURE_MIN || val2 > MEASURE_MIN ? "[OK]" : "[FAIL]";
result = result || (val1 > MEASURE_MIN || val2 > MEASURE_MIN);
printf("Pot values %f, %f\r\n", val1, val2);
Expand Down
11 changes: 7 additions & 4 deletions libraries/tests/mbed/bus/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,26 @@ BusOut bus2(PB03, PB22, PB02, PB23);
BusOut bus1(PA02, PA03, PA04, PA05, PA06, PA07, PA08, PA09, PA10, PA11, PA16, PA17);
BusOut bus2(PB10, PB11, PB12, PB13);

#else
#elif defined(TARGET_FF_ARDUINO)
BusOut bus1(D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15);
BusOut bus2(A5, A4, A3, A2, A1, A0);

#else
#error [NOT_SUPPORTED] This test is not supported on this target

#endif

int i;

int main()
{
notify_start();

for (i=0; i<=65535; i++) {
bus1 = i;
bus2 = i;
wait(0.0001);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

For the future, commit this as separate commit, any code style changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that, my editor is a little proactive

notify_completion(true);
}
4 changes: 4 additions & 0 deletions libraries/tests/mbed/can/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_CAN
#error [NOT_SUPPORTED] CAN not supported
#endif

#include "mbed.h"

Ticker ticker;
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/can_interrupt/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_CAN
#error [NOT_SUPPORTED] CAN not supported
#endif

#include "mbed.h"

Ticker ticker;
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/can_loopback/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_CAN
#error [NOT_SUPPORTED] CAN not supported
#endif

#include "mbed.h"
#include "test_env.h"

Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/dir/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_LOCALFILESYSTEM
#error [NOT_SUPPORTED] LocalFileSystem not supported
#endif

#include "mbed.h"

void led_blink(PinName led) {
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/freopen/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_LOCALFILESYSTEM
#error [NOT_SUPPORTED] LocalFileSystem not supported
#endif

#include "mbed.h"
#include "TextLCD.h"

Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/i2c_master/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_I2C
#error [NOT_SUPPORTED] I2C is not supported
#endif

#include "mbed.h"
#include "test_env.h"

Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/i2c_slave/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_I2CSLAVE
#error [NOT_SUPPORTED] I2C Slave is not supported
#endif

#include "mbed.h"
#include "test_env.h"

Expand Down
2 changes: 1 addition & 1 deletion libraries/tests/mbed/interrupt_chaining/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#elif defined(TARGET_SAML21J18A)
#define TIMER_IRQ TC0_IRQn
#else
#error This test can't run on this target.
#error [NOT_SUPPORTED] This test can't run on this target.
#endif

Serial pc(USBTX, USBRX);
Expand Down
12 changes: 9 additions & 3 deletions libraries/tests/mbed/portout/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_PORTOUT
#error [NOT_SUPPORTED] PortOut is not supported
#endif

#include "mbed.h"

# if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC2460)
Expand Down Expand Up @@ -27,8 +31,8 @@
# elif defined(TARGET_SAMR21G18A)
# define LED_PORT PortA
# define LED1 (1 << 19) /*PA19*/
# define LED2 0
# define LED3 0
# define LED2 0
# define LED3 0
# define LED4 0
# elif defined(TARGET_SAMD21J18A)
# define LED_PORT PortB
Expand All @@ -48,7 +52,9 @@
# define LED2 0
# define LED3 0
# define LED4 0
# endif
# else
#error [NOT_SUPPORTED] This test can't be ran on this target
#endif


#define LED_MASK (LED1|LED2|LED3|LED4)
Expand Down
16 changes: 8 additions & 8 deletions libraries/tests/mbed/pwm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int main() {
printf("Initialize PWM on pin 24 with duty cycle: %.2f\n", pwm_dp24.read());
printf("Initialize PWM on pin 18 with duty cycle: %.2f\n", pwm_dp18.read());

#elif defined(TARGET_nRF51822)
#elif defined(TARGET_NRF51822)
PwmOut pwm_p24(p24);
PwmOut pwm_p25(p25);

Expand Down Expand Up @@ -100,7 +100,7 @@ int main() {

pwm_1.write(value);
pwm_2.write(0.50);

float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx

printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result);
Expand All @@ -111,7 +111,7 @@ int main() {
PwmOut pwm_1(PA_0);

pwm_1.write(value);

float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx

printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result);
Expand All @@ -121,7 +121,7 @@ int main() {
PwmOut pwm_1(PA_0);

pwm_1.write(value);

float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx

printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result);
Expand All @@ -131,7 +131,7 @@ int main() {
PwmOut pwm_1(PA_0);

pwm_1.write(value);

float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx

printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result);
Expand All @@ -141,7 +141,7 @@ int main() {
PwmOut pwm_1(PA_0);

pwm_1.write(value);

float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx

printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result);
Expand All @@ -151,7 +151,7 @@ int main() {
PwmOut pwm_1(PA_0);

pwm_1.write(value);

float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx

printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result);
Expand All @@ -177,7 +177,7 @@ int main() {

notify_completion(result == value ? true : false);
#else
#error This test is not supported on this target.
#error [NOT_SUPPORTED] This test is not supported on this target.
#endif

notify_completion(true);
Expand Down
4 changes: 2 additions & 2 deletions libraries/tests/mbed/pwm_led/pwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
#elif defined (TARGET_MAXWSNENV)
#define TEST_LED LED_GREEN

#elif defined (TARGET_DISCO_F407VG)
#elif defined (TARGET_DISCO_F407VG)
#define TEST_LED LED1

#elif defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A) || defined(TARGET_SAMD21G18A) || defined(TARGET_SAML21J18A)
#define TEST_LED LED1

#else
#error This test is not supported on this target.
#error [NOT_SUPPORTED] This test is not supported on this target
#endif

PwmOut led(TEST_LED);
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/reset/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_SEMIHOST
#error [NOT_SUPPORTED] Semihost not supported
#endif

#include "mbed.h"

Serial pc(USBTX, USBRX);
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/spi/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "mbed.h"

#if !DEVICE_SPI
#error [NOT_SUPPORTED] SPI is not supported
#endif

#if defined(TARGET_SAMR21G18A)
SPI spi(PB22, PB02, PB23); // mosi, miso, sclk
DigitalOut latchpin(PB03);
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/spi_master/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_SPI
#error [NOT_SUPPORTED] SPI not supported
#endif

#include "mbed.h"
#include "test_env.h"

Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/spi_slave/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_SPISLAVE
#error [NOT_SUPPORTED] SPI Slave not supported
#endif

#include "mbed.h"

#if defined(TARGET_KL25Z)
Expand Down
4 changes: 4 additions & 0 deletions libraries/tests/mbed/stdio_benchmark/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#if !DEVICE_LOCALFILESYSTEM
#error [NOT_SUPPORTED] LocalFileSystem not supported
#endif

#include "mbed.h"

#define TEST_STDIO 0
Expand Down