mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/drivers/at_unit: fix unit tests on native
This commit is contained in:
parent
8bb8c5be20
commit
627926869f
@ -7,6 +7,7 @@ rcv_eol_2=""
|
||||
send_eol=""
|
||||
|
||||
run_test() {
|
||||
echo "================================="
|
||||
echo "Running test with:"
|
||||
echo " URC handling = $handle_urc"
|
||||
echo " echo = $echo"
|
||||
@ -14,12 +15,12 @@ run_test() {
|
||||
echo " rcv EOL 1 = $rcv_eol_1"
|
||||
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
|
||||
# initialization succeeds and it gets turned off right away.
|
||||
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
|
||||
echo "================================================================================"
|
||||
echo "Test failed! Generating compile-commands.json of the last build configuration..."
|
||||
@ -33,11 +34,6 @@ run_test() {
|
||||
# set -x
|
||||
set -e
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
BASEDIR=$(dirname "$SCRIPT")/../../../unittests
|
||||
|
||||
cd "$BASEDIR"
|
||||
|
||||
for urc_i in 0 1; do
|
||||
handle_urc=$urc_i
|
||||
for echo_i in 0 1; do
|
@ -50,6 +50,13 @@ at_urc_t urc_short = {
|
||||
};
|
||||
#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)
|
||||
{
|
||||
at_dev_init_t at_init_params = {
|
||||
@ -58,7 +65,7 @@ static void set_up(void)
|
||||
.rp_buf_size = sizeof(rp_buf),
|
||||
.rx_buf = 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);
|
||||
/* check the UART initialization return value and respond as needed */
|
||||
|
Loading…
Reference in New Issue
Block a user