Skip to content

Commit c4f7fae

Browse files
Flavio Ceolinnashif
Flavio Ceolin
authored andcommitted
random: Include header where it is used
Unit tests were failing to build because random header was included by kernel_includes.h. The problem is that rand32.h includes a generated file that is either not generated or not included when building unit tests. Also, it is better to limit the scope of this file to where it is used. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
1 parent 6216c6c commit c4f7fae

File tree

60 files changed

+62
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+62
-1
lines changed

drivers/ethernet/eth.h

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define ZEPHYR_DRIVERS_ETHERNET_ETH_H_
99

1010
#include <zephyr/types.h>
11+
#include <random/rand32.h>
1112

1213
/* helper macro to return mac address octet from local_mac_address prop */
1314
#define NODE_MAC_ADDR_OCTET(node, n) DT_PROP_BY_IDX(node, local_mac_address, n)

drivers/ieee802154/ieee802154_uart_pipe.c

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
1919
#include <init.h>
2020
#include <net/net_if.h>
2121
#include <net/net_pkt.h>
22+
#include <random/rand32.h>
2223

2324
#include <drivers/console/uart_pipe.h>
2425
#include <net/ieee802154_radio.h>

drivers/modem/wncm14a2a.c

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
2020
#include <drivers/gpio.h>
2121
#include <device.h>
2222
#include <init.h>
23+
#include <random/rand32.h>
2324

2425
#include <net/net_context.h>
2526
#include <net/net_if.h>

drivers/net/ppp.c

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ LOG_MODULE_REGISTER(net_ppp, LOG_LEVEL);
3131
#include <sys/crc.h>
3232
#include <drivers/uart.h>
3333
#include <drivers/console/uart_mux.h>
34+
#include <random/rand32.h>
3435

3536
#include "../../subsys/net/ip/net_stats.h"
3637
#include "../../subsys/net/ip/net_private.h"

drivers/net/slip.c

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
3232
#include <net/net_core.h>
3333
#include <net/dummy.h>
3434
#include <drivers/console/uart_pipe.h>
35+
#include <random/rand32.h>
3536

3637
#define SLIP_END 0300
3738
#define SLIP_ESC 0333

include/kernel_includes.h

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <mempool_sys.h>
3434
#endif
3535
#include <kernel_version.h>
36-
#include <random/rand32.h>
3736
#include <syscall.h>
3837
#include <sys/printk.h>
3938
#include <arch/cpu.h>

kernel/thread.c

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <stdbool.h>
2727
#include <irq_offload.h>
2828
#include <sys/check.h>
29+
#include <random/rand32.h>
2930

3031
#ifdef CONFIG_THREAD_MONITOR
3132
/* This lock protects the linked list of active threads; i.e. the

samples/bluetooth/peripheral_csc/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <stddef.h>
1212
#include <string.h>
1313
#include <errno.h>
14+
#include <random/rand32.h>
1415
#include <sys/printk.h>
1516
#include <sys/byteorder.h>
1617
#include <zephyr.h>

samples/net/cloud/mqtt_azure/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(mqtt_azure, LOG_LEVEL_DBG);
1212
#include <net/mqtt.h>
1313

1414
#include <sys/printk.h>
15+
#include <random/rand32.h>
1516
#include <string.h>
1617
#include <errno.h>
1718

samples/net/mqtt_publisher/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_mqtt_publisher_sample, LOG_LEVEL_DBG);
1010
#include <zephyr.h>
1111
#include <net/socket.h>
1212
#include <net/mqtt.h>
13+
#include <random/rand32.h>
1314

1415
#include <string.h>
1516
#include <errno.h>

samples/net/sockets/echo_client/src/tcp.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LOG_MODULE_DECLARE(net_echo_client_sample, LOG_LEVEL_DBG);
1616

1717
#include <net/socket.h>
1818
#include <net/tls_credentials.h>
19+
#include <random/rand32.h>
1920

2021
#include "common.h"
2122
#include "ca_certificate.h"

samples/net/sockets/echo_client/src/udp.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LOG_MODULE_DECLARE(net_echo_client_sample, LOG_LEVEL_DBG);
1616

1717
#include <net/socket.h>
1818
#include <net/tls_credentials.h>
19+
#include <random/rand32.h>
1920

2021
#include "common.h"
2122
#include "ca_certificate.h"

samples/net/sockets/websocket_client/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_websocket_client_sample, LOG_LEVEL_DBG);
1111
#include <net/socket.h>
1212
#include <net/tls_credentials.h>
1313
#include <net/websocket.h>
14+
#include <random/rand32.h>
1415
#include <shell/shell.h>
1516

1617
#include "ca_certificate.h"

samples/net/wpan_serial/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(wpan_serial, CONFIG_USB_DEVICE_LOG_LEVEL);
1818
#include <drivers/uart.h>
1919
#include <zephyr.h>
2020
#include <usb/usb_device.h>
21+
#include <random/rand32.h>
2122

2223
#include <net/buf.h>
2324
#include <net_private.h>

subsys/net/ip/dhcpv4.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_dhcpv4, CONFIG_NET_DHCPV4_LOG_LEVEL);
1515

1616
#include <errno.h>
1717
#include <inttypes.h>
18+
#include <random/rand32.h>
1819
#include <net/net_core.h>
1920
#include <net/net_pkt.h>
2021
#include <net/net_if.h>

subsys/net/ip/ipv4_autoconf.c

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf, CONFIG_NET_IPV4_AUTO_LOG_LEVEL);
1818
#include <net/net_pkt.h>
1919
#include <net/net_core.h>
2020
#include <net/net_if.h>
21+
#include <random/rand32.h>
2122

2223
#include "ipv4_autoconf_internal.h"
2324

subsys/net/ip/ipv6_fragment.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LOG_MODULE_DECLARE(net_ipv6, CONFIG_NET_IPV6_LOG_LEVEL);
1717
#include <net/net_stats.h>
1818
#include <net/net_context.h>
1919
#include <net/net_mgmt.h>
20+
#include <random/rand32.h>
2021
#include "net_private.h"
2122
#include "connection.h"
2223
#include "icmpv6.h"

subsys/net/ip/net_context.c

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
LOG_MODULE_REGISTER(net_ctx, CONFIG_NET_CONTEXT_LOG_LEVEL);
1515

1616
#include <kernel.h>
17+
#include <random/rand32.h>
1718
#include <string.h>
1819
#include <errno.h>
1920
#include <stdbool.h>

subsys/net/ip/net_if.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_if, CONFIG_NET_IF_LOG_LEVEL);
1010
#include <init.h>
1111
#include <kernel.h>
1212
#include <linker/sections.h>
13+
#include <random/rand32.h>
1314
#include <syscall_handler.h>
1415
#include <stdlib.h>
1516
#include <string.h>

subsys/net/ip/net_shell.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_shell, LOG_LEVEL_DBG);
1515

1616
#include <zephyr.h>
1717
#include <kernel_internal.h>
18+
#include <random/rand32.h>
1819
#include <stdlib.h>
1920
#include <stdio.h>
2021
#include <shell/shell.h>

subsys/net/ip/tcp2.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_tcp, CONFIG_NET_TCP_LOG_LEVEL);
1111
#include <stdio.h>
1212
#include <stdlib.h>
1313
#include <zephyr.h>
14+
#include <random/rand32.h>
1415
#include <net/net_pkt.h>
1516
#include <net/net_context.h>
1617
#include <net/udp.h>

subsys/net/ip/tcp_internal.h

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define __TCP_INTERNAL_H
1515

1616
#include <zephyr/types.h>
17+
#include <random/rand32.h>
1718

1819
#include <net/net_core.h>
1920
#include <net/net_ip.h>

subsys/net/ip/trickle.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_trickle, CONFIG_NET_TRICKLE_LOG_LEVEL);
1515

1616
#include <errno.h>
1717
#include <sys/util.h>
18+
#include <random/rand32.h>
1819

1920
#include <net/net_core.h>
2021
#include <net/trickle.h>

subsys/net/l2/canbus/6locan.c

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ LOG_MODULE_REGISTER(net_l2_canbus, CONFIG_NET_L2_CANBUS_LOG_LEVEL);
2020
#include <net/ethernet.h>
2121
#include <net/net_ip.h>
2222
#include <string.h>
23+
#include <random/rand32.h>
2324

2425
#define NET_CAN_WFTMAX 2
2526
#define NET_CAN_ALLOC_TIMEOUT K_MSEC(100)

subsys/net/l2/ethernet/ethernet.c

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LOG_MODULE_REGISTER(net_ethernet, CONFIG_NET_L2_ETHERNET_LOG_LEVEL);
1414
#include <net/ethernet.h>
1515
#include <net/ethernet_mgmt.h>
1616
#include <net/gptp.h>
17+
#include <random/rand32.h>
1718

1819
#if defined(CONFIG_NET_LLDP)
1920
#include <net/lldp.h>

subsys/net/l2/ethernet/gptp/gptp.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_gptp, CONFIG_NET_GPTP_LOG_LEVEL);
1010
#include <net/net_pkt.h>
1111
#include <ptp_clock.h>
1212
#include <net/ethernet_mgmt.h>
13+
#include <random/rand32.h>
1314

1415
#include <net/gptp.h>
1516

subsys/net/l2/ieee802154/ieee802154_radio_csma_ca.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_ieee802154_csma, CONFIG_NET_L2_IEEE802154_LOG_LEVEL);
1111
#include <net/net_if.h>
1212

1313
#include <sys/util.h>
14+
#include <random/rand32.h>
1415

1516
#include <stdlib.h>
1617
#include <errno.h>

subsys/net/l2/ppp/fsm.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LOG_MODULE_DECLARE(net_l2_ppp, CONFIG_NET_L2_PPP_LOG_LEVEL);
1111
#include <net/net_pkt.h>
1212

1313
#include <net/ppp.h>
14+
#include <random/rand32.h>
1415

1516
#include "net_private.h"
1617

subsys/net/lib/dns/resolve.c

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL);
1515

1616
#include <zephyr/types.h>
17+
#include <random/rand32.h>
1718
#include <string.h>
1819
#include <errno.h>
1920
#include <stdlib.h>

subsys/net/lib/openthread/platform/settings.c

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <kernel.h>
88
#include <logging/log.h>
99
#include <settings/settings.h>
10+
#include <random/rand32.h>
1011

1112
#include <openthread/platform/settings.h>
1213

subsys/net/lib/sockets/sockets_tls.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_sock_tls, CONFIG_NET_SOCKETS_LOG_LEVEL);
1616
#include <sys/util.h>
1717
#include <net/net_context.h>
1818
#include <net/socket.h>
19+
#include <random/rand32.h>
1920
#include <syscall_handler.h>
2021
#include <sys/fdtable.h>
2122

subsys/net/lib/websocket/websocket.c

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ LOG_MODULE_REGISTER(net_websocket, CONFIG_NET_WEBSOCKET_LOG_LEVEL);
2626
#include <net/http_client.h>
2727
#include <net/websocket.h>
2828

29+
#include <random/rand32.h>
2930
#include <sys/byteorder.h>
3031
#include <sys/base64.h>
3132
#include <mbedtls/sha1.h>

tests/benchmarks/mbedtls/src/benchmark.c

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969

7070
#include <zephyr/types.h>
7171
#include <sys/byteorder.h>
72+
#include <random/rand32.h>
7273

7374
#include "kernel.h"
7475

tests/crypto/rand32/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <ztest.h>
1717
#include <kernel_internal.h>
18+
#include <random/rand32.h>
1819

1920
#define N_VALUES 10
2021

tests/crypto/tinycrypt/src/ecc_dsa.c

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include <test_utils.h>
6868
#include "test_ecc_utils.h"
6969
#include <sys/util.h>
70+
#include <random/rand32.h>
7071

7172
#include <stdio.h>
7273
#include <stdlib.h>

tests/kernel/sched/deadline/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
#include <zephyr.h>
77
#include <ztest.h>
8+
#include <random/rand32.h>
89

910
#define NUM_THREADS 8
1011
#define STACK_SIZE (256 + CONFIG_TEST_EXTRA_STACKSIZE)

tests/kernel/timer/timer_api/src/timer_convert.c

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <ztest.h>
77
#include <zephyr/types.h>
88
#include <sys/time_units.h>
9+
#include <random/rand32.h>
910

1011
#define NUM_RANDOM 100
1112

tests/net/arp/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_ARP_LOG_LEVEL);
2525
#include <net/net_ip.h>
2626
#include <net/dummy.h>
2727
#include <ztest.h>
28+
#include <random/rand32.h>
2829

2930
#include "arp.h"
3031

tests/net/checksum_offload/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
1818
#include <errno.h>
1919
#include <sys/printk.h>
2020
#include <linker/sections.h>
21+
#include <random/rand32.h>
2122

2223
#include <ztest.h>
2324

tests/net/context/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_CONTEXT_LOG_LEVEL);
1717
#include <errno.h>
1818
#include <sys/printk.h>
1919
#include <linker/sections.h>
20+
#include <random/rand32.h>
2021

2122
#include <tc_util.h>
2223

tests/net/hostname/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
1616
#include <stddef.h>
1717
#include <string.h>
1818
#include <errno.h>
19+
#include <random/rand32.h>
1920
#include <sys/printk.h>
2021
#include <linker/sections.h>
2122

tests/net/iface/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
1818
#include <errno.h>
1919
#include <sys/printk.h>
2020
#include <linker/sections.h>
21+
#include <random/rand32.h>
2122

2223
#include <ztest.h>
2324

tests/net/ip-addr/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
1616
#include <device.h>
1717
#include <init.h>
1818
#include <linker/sections.h>
19+
#include <random/rand32.h>
1920

2021
#include <ztest.h>
2122

tests/net/ipv6/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
1515
#include <string.h>
1616
#include <errno.h>
1717
#include <linker/sections.h>
18+
#include <random/rand32.h>
1819

1920
#include <ztest.h>
2021

tests/net/ipv6_fragment/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
1616
#include <errno.h>
1717
#include <sys/printk.h>
1818
#include <linker/sections.h>
19+
#include <random/rand32.h>
1920

2021
#include <ztest.h>
2122

tests/net/lib/dns_addremove/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_DNS_RESOLVER_LOG_LEVEL);
1313
#include <string.h>
1414
#include <errno.h>
1515
#include <sys/printk.h>
16+
#include <random/rand32.h>
1617

1718
#include <ztest.h>
1819

tests/net/lib/dns_resolve/src/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_DNS_RESOLVER_LOG_LEVEL);
1313
#include <string.h>
1414
#include <errno.h>
1515
#include <sys/printk.h>
16+
#include <random/rand32.h>
1617

1718
#include <ztest.h>
1819

tests/net/lib/mqtt_publisher/src/test_mqtt_publish.c

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ LOG_MODULE_REGISTER(net_test, LOG_LEVEL_WRN);
1414
#include <string.h>
1515
#include <errno.h>
1616

17+
#include <random/rand32.h>
18+
1719
#include "config.h"
1820

1921
/* This is mqtt payload message. */

tests/net/lib/mqtt_pubsub/src/test_mqtt_pubsub.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_test, LOG_LEVEL_WRN);
1010
#include <ztest.h>
1111
#include <net/socket.h>
1212
#include <net/mqtt.h>
13+
#include <random/rand32.h>
1314

1415
#include <string.h>
1516
#include <errno.h>

0 commit comments

Comments
 (0)