<commit_before>/*
 * Copyright (C) 2019 <NAME> <<EMAIL>>
 *
 * 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.
 */

#include <assert.h>
#include <stddef.h>

#include "mutex.h"
#include "thread.h"
#include "fuzzing.h"

#include "net/netdev_test.h"
#include "net/gnrc/netif/raw.h"
#include "net/gnrc/netif.h"

/* unlocked once the device is initialized. */
static mutex_t initmtx = MUTEX_INIT_LOCKED;

static int _dev_init(netdev_t *netdev)
{
    (void)netdev;
    mutex_unlock(&initmtx);
    return 0;
}

static int _dev_get_device_type(netdev_t *netdev, void *value, size_t max_len)
{
    assert(max_len == sizeof(uint16_t));
    (void)netdev;

    *((uint16_t *)value) = NETDEV_TYPE_SLIP;
    return sizeof(uint16_t);
}

int fuzzing_netdev(gnrc_netif_t *netif) {
    static netdev_test_t dev;
    static char _netif_stack[THREAD_STACKSIZE_DEFAULT];

    netdev_test_setup(&dev, NULL);
    netdev_test_set_init_cb(&dev, _dev_init);
    netdev_test_set_get_cb(&dev, NETOPT_DEVICE_TYPE, _dev_get_device_type);

    return gnrc_netif_raw_create(netif, _netif_stack, THREAD_STACKSIZE_DEFAULT,
                                 GNRC_NETIF_PRIO, "dummy_netif", &dev.netdev.netdev);
}

void fuzzing_netdev_wait(void) {
    mutex_lock(&initmtx);
}<commit_msg>sys/fuzzing: fix compilation with NDEBUG<commit_after>/*
 * Copyright (C) 2019 <NAME> <<EMAIL>>
 *
 * 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.
 */

#include <assert.h>
#include <stddef.h>

#include "mutex.h"
#include "thread.h"
#include "fuzzing.h"

#include "net/netdev_test.h"
#include "net/gnrc/netif/raw.h"
#include "net/gnrc/netif.h"

/* unlocked once the device is initialized. */
static mutex_t initmtx = MUTEX_INIT_LOCKED;

static int _dev_init(netdev_t *netdev)
{
    (void)netdev;
    mutex_unlock(&initmtx);
    return 0;
}

static int _dev_get_device_type(netdev_t *netdev, void *value, size_t max_len)
{
    (void)max_len;
    assert(max_len == sizeof(uint16_t));
    (void)netdev;

    *((uint16_t *)value) = NETDEV_TYPE_SLIP;
    return sizeof(uint16_t);
}

int fuzzing_netdev(gnrc_netif_t *netif) {
    static netdev_test_t dev;
    static char _netif_stack[THREAD_STACKSIZE_DEFAULT];

    netdev_test_setup(&dev, NULL);
    netdev_test_set_init_cb(&dev, _dev_init);
    netdev_test_set_get_cb(&dev, NETOPT_DEVICE_TYPE, _dev_get_device_type);

    return gnrc_netif_raw_create(netif, _netif_stack, THREAD_STACKSIZE_DEFAULT,
                                 GNRC_NETIF_PRIO, "dummy_netif", &dev.netdev.netdev);
}

void fuzzing_netdev_wait(void) {
    mutex_lock(&initmtx);
}
{'fraction_non_alphanumeric': 0.11378320172290021, 'fraction_numerical': 0.00933237616654702, 'mean_word_length': 4.2684310018903595, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4513443', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1060, 'n_words': 227}