Skip to content

Commit 6279268

Browse files
committed
tests/drivers/at_unit: fix unit tests on native
1 parent 8bb8c5b commit 6279268

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tests/drivers/at/tests-with-config/test_all_configs.sh renamed to tests/drivers/at_unit/test_all_configs.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ rcv_eol_2=""
77
send_eol=""
88

99
run_test() {
10+
echo "================================="
1011
echo "Running test with:"
1112
echo " URC handling = $handle_urc"
1213
echo " echo = $echo"
1314
echo " send EOL = $send_eol"
1415
echo " rcv EOL 1 = $rcv_eol_1"
1516
echo " rcv EOL 2 = $rcv_eol_2"
1617

17-
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
18+
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\""
1819

1920
# take /dev/ttyS0 as serial interface. It is only required s.t. UART
2021
# initialization succeeds and it gets turned off right away.
2122
set +e
22-
if ! ./bin/native/tests_unittests.elf -c /dev/ttyS0 <<< "s\n";
23+
if ! ./bin/native/tests_at_unit.elf -c /dev/ttyS0 <<< "s\n";
2324
then
2425
echo "================================================================================"
2526
echo "Test failed! Generating compile-commands.json of the last build configuration..."
@@ -33,11 +34,6 @@ run_test() {
3334
# set -x
3435
set -e
3536

36-
SCRIPT=$(readlink -f "$0")
37-
BASEDIR=$(dirname "$SCRIPT")/../../../unittests
38-
39-
cd "$BASEDIR"
40-
4137
for urc_i in 0 1; do
4238
handle_urc=$urc_i
4339
for echo_i in 0 1; do

tests/drivers/at_unit/tests-at.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ at_urc_t urc_short = {
5050
};
5151
#endif
5252

53+
#ifdef BOARD_NATIVE
54+
#define AT_UNIT_UART_DEV 0
55+
#else
56+
/* Most non-native boards have stdout mapped to device 0 */
57+
#define AT_UNIT_UART_DEV 1
58+
#endif
59+
5360
static void set_up(void)
5461
{
5562
at_dev_init_t at_init_params = {
@@ -58,7 +65,7 @@ static void set_up(void)
5865
.rp_buf_size = sizeof(rp_buf),
5966
.rx_buf = buf,
6067
.rx_buf_size = sizeof(buf),
61-
.uart = UART_DEV(1),
68+
.uart = UART_DEV(AT_UNIT_UART_DEV),
6269
};
6370
int res = at_dev_init(&at_dev, &at_init_params);
6471
/* check the UART initialization return value and respond as needed */

0 commit comments

Comments
 (0)