Skip to content

Commit 2b8c9ef

Browse files
committed
Merge pull request #1578 from bridadan/add-not-supported-to-tests
Adding NOT_SUPPORTED errors to tests
2 parents dbb8326 + a36d49a commit 2b8c9ef

File tree

19 files changed

+89
-20
lines changed

19 files changed

+89
-20
lines changed

libraries/tests/mbed/analog/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#if !DEVICE_ANALOGIN
2+
#error [NOT_SUPPORTED] AnalogIn not supported
3+
#endif
4+
5+
#if !DEVICE_ANALOGOUT
6+
#error [NOT_SUPPORTED] AnalogOut not supported
7+
#endif
8+
19
#include "test_env.h"
210

311
#if defined(TARGET_K64F) | defined (TARGET_K22F)

libraries/tests/mbed/analog_pot/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_ANALOGIN
2+
#error [NOT_SUPPORTED] AnalogIn not supported
3+
#endif
4+
15
#include "mbed.h"
26
#include "test_env.h"
37

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

1620
bool result = false;
1721
float val1, val2;
18-
22+
1923
for (int i = 0; i < TEST_ITERATIONS; i++) {
2024
val1 = pot1.read();
2125
val2 = pot2.read();
22-
26+
2327
const char *succes_str = val1 > MEASURE_MIN || val2 > MEASURE_MIN ? "[OK]" : "[FAIL]";
2428
result = result || (val1 > MEASURE_MIN || val2 > MEASURE_MIN);
2529
printf("Pot values %f, %f\r\n", val1, val2);

libraries/tests/mbed/bus/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,26 @@ BusOut bus2(PB03, PB22, PB02, PB23);
1313
BusOut bus1(PA02, PA03, PA04, PA05, PA06, PA07, PA08, PA09, PA10, PA11, PA16, PA17);
1414
BusOut bus2(PB10, PB11, PB12, PB13);
1515

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

20+
#else
21+
#error [NOT_SUPPORTED] This test is not supported on this target
22+
2023
#endif
2124

2225
int i;
23-
26+
2427
int main()
2528
{
2629
notify_start();
27-
30+
2831
for (i=0; i<=65535; i++) {
2932
bus1 = i;
3033
bus2 = i;
3134
wait(0.0001);
3235
}
33-
36+
3437
notify_completion(true);
3538
}

libraries/tests/mbed/can/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_CAN
2+
#error [NOT_SUPPORTED] CAN not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
Ticker ticker;

libraries/tests/mbed/can_interrupt/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_CAN
2+
#error [NOT_SUPPORTED] CAN not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
Ticker ticker;

libraries/tests/mbed/can_loopback/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_CAN
2+
#error [NOT_SUPPORTED] CAN not supported
3+
#endif
4+
15
#include "mbed.h"
26
#include "test_env.h"
37

libraries/tests/mbed/dir/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_LOCALFILESYSTEM
2+
#error [NOT_SUPPORTED] LocalFileSystem not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
void led_blink(PinName led) {

libraries/tests/mbed/freopen/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_LOCALFILESYSTEM
2+
#error [NOT_SUPPORTED] LocalFileSystem not supported
3+
#endif
4+
15
#include "mbed.h"
26
#include "TextLCD.h"
37

libraries/tests/mbed/i2c_master/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_I2C
2+
#error [NOT_SUPPORTED] I2C is not supported
3+
#endif
4+
15
#include "mbed.h"
26
#include "test_env.h"
37

libraries/tests/mbed/i2c_slave/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_I2CSLAVE
2+
#error [NOT_SUPPORTED] I2C Slave is not supported
3+
#endif
4+
15
#include "mbed.h"
26
#include "test_env.h"
37

libraries/tests/mbed/interrupt_chaining/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#elif defined(TARGET_SAML21J18A)
1717
#define TIMER_IRQ TC0_IRQn
1818
#else
19-
#error This test can't run on this target.
19+
#error [NOT_SUPPORTED] This test can't run on this target.
2020
#endif
2121

2222
Serial pc(USBTX, USBRX);

libraries/tests/mbed/portout/main.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_PORTOUT
2+
#error [NOT_SUPPORTED] PortOut is not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
# if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) || defined(TARGET_LPC2460)
@@ -27,8 +31,8 @@
2731
# elif defined(TARGET_SAMR21G18A)
2832
# define LED_PORT PortA
2933
# define LED1 (1 << 19) /*PA19*/
30-
# define LED2 0
31-
# define LED3 0
34+
# define LED2 0
35+
# define LED3 0
3236
# define LED4 0
3337
# elif defined(TARGET_SAMD21J18A)
3438
# define LED_PORT PortB
@@ -48,7 +52,9 @@
4852
# define LED2 0
4953
# define LED3 0
5054
# define LED4 0
51-
# endif
55+
# else
56+
#error [NOT_SUPPORTED] This test can't be ran on this target
57+
#endif
5258

5359

5460
#define LED_MASK (LED1|LED2|LED3|LED4)

libraries/tests/mbed/pwm/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int main() {
4848
printf("Initialize PWM on pin 24 with duty cycle: %.2f\n", pwm_dp24.read());
4949
printf("Initialize PWM on pin 18 with duty cycle: %.2f\n", pwm_dp18.read());
5050

51-
#elif defined(TARGET_nRF51822)
51+
#elif defined(TARGET_NRF51822)
5252
PwmOut pwm_p24(p24);
5353
PwmOut pwm_p25(p25);
5454

@@ -100,7 +100,7 @@ int main() {
100100

101101
pwm_1.write(value);
102102
pwm_2.write(0.50);
103-
103+
104104
float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx
105105

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

113113
pwm_1.write(value);
114-
114+
115115
float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx
116116

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

123123
pwm_1.write(value);
124-
124+
125125
float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx
126126

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

133133
pwm_1.write(value);
134-
134+
135135
float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx
136136

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

143143
pwm_1.write(value);
144-
144+
145145
float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx
146146

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

153153
pwm_1.write(value);
154-
154+
155155
float result = floor(pwm_1.read() * 100 + 0.5) / 100; // round it to 0.xx
156156

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

178178
notify_completion(result == value ? true : false);
179179
#else
180-
#error This test is not supported on this target.
180+
#error [NOT_SUPPORTED] This test is not supported on this target.
181181
#endif
182182

183183
notify_completion(true);

libraries/tests/mbed/pwm_led/pwm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
#elif defined (TARGET_MAXWSNENV)
2727
#define TEST_LED LED_GREEN
2828

29-
#elif defined (TARGET_DISCO_F407VG)
29+
#elif defined (TARGET_DISCO_F407VG)
3030
#define TEST_LED LED1
3131

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

3535
#else
36-
#error This test is not supported on this target.
36+
#error [NOT_SUPPORTED] This test is not supported on this target
3737
#endif
3838

3939
PwmOut led(TEST_LED);

libraries/tests/mbed/reset/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_SEMIHOST
2+
#error [NOT_SUPPORTED] Semihost not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
Serial pc(USBTX, USBRX);

libraries/tests/mbed/spi/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "mbed.h"
22

3+
#if !DEVICE_SPI
4+
#error [NOT_SUPPORTED] SPI is not supported
5+
#endif
6+
37
#if defined(TARGET_SAMR21G18A)
48
SPI spi(PB22, PB02, PB23); // mosi, miso, sclk
59
DigitalOut latchpin(PB03);

libraries/tests/mbed/spi_master/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_SPI
2+
#error [NOT_SUPPORTED] SPI not supported
3+
#endif
4+
15
#include "mbed.h"
26
#include "test_env.h"
37

libraries/tests/mbed/spi_slave/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_SPISLAVE
2+
#error [NOT_SUPPORTED] SPI Slave not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
#if defined(TARGET_KL25Z)

libraries/tests/mbed/stdio_benchmark/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#if !DEVICE_LOCALFILESYSTEM
2+
#error [NOT_SUPPORTED] LocalFileSystem not supported
3+
#endif
4+
15
#include "mbed.h"
26

37
#define TEST_STDIO 0

0 commit comments

Comments
 (0)