Merge pull request #14704 from jeromecoutant/PR_TEST_PIN

Pin name tests update
pull/14760/head
Martin Kojtal 2021-06-09 16:37:51 +02:00 committed by GitHub
commit fa090ff05c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -124,9 +124,11 @@ void UART_test()
{
utest_printf("UART TX Pin 0x%x RX Pin 0x%x\n", TX_pin, RX_pin);
// 1. check if Arduino_uno pins are not already used by the console
TEST_SKIP_UNLESS_MESSAGE(TX_pin != CONSOLE_TX, "ARDUINO_UNO_UART pin shared with CONSOLE_TX");
TEST_SKIP_UNLESS_MESSAGE(RX_pin != CONSOLE_RX, "ARDUINO_UNO_UART pin shared with CONSOLE_RX");
// 2. check if Arduino_uno pins are part of pinmap table
{
const PinMap *maps = serial_tx_pinmap();
while (maps->pin != (PinName)NC) { // check each pin from PinMap table till NC pin
@ -151,8 +153,14 @@ void UART_test()
TEST_ASSERT_NOT_EQUAL(NC, maps->pin);
}
// 3. check if Arduino_uno pins are not using the same UART instance as console
int console_uart = pinmap_peripheral(CONSOLE_TX, serial_tx_pinmap());
TEST_ASSERT_NOT_EQUAL(console_uart, pinmap_peripheral(TX_pin, serial_tx_pinmap()));
// 4. check if UART pins can be initialized
BufferedSerial TEST(TX_pin, RX_pin);
// Basic API call
// 5. check a basic API call
TEST.set_baud(115200);
}

View File

@ -26,7 +26,6 @@ Requirements specified in docs/design-documents/hal/0004-pin-names-general-guide
#ifndef LED1
#error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Skipped
// #error [NOT_SUPPORTED] Target is not following mbed-os pin names standard // Test is set as Error
#else
using namespace utest::v1;
@ -82,6 +81,9 @@ Case cases[] = {
#ifdef BUTTON2
Case("BUTTON2", BUTTON_test<2, BUTTON2>),
#endif
#ifdef BUTTON3
Case("BUTTON3", BUTTON_test<3, BUTTON3>),
#endif
};
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)