Skip to content

Commit 6826343

Browse files
committed
config UPDATE redundant public macro
Refs #2553
1 parent 6521779 commit 6826343

9 files changed

Lines changed: 15 additions & 11 deletions

src/ly_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
/** YANG module dir */
4141
#define LY_YANG_MODULE_DIR "@YANG_MODULE_DIR@"
4242

43-
/** lib source dir */
44-
#define LY_SRC_DIR "@CMAKE_CURRENT_SOURCE_DIR@"
45-
4643
/** atomic compiler operations, to be able to use uint32_t */
4744
#ifndef _WIN32
4845
# define LY_ATOMIC_INC_BARRIER(var) __sync_fetch_and_add(&(var), 1)

tests/fuzz/lyd_parse_lyb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <stdint.h>
33

44
#include "libyang.h"
5+
#include "tests_config.h"
56

67
int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
78
{
@@ -18,7 +19,7 @@ int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
1819
log = true;
1920
}
2021

21-
if (ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx) != LY_SUCCESS) {
22+
if (ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx) != LY_SUCCESS) {
2223
return 0;
2324
}
2425

tests/fuzz/lyd_parse_mem_json.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdbool.h>
44

55
#include "libyang.h"
6+
#include "tests_config.h"
67

78
int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
89
{
@@ -60,7 +61,7 @@ int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
6061
log = true;
6162
}
6263

63-
err = ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx);
64+
err = ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx);
6465
if (err != LY_SUCCESS) {
6566
return 0;
6667
}

tests/fuzz/lyd_parse_mem_xml.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdbool.h>
44

55
#include "libyang.h"
6+
#include "tests_config.h"
67

78
int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
89
{
@@ -60,7 +61,7 @@ int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
6061
log = true;
6162
}
6263

63-
err = ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx);
64+
err = ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx);
6465
if (err != LY_SUCCESS) {
6566
return 0;
6667
}

tests/fuzz/lyd_parse_schema_mount_xml.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <unistd.h>
88

99
#include "libyang.h"
10+
#include "tests_config.h"
1011

1112
static const char mounted_module[] =
1213
"module fuzz-sm-leaf {"
@@ -141,7 +142,7 @@ int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
141142
return 0;
142143
}
143144

144-
if (ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx) != LY_SUCCESS) {
145+
if (ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx) != LY_SUCCESS) {
145146
return 0;
146147
}
147148
if (ly_ctx_set_searchdir(ctx, mount_module_dir) != LY_SUCCESS) {

tests/fuzz/lys_parse_mem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdbool.h>
44

55
#include "libyang.h"
6+
#include "tests_config.h"
67

78
int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
89
{
@@ -16,7 +17,7 @@ int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
1617
log = true;
1718
}
1819

19-
err = ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx);
20+
err = ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx);
2021
if (err != LY_SUCCESS) {
2122
return 0;
2223
}

tests/fuzz/yang_parse_module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdbool.h>
44

55
#include "libyang.h"
6+
#include "tests_config.h"
67

78
int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
89
{
@@ -17,7 +18,7 @@ int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
1718
log = true;
1819
}
1920

20-
err = ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx);
21+
err = ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx);
2122
if (err != LY_SUCCESS) {
2223
fprintf(stderr, "Failed to create new context\n");
2324
return 0;

tests/perf/perf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ main(int argc, char **argv)
875875
(tries > 1) ? "times" : "time");
876876

877877
/* create context */
878-
if ((ret = ly_ctx_new(LY_SRC_DIR "/modules", 0, &ctx))) {
878+
if ((ret = ly_ctx_new(TESTS_SRC "/../modules", 0, &ctx))) {
879879
goto cleanup;
880880
}
881881
if ((ret = ly_ctx_set_searchdir(ctx, TESTS_SRC "/perf"))) {

tests/tests_config.h.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/**
22
* @file tests_config.h
33
* @author Radek Krejci <rkrejci@cesnet.cz>
4+
* @author Michal Vasko <mvasko@cesnet.cz>
45
* @brief cmocka tests configuration header.
56
*
6-
* Copyright (c) 2015 - 2021 CESNET, z.s.p.o.
7+
* Copyright (c) 2015 - 2026 CESNET, z.s.p.o.
78
*
89
* This source code is licensed under BSD 3-Clause License (the "License").
910
* You may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)