Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile.include: fix override headers from application #20744

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ ifneq (,$(IOTLAB_NODE))
endif

# Add standard include directories
INCLUDES += -I$(APPDIR)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! I have falling into this pitfall numerous times when I needed to quickly test something, but never really traced it down but instead did a quick-and-dirty hack of the system header instead.

I'm glad that next time I need to quickly test something, I won't fall into that pitfall again ❤️

INCLUDES += -I$(RIOTBASE)/core/lib/include
INCLUDES += -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTBASE)/drivers/include
Expand Down
30 changes: 0 additions & 30 deletions tests/core/irq_cpp/irq.h

This file was deleted.

15 changes: 12 additions & 3 deletions tests/core/irq_cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@
* @author Jens Wetterich <[email protected]>
*/

#include <stdbool.h>

/* prevent the inclusion of irq.h on irq.hpp */
#define IRQ_H
unsigned irq_disable(void);
unsigned irq_enable(void);
bool irq_is_enabled(void);
bool irq_is_in(void);
void irq_restore(unsigned state);

#define FFF_ARG_HISTORY_LEN 1u
#define FFF_CALL_HISTORY_LEN 1u
#include "cppunit.hpp"
#include "fff.h"
#include "irq.h"
#include "irq.hpp"
DEFINE_FFF_GLOBALS

FAKE_VALUE_FUNC(unsigned, irq_disable)
FAKE_VALUE_FUNC(unsigned, irq_enable)
FAKE_VALUE_FUNC(int, irq_is_enabled)
FAKE_VALUE_FUNC(int, irq_is_in)
FAKE_VALUE_FUNC(bool, irq_is_enabled)
FAKE_VALUE_FUNC(bool, irq_is_in)
FAKE_VOID_FUNC(irq_restore, unsigned)

class irq_suite : public riot::testing::test_suite {
Expand Down
2 changes: 1 addition & 1 deletion tests/net/ieee802154_hal/init_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "assert.h"
#include "kernel_defines.h"
#include "net/ieee802154/radio.h"
#include "common.h"
#include "test_common.h"
#include "bhp/event.h"

#ifdef MODULE_CC2538_RF
Expand Down Expand Up @@ -93,7 +93,7 @@
if ((radio = cb(IEEE802154_DEV_TYPE_KW2XRF, opaque)) ){
for (unsigned i = 0; i < KW2XRF_NUM; i++) {
const kw2xrf_params_t *p = &kw2xrf_params[i];
bhp_event_init(&kw2xrf_bhp[i], EVENT_PRIO_HIGHEST, &kw2xrf_radio_hal_irq_handler, radio);

Check warning on line 96 in tests/net/ieee802154_hal/init_devs.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
kw2xrf_init(&kw2xrf_dev[i], p, radio, bhp_event_isr_cb, &kw2xrf_bhp[i]);
break;
}
Expand All @@ -112,7 +112,7 @@
if ((radio = cb(IEEE802154_DEV_TYPE_MRF24J40, opaque)) ){
for (unsigned i = 0; i < MRF24J40_NUM; i++) {
const mrf24j40_params_t *p = &mrf24j40_params[i];
bhp_event_init(&mrf24j40_bhp[i], EVENT_PRIO_HIGHEST, &mrf24j40_radio_irq_handler, radio);

Check warning on line 115 in tests/net/ieee802154_hal/init_devs.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
mrf24j40_init(&mrf24j40_dev[i], p, radio, bhp_event_isr_cb, &mrf24j40_bhp[i]);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/net/ieee802154_hal/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdio.h>
#include <strings.h>

#include "common.h"
#include "test_common.h"
#include "errno.h"
#include "event/thread.h"
#include "luid.h"
Expand Down Expand Up @@ -157,7 +157,7 @@
static void _hal_radio_cb(ieee802154_dev_t *dev, ieee802154_trx_ev_t status)
{
(void) dev;
switch(status) {

Check warning on line 160 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'switch' not followed by a single space
case IEEE802154_RADIO_CONFIRM_TX_DONE:
case IEEE802154_RADIO_CONFIRM_CCA:
mutex_unlock(&lock);
Expand All @@ -182,7 +182,7 @@
expect(ieee802154_radio_confirm_transmit(&_radio, &tx_info) >= 0);

ieee802154_radio_set_rx(&_radio);
if (!ieee802154_radio_has_irq_ack_timeout(&_radio) && !ieee802154_radio_has_frame_retrans(&_radio)) {

Check warning on line 185 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
/* This is just to show how the MAC layer would handle ACKs... */
xtimer_set(&timer_ack, ACK_TIMEOUT_TIME);
}
Expand Down Expand Up @@ -227,7 +227,7 @@
ieee802154_radio_write(&_radio, pkt);

/* Block until the radio confirms the state change */
while(ieee802154_radio_confirm_set_idle(&_radio) == -EAGAIN);

Check warning on line 230 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

full block {} expected in the control structure

Check warning on line 230 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'while' not followed by a single space

/* Set the frame filter to receive ACKs */
ieee802154_radio_set_frame_filter_mode(&_radio, IEEE802154_FILTER_ACK_ONLY);
Expand All @@ -252,7 +252,7 @@
{
struct _reg_container *reg = opaque;
printf("Trying to register ");
switch(type) {

Check warning on line 255 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'switch' not followed by a single space
case IEEE802154_DEV_TYPE_CC2538_RF:
printf("cc2538_rf");
break;
Expand Down Expand Up @@ -300,7 +300,7 @@
* The transceiver state will be "TRX_OFF" */
res = ieee802154_radio_request_on(&_radio);
expect(res >= 0);
while(ieee802154_radio_confirm_on(&_radio) == -EAGAIN) {}

Check warning on line 303 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'while' not followed by a single space

ieee802154_radio_set_frame_filter_mode(&_radio, IEEE802154_FILTER_ACCEPT);

Expand All @@ -318,7 +318,7 @@
expect(res >= 0);

/* Set PHY configuration */
ieee802154_phy_conf_t conf = {.channel=CONFIG_IEEE802154_DEFAULT_CHANNEL, .page=CONFIG_IEEE802154_DEFAULT_SUBGHZ_PAGE, .pow=CONFIG_IEEE802154_DEFAULT_TXPOWER};

Check warning on line 321 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters

res = ieee802154_radio_config_phy(&_radio, &conf);
expect(res >= 0);
Expand All @@ -334,7 +334,7 @@
return 0;
}

uint8_t payload[] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ornare lacinia mi elementum interdum ligula.";

Check warning on line 337 in tests/net/ieee802154_hal/main.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters

static int send(uint8_t *dst, size_t dst_len,
size_t len, bool ack_req)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
* @author José I. Alamos <[email protected]>
*/
#ifndef COMMON_H
#define COMMON_H
#ifndef TEST_COMMON_H
#define TEST_COMMON_H

#include "net/ieee802154/radio.h"
#if IS_USED(MODULE_SOCKET_ZEP)
Expand Down Expand Up @@ -60,5 +60,5 @@ void ieee802154_hal_test_init_devs(ieee802154_dev_cb_t cb, void *opaque);
}
#endif

#endif /* COMMON_H */
#endif /* TEST_COMMON_H */
/** @} */
17 changes: 3 additions & 14 deletions tests/pkg/lwip/common.h → tests/pkg/lwip/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
* @author Martine Lenders <[email protected]>
*/
#ifndef COMMON_H
#define COMMON_H
#ifndef CLI_H
#define CLI_H

#include <stdint.h>
#include <sys/types.h>
Expand Down Expand Up @@ -46,17 +46,6 @@ extern "C" {
* @}
*/

/**
* @brief Converts hex string to byte array.
*
* @param[out] out Resulting byte array
* @param[in] in `\0` terminated string. Non-hex characters (all except 0-9, a-f, A-F)
* will be ignored.
*
* @return Length of @p out.
*/
size_t hex2ints(uint8_t *out, const char *in);

#ifdef MODULE_SOCK_IP
/**
* @brief Raw IP shell command
Expand Down Expand Up @@ -100,5 +89,5 @@ int udp_cmd(int argc, char **argv);
}
#endif

#endif /* COMMON_H */
#endif /* CLI_H */
/** @} */
3 changes: 2 additions & 1 deletion tests/pkg/lwip/ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdint.h>
#include <stdio.h>

#include "common.h"
#include "cli.h"
#include "kernel_defines.h"
#include "od.h"
#include "net/af.h"
Expand All @@ -29,6 +29,7 @@
#include "shell.h"
#include "thread.h"
#include "test_utils/expect.h"
#include "utilities.h"
#include "ztimer.h"

#ifdef MODULE_SOCK_IP
Expand Down
2 changes: 1 addition & 1 deletion tests/pkg/lwip/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <errno.h>
#include <stdio.h>

#include "common.h"
#include "cli.h"
#include "lwip.h"
#include "lwip/netif.h"
#if LWIP_IPV4
Expand Down
3 changes: 2 additions & 1 deletion tests/pkg/lwip/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdint.h>
#include <stdio.h>

#include "common.h"
#include "cli.h"
#include "od.h"
#include "net/af.h"
#include "net/sock/async/event.h"
Expand All @@ -29,6 +29,7 @@
#include "shell.h"
#include "test_utils/expect.h"
#include "thread.h"
#include "utilities.h"
#include "ztimer.h"

#ifdef MODULE_SOCK_TCP
Expand Down
3 changes: 2 additions & 1 deletion tests/pkg/lwip/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdint.h>
#include <stdio.h>

#include "common.h"
#include "cli.h"
#include "od.h"
#include "net/af.h"
#include "net/sock/async/event.h"
Expand All @@ -29,6 +29,7 @@
#include "shell.h"
#include "test_utils/expect.h"
#include "thread.h"
#include "utilities.h"
#include "ztimer.h"

#ifdef MODULE_SOCK_UDP
Expand Down
2 changes: 1 addition & 1 deletion tests/pkg/lwip/common.c → tests/pkg/lwip/utiliities.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <stdbool.h>

#include "common.h"
#include "utilities.h"

size_t hex2ints(uint8_t *out, const char *in)
{
Expand Down
44 changes: 44 additions & 0 deletions tests/pkg/lwip/utilities.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2016 Martine Lenders <[email protected]>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup tests
* @{
*
* @file
* @brief Utilities for tests/lwip/
*
* @author Martine Lenders <[email protected]>
*/
#ifndef UTILITIES_H
#define UTILITIES_H

#include <stdint.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Converts hex string to byte array.
*
* @param[out] out Resulting byte array
* @param[in] in `\0` terminated string. Non-hex characters (all except 0-9, a-f, A-F)
* will be ignored.
*
* @return Length of @p out.
*/
size_t hex2ints(uint8_t *out, const char *in);

#ifdef __cplusplus
}
#endif

#endif /* UTILITIES_H */
/** @} */
Loading