mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-22 04:53:50 +01:00
Merge pull request #20551 from derMihai/mir/test_at_all_config
tests/drivers/at_unit: fix unit tests on native
This commit is contained in:
commit
43f010c751
@ -7,6 +7,7 @@ rcv_eol_2=""
|
|||||||
send_eol=""
|
send_eol=""
|
||||||
|
|
||||||
run_test() {
|
run_test() {
|
||||||
|
echo "================================="
|
||||||
echo "Running test with:"
|
echo "Running test with:"
|
||||||
echo " URC handling = $handle_urc"
|
echo " URC handling = $handle_urc"
|
||||||
echo " echo = $echo"
|
echo " echo = $echo"
|
||||||
@ -14,12 +15,12 @@ run_test() {
|
|||||||
echo " rcv EOL 1 = $rcv_eol_1"
|
echo " rcv EOL 1 = $rcv_eol_1"
|
||||||
echo " rcv EOL 2 = $rcv_eol_2"
|
echo " rcv EOL 2 = $rcv_eol_2"
|
||||||
|
|
||||||
make -j --silent BOARD=native "HANDLE_URC=$handle_urc" "ECHO_ON=$echo" "SEND_EOL=\"$send_eol\"" "RECV_EOL_1=\"$rcv_eol_1\"" "RECV_EOL_2=\"$rcv_eol_2\"" tests-at
|
make -j --silent BOARD=native "HANDLE_URC=$handle_urc" "ECHO_ON=$echo" "SEND_EOL=\"$send_eol\"" "RECV_EOL_1=\"$rcv_eol_1\"" "RECV_EOL_2=\"$rcv_eol_2\""
|
||||||
|
|
||||||
# take /dev/ttyS0 as serial interface. It is only required s.t. UART
|
# take /dev/ttyS0 as serial interface. It is only required s.t. UART
|
||||||
# initialization succeeds and it gets turned off right away.
|
# initialization succeeds and it gets turned off right away.
|
||||||
set +e
|
set +e
|
||||||
if ! ./bin/native/tests_unittests.elf -c /dev/ttyS0 <<< "s\n";
|
if ! ./bin/native/tests_at_unit.elf -c /dev/ttyS0 <<< "s\n";
|
||||||
then
|
then
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo "Test failed! Generating compile-commands.json of the last build configuration..."
|
echo "Test failed! Generating compile-commands.json of the last build configuration..."
|
||||||
@ -33,11 +34,6 @@ run_test() {
|
|||||||
# set -x
|
# set -x
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRIPT=$(readlink -f "$0")
|
|
||||||
BASEDIR=$(dirname "$SCRIPT")/../../../unittests
|
|
||||||
|
|
||||||
cd "$BASEDIR"
|
|
||||||
|
|
||||||
for urc_i in 0 1; do
|
for urc_i in 0 1; do
|
||||||
handle_urc=$urc_i
|
handle_urc=$urc_i
|
||||||
for echo_i in 0 1; do
|
for echo_i in 0 1; do
|
||||||
@ -50,6 +50,13 @@ at_urc_t urc_short = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef BOARD_NATIVE
|
||||||
|
#define AT_UNIT_UART_DEV 0
|
||||||
|
#else
|
||||||
|
/* Most non-native boards have stdout mapped to device 0 */
|
||||||
|
#define AT_UNIT_UART_DEV 1
|
||||||
|
#endif
|
||||||
|
|
||||||
static void set_up(void)
|
static void set_up(void)
|
||||||
{
|
{
|
||||||
at_dev_init_t at_init_params = {
|
at_dev_init_t at_init_params = {
|
||||||
@ -58,7 +65,7 @@ static void set_up(void)
|
|||||||
.rp_buf_size = sizeof(rp_buf),
|
.rp_buf_size = sizeof(rp_buf),
|
||||||
.rx_buf = buf,
|
.rx_buf = buf,
|
||||||
.rx_buf_size = sizeof(buf),
|
.rx_buf_size = sizeof(buf),
|
||||||
.uart = UART_DEV(1),
|
.uart = UART_DEV(AT_UNIT_UART_DEV),
|
||||||
};
|
};
|
||||||
int res = at_dev_init(&at_dev, &at_init_params);
|
int res = at_dev_init(&at_dev, &at_init_params);
|
||||||
/* check the UART initialization return value and respond as needed */
|
/* check the UART initialization return value and respond as needed */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user