forked from Green-Sky/tomato
Merge commit 'b2ae9530a405e02a50476c04fc7196c5e9863ad6'
This commit is contained in:
23
external/toxcore/c-toxcore/testing/BUILD.bazel
vendored
23
external/toxcore/c-toxcore/testing/BUILD.bazel
vendored
@ -15,11 +15,14 @@ sh_test(
|
||||
"-Wno-callback-names",
|
||||
"-Wno-enum-names",
|
||||
"+RTS",
|
||||
"-N3",
|
||||
"-N4",
|
||||
"-RTS",
|
||||
],
|
||||
data = CIMPLE_FILES,
|
||||
tags = ["haskell"],
|
||||
tags = [
|
||||
"haskell",
|
||||
"no-cross",
|
||||
],
|
||||
)
|
||||
|
||||
sh_test(
|
||||
@ -32,7 +35,11 @@ sh_test(
|
||||
"-Iexternal/libvpx",
|
||||
"-Iexternal/opus/include",
|
||||
"-Ihs-tokstyle/include",
|
||||
] + ["$(locations %s)" % f for f in CIMPLE_FILES],
|
||||
] + ["$(locations %s)" % f for f in CIMPLE_FILES] + [
|
||||
"+RTS",
|
||||
"-N4",
|
||||
"-RTS",
|
||||
],
|
||||
data = CIMPLE_FILES + [
|
||||
"//c-toxcore/third_party:headers",
|
||||
"//hs-tokstyle:headers",
|
||||
@ -40,7 +47,10 @@ sh_test(
|
||||
"@libvpx//:headers",
|
||||
"@opus//:headers",
|
||||
],
|
||||
tags = ["haskell"],
|
||||
tags = [
|
||||
"haskell",
|
||||
"no-cross",
|
||||
],
|
||||
toolchains = ["@rules_cc//cc:current_cc_toolchain"],
|
||||
)
|
||||
|
||||
@ -50,7 +60,10 @@ sh_test(
|
||||
srcs = ["//hs-cimple/tools:cimplefmt"],
|
||||
args = ["--reparse"] + ["$(locations %s)" % f for f in CIMPLE_FILES],
|
||||
data = CIMPLE_FILES,
|
||||
tags = ["haskell"],
|
||||
tags = [
|
||||
"haskell",
|
||||
"no-cross",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
|
@ -3,7 +3,15 @@ set(misc_tools_SOURCES
|
||||
misc_tools.c
|
||||
misc_tools.h)
|
||||
add_library(misc_tools STATIC ${misc_tools_SOURCES})
|
||||
target_link_modules(misc_tools toxcore)
|
||||
if(TARGET toxcore_static)
|
||||
target_link_libraries(misc_tools PRIVATE toxcore_static)
|
||||
else()
|
||||
target_link_libraries(misc_tools PRIVATE toxcore_shared)
|
||||
endif()
|
||||
target_link_libraries(misc_tools PRIVATE ${LIBSODIUM_LIBRARIES})
|
||||
target_link_directories(misc_tools PUBLIC ${LIBSODIUM_LIBRARY_DIRS})
|
||||
target_include_directories(misc_tools SYSTEM PRIVATE ${LIBSODIUM_INCLUDE_DIRS})
|
||||
target_compile_options(misc_tools PRIVATE ${LIBSODIUM_CFLAGS_OTHER})
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@ -11,7 +19,12 @@ target_link_modules(misc_tools toxcore)
|
||||
#
|
||||
################################################################################
|
||||
|
||||
if (BUILD_MISC_TESTS)
|
||||
if(BUILD_MISC_TESTS)
|
||||
add_executable(Messenger_test Messenger_test.c)
|
||||
target_link_modules(Messenger_test toxcore misc_tools)
|
||||
target_link_libraries(Messenger_test PRIVATE misc_tools)
|
||||
if(TARGET toxcore_static)
|
||||
target_link_libraries(Messenger_test PRIVATE toxcore_static)
|
||||
else()
|
||||
target_link_libraries(Messenger_test PRIVATE toxcore_shared)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -19,16 +19,12 @@ noinst_PROGRAMS += Messenger_test
|
||||
Messenger_test_SOURCES = \
|
||||
../testing/Messenger_test.c
|
||||
|
||||
Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS) \
|
||||
$(NACL_CFLAGS)
|
||||
Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS)
|
||||
|
||||
Messenger_test_LDADD = $(LIBSODIUM_LDFLAGS) \
|
||||
$(NACL_LDFLAGS) \
|
||||
libmisc_tools.la \
|
||||
libtoxcore.la \
|
||||
$(LIBSODIUM_LIBS) \
|
||||
$(NACL_OBJECTS) \
|
||||
$(NACL_LIBS) \
|
||||
$(WINSOCK2_LIBS)
|
||||
|
||||
endif
|
||||
|
@ -12,7 +12,7 @@
|
||||
* If it receives a message from a friend it replies back.
|
||||
*
|
||||
*
|
||||
* This is how I compile it: gcc -O2 -Wall -D VANILLA_NACL -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/Messenger.c ../core/DHT.c ../nacl/build/${HOSTNAME%.*}/lib/amd64/{cpucycles.o,libnacl.a,randombytes.o} Messenger_test.c
|
||||
* This is how I compile it: gcc -O2 -Wall -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/Messenger.c ../core/DHT.c Messenger_test.c -lsodium
|
||||
*
|
||||
*
|
||||
* Command line arguments are the ip, port and public_key of a node (for bootstrapping).
|
||||
|
@ -13,14 +13,14 @@ endif()
|
||||
|
||||
# Fuzzes the toxsave API
|
||||
add_executable(toxsave_fuzzer toxsave_harness.cc)
|
||||
target_link_libraries(toxsave_fuzzer toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
target_link_libraries(toxsave_fuzzer PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
|
||||
# Fuzzes the bootstrap process
|
||||
add_executable(bootstrap_fuzzer bootstrap_harness.cc)
|
||||
target_link_libraries(bootstrap_fuzzer toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
target_link_libraries(bootstrap_fuzzer PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
|
||||
add_executable(DHT_fuzz_test ../../toxcore/DHT_fuzz_test.cc)
|
||||
target_link_libraries(DHT_fuzz_test toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
target_link_libraries(DHT_fuzz_test PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
|
||||
add_executable(tox_events_fuzz_test ../../toxcore/tox_events_fuzz_test.cc)
|
||||
target_link_libraries(tox_events_fuzz_test toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
target_link_libraries(tox_events_fuzz_test PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
|
||||
|
11
external/toxcore/c-toxcore/testing/misc_tools.c
vendored
11
external/toxcore/c-toxcore/testing/misc_tools.c
vendored
@ -20,9 +20,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef VANILLA_NACL
|
||||
#include <sodium.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
#include <windows.h>
|
||||
@ -141,7 +139,6 @@ int cmdline_parsefor_ipv46(int argc, char **argv, bool *ipv6enabled)
|
||||
}
|
||||
|
||||
|
||||
#ifndef VANILLA_NACL
|
||||
static const char *test_rng_name(void)
|
||||
{
|
||||
return "test_rng";
|
||||
@ -198,11 +195,3 @@ int use_test_rng(uint32_t seed)
|
||||
|
||||
return randombytes_set_implementation(&test_rng);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int use_test_rng(uint32_t seed)
|
||||
{
|
||||
assert(!"libsodium required for use_test_rng");
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user