Skip to content

Commit 09c48e4

Browse files
committed
Refactored names for MBED_HOSTTEST macros used in test case auto-detection
1 parent 6ecf8da commit 09c48e4

File tree

51 files changed

+259
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+259
-259
lines changed

libraries/tests/mbed/basic/main.cpp

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

33
int main() {
4-
TEST_TIMEOUT(20);
5-
TEST_HOSTTEST(default_auto);
6-
TEST_DESCRIPTION(Basic);
7-
TEST_START("MBED_A1");
8-
TEST_RESULT(true);
4+
MBED_HOSTTEST_TIMEOUT(20);
5+
MBED_HOSTTEST_SELECT(default_auto);
6+
MBED_HOSTTEST_DESCRIPTION(Basic);
7+
MBED_HOSTTEST_START("MBED_A1");
8+
MBED_HOSTTEST_RESULT(true);
99
}

libraries/tests/mbed/call_before_main/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ extern "C" void mbed_main() {
1010
}
1111

1212
int main() {
13-
TEST_TIMEOUT(20);
14-
TEST_HOSTTEST(default_auto);
15-
TEST_DESCRIPTION(Call function mbed_main before main);
16-
TEST_START("MBED_A21");
13+
MBED_HOSTTEST_TIMEOUT(20);
14+
MBED_HOSTTEST_SELECT(default_auto);
15+
MBED_HOSTTEST_DESCRIPTION(Call function mbed_main before main);
16+
MBED_HOSTTEST_START("MBED_A21");
1717

1818
printf("MBED: main() starts now!\r\n");
1919

20-
TEST_RESULT(mbed_main_called);
20+
MBED_HOSTTEST_RESULT(mbed_main_called);
2121
}

libraries/tests/mbed/cpp/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ Heap::hello
5454
Heap::destroy
5555
*******************/
5656
int main (void) {
57-
TEST_TIMEOUT(10);
58-
TEST_HOSTTEST(default_auto);
59-
TEST_DESCRIPTION(C++);
60-
TEST_START("MBED_12");
57+
MBED_HOSTTEST_TIMEOUT(10);
58+
MBED_HOSTTEST_SELECT(default_auto);
59+
MBED_HOSTTEST_DESCRIPTION(C++);
60+
MBED_HOSTTEST_START("MBED_12");
6161

6262
bool result = true;
6363
for (;;)
@@ -82,5 +82,5 @@ int main (void) {
8282
break;
8383
}
8484

85-
TEST_RESULT(result);
85+
MBED_HOSTTEST_RESULT(result);
8686
}

libraries/tests/mbed/detect/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
#include "test_env.h"
33

44
int main() {
5-
TEST_TIMEOUT(10);
6-
TEST_HOSTTEST(detect_auto);
7-
TEST_DESCRIPTION(Simple detect test);
8-
TEST_START("DTCT_1");
5+
MBED_HOSTTEST_TIMEOUT(10);
6+
MBED_HOSTTEST_SELECT(detect_auto);
7+
MBED_HOSTTEST_DESCRIPTION(Simple detect test);
8+
MBED_HOSTTEST_START("DTCT_1");
99

1010
notify_start();
1111
printf("MBED: Target '%s'\r\n", TEST_SUITE_TARGET_NAME);
1212
printf("MBED: Test ID '%s'\r\n", TEST_SUITE_TEST_ID);
1313
printf("MBED: UUID '%s'\r\n", TEST_SUITE_UUID);
14-
TEST_RESULT(true);
14+
MBED_HOSTTEST_RESULT(true);
1515
}

libraries/tests/mbed/dev_null/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ class DevNull : public Stream {
1717
DevNull null("null");
1818

1919
int main() {
20-
TEST_TIMEOUT(20);
21-
TEST_HOSTTEST(dev_null_auto);
22-
TEST_DESCRIPTION(stdout redirected to dev null);
23-
TEST_START("EXAMPLE_1");
20+
MBED_HOSTTEST_TIMEOUT(20);
21+
MBED_HOSTTEST_SELECT(dev_null_auto);
22+
MBED_HOSTTEST_DESCRIPTION(stdout redirected to dev null);
23+
MBED_HOSTTEST_START("EXAMPLE_1");
2424

2525
printf("MBED: re-routing stdout to /null\r\n");
2626
freopen("/null", "w", stdout);
2727
printf("MBED: printf redirected to /null\r\n"); // This shouldn't appear
2828
// If failure message can be seen test should fail :)
29-
TEST_RESULT(false); // This is 'false' on purpose
29+
MBED_HOSTTEST_RESULT(false); // This is 'false' on purpose
3030
}

libraries/tests/mbed/digitalin_digitalout/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ DigitalIn in(p25);
4242
#endif
4343

4444
int main() {
45-
TEST_TIMEOUT(10);
46-
TEST_HOSTTEST(default_auto);
47-
TEST_DESCRIPTION(DigitalIn DigitalOut);
48-
TEST_START("MBED_A5");
45+
MBED_HOSTTEST_TIMEOUT(10);
46+
MBED_HOSTTEST_SELECT(default_auto);
47+
MBED_HOSTTEST_DESCRIPTION(DigitalIn DigitalOut);
48+
MBED_HOSTTEST_START("MBED_A5");
4949

5050
out = 0;
5151
wait(0.1);
5252
if (in != 0) {
5353
printf("ERROR: in != 0\n");
54-
TEST_RESULT(false);
54+
MBED_HOSTTEST_RESULT(false);
5555
}
5656
out = 1;
5757
wait(0.1);
5858
if (in != 1) {
5959
printf("ERROR: in != 1\n");
60-
TEST_RESULT(false);
60+
MBED_HOSTTEST_RESULT(false);
6161
}
6262

63-
TEST_RESULT(true);
63+
MBED_HOSTTEST_RESULT(true);
6464
}

libraries/tests/mbed/digitalinout/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ DigitalInOut d2(p25);
4444

4545
int main()
4646
{
47-
TEST_TIMEOUT(10);
48-
TEST_HOSTTEST(default_auto);
49-
TEST_DESCRIPTION(DigitalInOut);
50-
TEST_START("MBED_A6");
47+
MBED_HOSTTEST_TIMEOUT(10);
48+
MBED_HOSTTEST_SELECT(default_auto);
49+
MBED_HOSTTEST_DESCRIPTION(DigitalInOut);
50+
MBED_HOSTTEST_START("MBED_A6");
5151

5252
bool check = true;
5353

@@ -81,5 +81,5 @@ int main()
8181
check = false;
8282
}
8383

84-
TEST_RESULT(check);
84+
MBED_HOSTTEST_RESULT(check);
8585
}

libraries/tests/mbed/div/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ const char *result_str(bool result) {
1717
}
1818

1919
int main() {
20-
TEST_TIMEOUT(20);
21-
TEST_HOSTTEST(default_auto);
22-
TEST_DESCRIPTION(Integer constant division);
23-
TEST_START("MBED_26");
20+
MBED_HOSTTEST_TIMEOUT(20);
21+
MBED_HOSTTEST_SELECT(default_auto);
22+
MBED_HOSTTEST_DESCRIPTION(Integer constant division);
23+
MBED_HOSTTEST_START("MBED_26");
2424

2525
bool result = true;
2626

@@ -40,5 +40,5 @@ int main() {
4040
printf("64bit: 0x17FFFFFFE8: expected 0x%lX got 0x%lX ... %s\r\n", values.first, test_ret, result_str(test_res));
4141
}
4242

43-
TEST_RESULT(result);
43+
MBED_HOSTTEST_RESULT(result);
4444
}

libraries/tests/mbed/echo/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ namespace {
1111
}
1212

1313
int main() {
14-
TEST_TIMEOUT(20);
15-
TEST_HOSTTEST(echo);
16-
TEST_DESCRIPTION(Serial Echo at 115200);
17-
TEST_START("MBED_A9");
14+
MBED_HOSTTEST_TIMEOUT(20);
15+
MBED_HOSTTEST_SELECT(echo);
16+
MBED_HOSTTEST_DESCRIPTION(Serial Echo at 115200);
17+
MBED_HOSTTEST_START("MBED_A9");
1818

1919
Serial pc(TXPIN, RXPIN);
2020
pc.baud(115200);

libraries/tests/mbed/env/test_env.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ void notify_test_id(const char *test_id);
2929
void notify_test_description(const char *description);
3030

3131
// Host test auto-detection API
32-
#define TEST_START(TESTID) notify_test_id(TESTID); notify_start()
33-
#define TEST_HOSTTEST(NAME) notify_host_test_name(#NAME)
34-
#define TEST_TIMEOUT(SECONDS) notify_timeout(SECONDS)
35-
#define TEST_DESCRIPTION(DESC) notify_test_description(#DESC)
36-
#define TEST_RESULT(RESULT) notify_completion(RESULT)
32+
#define MBED_HOSTTEST_START(TESTID) notify_test_id(TESTID); notify_start()
33+
#define MBED_HOSTTEST_SELECT(NAME) notify_host_test_name(#NAME)
34+
#define MBED_HOSTTEST_TIMEOUT(SECONDS) notify_timeout(SECONDS)
35+
#define MBED_HOSTTEST_DESCRIPTION(DESC) notify_test_description(#DESC)
36+
#define MBED_HOSTTEST_RESULT(RESULT) notify_completion(RESULT)
3737

3838
/**
3939
Test auto-detection preamble example:
4040
main() {
41-
TEST_TIMEOUT(10);
42-
TEST_HOSTTEST( host_test );
43-
TEST_DESCRIPTION(Hello World);
44-
TEST_START("MBED_10");
41+
MBED_HOSTTEST_TIMEOUT(10);
42+
MBED_HOSTTEST_SELECT( host_test );
43+
MBED_HOSTTEST_DESCRIPTION(Hello World);
44+
MBED_HOSTTEST_START("MBED_10");
4545
// Proper 'host_test.py' should take over supervising of this test
4646
4747
// Test code
4848
bool result = ...;
4949
50-
TEST_RESULT(result);
50+
MBED_HOSTTEST_RESULT(result);
5151
}
5252
*/
5353

libraries/tests/mbed/file/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ void test_close(FILE *f) {
4343
}
4444

4545
int main() {
46-
TEST_TIMEOUT(20);
47-
TEST_HOSTTEST(default_auto);
48-
TEST_DESCRIPTION(Semihost file system);
49-
TEST_START("MBED_A2");
46+
MBED_HOSTTEST_TIMEOUT(20);
47+
MBED_HOSTTEST_SELECT(default_auto);
48+
MBED_HOSTTEST_DESCRIPTION(Semihost file system);
49+
MBED_HOSTTEST_START("MBED_A2");
5050

5151
pc.printf("Test the Stream class\n");
5252

@@ -74,5 +74,5 @@ int main() {
7474
test_close(f);
7575

7676
// Check the two strings are equal
77-
TEST_RESULT((strncmp(buffer, str, str_len) == 0));
77+
MBED_HOSTTEST_RESULT((strncmp(buffer, str, str_len) == 0));
7878
}

libraries/tests/mbed/hello/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
int main()
44
{
5-
TEST_TIMEOUT(5);
6-
TEST_HOSTTEST(hello_auto);
7-
TEST_DESCRIPTION(Hello World);
8-
TEST_START("MBED_10");
5+
MBED_HOSTTEST_TIMEOUT(5);
6+
MBED_HOSTTEST_SELECT(hello_auto);
7+
MBED_HOSTTEST_DESCRIPTION(Hello World);
8+
MBED_HOSTTEST_START("MBED_10");
99

1010
printf("Hello World\r\n");
1111

libraries/tests/mbed/i2c_MMA8451Q/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ float calc_3d_vector_len(float x, float y, float z) {
2929
#define MEASURE_DEVIATION_TOLERANCE 0.025 // 2.5%
3030

3131
int main(void) {
32-
TEST_TIMEOUT(15);
33-
TEST_HOSTTEST(default_auto);
34-
TEST_DESCRIPTION(MMA8451Q accelerometer);
35-
TEST_START("KL25Z_5");
32+
MBED_HOSTTEST_TIMEOUT(15);
33+
MBED_HOSTTEST_SELECT(default_auto);
34+
MBED_HOSTTEST_DESCRIPTION(MMA8451Q accelerometer);
35+
MBED_HOSTTEST_START("KL25Z_5");
3636

3737
DigitalOut led(LED_GREEN);
3838
MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
@@ -52,5 +52,5 @@ int main(void) {
5252
wait(0.5);
5353
led = !led;
5454
}
55-
TEST_RESULT(result);
55+
MBED_HOSTTEST_RESULT(result);
5656
}

libraries/tests/mbed/i2c_TMP102/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ TMP102 temperature(p28, p27, 0x90);
3333
#endif
3434

3535
int main() {
36-
TEST_TIMEOUT(10);
37-
TEST_HOSTTEST(default_auto);
38-
TEST_DESCRIPTION(DigitalIn DigitalOut);
39-
TEST_START("MBED_A4");
36+
MBED_HOSTTEST_TIMEOUT(10);
37+
MBED_HOSTTEST_SELECT(default_auto);
38+
MBED_HOSTTEST_DESCRIPTION(DigitalIn DigitalOut);
39+
MBED_HOSTTEST_START("MBED_A4");
4040

4141
float t = temperature.read();
4242

4343
printf("TMP102: Temperature: %f\n\r", t);
4444
// In our test environment (ARM office) we should get a temperature within
4545
// the range ]15, 30[C
4646
bool result = (t > 15.0) && (t < 30.0);
47-
TEST_RESULT(result);
47+
MBED_HOSTTEST_RESULT(result);
4848
}

libraries/tests/mbed/i2c_eeprom/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ const int i2c_delay_us = 0;
7171
}
7272

7373
int main() {
74-
TEST_TIMEOUT(15);
75-
TEST_HOSTTEST(default_auto);
76-
TEST_DESCRIPTION(I2C EEPROM read write test);
77-
TEST_START("MBED_A19");
74+
MBED_HOSTTEST_TIMEOUT(15);
75+
MBED_HOSTTEST_SELECT(default_auto);
76+
MBED_HOSTTEST_DESCRIPTION(I2C EEPROM read write test);
77+
MBED_HOSTTEST_START("MBED_A19");
7878

7979
const int EEPROM_MEM_ADDR = 0xA0;
8080
const char MARK = 0x66;
@@ -147,5 +147,5 @@ int main() {
147147
printf("\tTotal failures: %d\r\n", fw + fr + fc);
148148
}
149149

150-
TEST_RESULT(result);
150+
MBED_HOSTTEST_RESULT(result);
151151
}

libraries/tests/mbed/i2c_eeprom_line/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ I2C i2c(p28, p27);
7676
#define PATTERN_MASK 0x66, ~0x66, 0x00, 0xFF, 0xA5, 0x5A, 0xF0, 0x0F
7777

7878
int main() {
79-
TEST_TIMEOUT(15);
80-
TEST_HOSTTEST(default_auto);
81-
TEST_DESCRIPTION(I2C EEPROM line read write test);
82-
TEST_START("MBED_A25");
79+
MBED_HOSTTEST_TIMEOUT(15);
80+
MBED_HOSTTEST_SELECT(default_auto);
81+
MBED_HOSTTEST_DESCRIPTION(I2C EEPROM line read write test);
82+
MBED_HOSTTEST_START("MBED_A25");
8383

8484
const int EEPROM_MEM_ADDR = 0xA0;
8585
bool result = true;
@@ -138,5 +138,5 @@ int main() {
138138
printf("EEPROM: Pattern match errors: %d/%d ... [%s]\r\n", pattern_errors, ntests, pattern_errors ? "FAIL" : "OK");
139139

140140
result = write_errors == 0 && read_errors == 0;
141-
TEST_RESULT(result);
141+
MBED_HOSTTEST_RESULT(result);
142142
}

libraries/tests/mbed/interruptin/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ void flipper() {
8787
}
8888

8989
int main() {
90-
TEST_TIMEOUT(15);
91-
TEST_HOSTTEST(default_auto);
92-
TEST_DESCRIPTION(InterruptIn);
93-
TEST_START("MBED_A7");
90+
MBED_HOSTTEST_TIMEOUT(15);
91+
MBED_HOSTTEST_SELECT(default_auto);
92+
MBED_HOSTTEST_DESCRIPTION(InterruptIn);
93+
MBED_HOSTTEST_START("MBED_A7");
9494

9595
IN_OUT_CLEAR;
9696
//Test falling edges first
@@ -100,7 +100,7 @@ int main() {
100100

101101
if(checks != 5) {
102102
printf("MBED: falling edges test failed: %d\r\n",checks);
103-
TEST_RESULT(false);
103+
MBED_HOSTTEST_RESULT(false);
104104
}
105105

106106
//Now test rising edges
@@ -110,7 +110,7 @@ int main() {
110110

111111
if (checks != 10) {
112112
printf("MBED: raising edges test failed: %d\r\n", checks);
113-
TEST_RESULT(false);
113+
MBED_HOSTTEST_RESULT(false);
114114
}
115115

116116
//Now test switch off edge detection
@@ -120,7 +120,7 @@ int main() {
120120

121121
if (checks != 10) {
122122
printf("MBED: edge detection switch off test failed: %d\r\n", checks);
123-
TEST_RESULT(false);
123+
MBED_HOSTTEST_RESULT(false);
124124
}
125125

126126
//Finally test both
@@ -130,8 +130,8 @@ int main() {
130130

131131
if (checks != 20) {
132132
printf("MBED: Simultaneous rising and falling edges failed: %d\r\n", checks);
133-
TEST_RESULT(false);
133+
MBED_HOSTTEST_RESULT(false);
134134
}
135135

136-
TEST_RESULT(true);
136+
MBED_HOSTTEST_RESULT(true);
137137
}

0 commit comments

Comments
 (0)