From ebea3abcb38ccdba3c873aed9fd06ec09be03aca Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 14 Dec 2021 21:18:41 +0000 Subject: [PATCH] chore: Fix gen-file.sh: it wasn't globbing properly. Also fix crypto_core_test.cc to comply with the stack frame limit. --- .circleci/config.yml | 1 + other/analysis/gen-file.sh | 5 +++-- other/analysis/run-clang | 1 + toxcore/crypto_core_test.cc | 6 +++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3f588e717f..aa196b6a785 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,6 +80,7 @@ jobs: cppcheck g++ libconfig-dev + libgtest-dev libopus-dev libsodium-dev libvpx-dev diff --git a/other/analysis/gen-file.sh b/other/analysis/gen-file.sh index 11dc3f7ddc2..f802d9a30cc 100644 --- a/other/analysis/gen-file.sh +++ b/other/analysis/gen-file.sh @@ -12,7 +12,7 @@ CPPFLAGS+=("-Itoxcore") CPPFLAGS+=("-Itoxav") CPPFLAGS+=("-Itoxencryptsave") -LDFLAGS=("-lopus" "-lsodium" "-lvpx" "-lpthread" "-lconfig") +LDFLAGS=("-lopus" "-lsodium" "-lvpx" "-lpthread" "-lconfig" "-lgtest") LDFLAGS+=("-fuse-ld=gold") LDFLAGS+=("-Wl,--detect-odr-violations") LDFLAGS+=("-Wl,--warn-common") @@ -44,12 +44,13 @@ callmain() { put auto_tests/check_compat.h -FIND_QUERY="find . '-(' -name '*.c' -or -name "*.cc" '-)'" +FIND_QUERY="find . '-(' -name '*.c' -or -name '*.cc' '-)'" FIND_QUERY="$FIND_QUERY -and -not -wholename './_build/*'" FIND_QUERY="$FIND_QUERY -and -not -wholename './super_donators/*'" FIND_QUERY="$FIND_QUERY -and -not -name amalgamation.cc" FIND_QUERY="$FIND_QUERY -and -not -name av_test.c" FIND_QUERY="$FIND_QUERY -and -not -name dht_test.c" +FIND_QUERY="$FIND_QUERY -and -not -name trace.cc" FIND_QUERY="$FIND_QUERY -and -not -name version_test.c" readarray -t FILES <<<"$(eval "$FIND_QUERY")" diff --git a/other/analysis/run-clang b/other/analysis/run-clang index 40f831f3ba6..817170573b1 100755 --- a/other/analysis/run-clang +++ b/other/analysis/run-clang @@ -16,6 +16,7 @@ clang++ -o /dev/null amalgamation.cc \ -Wno-covered-switch-default \ -Wno-disabled-macro-expansion \ -Wno-documentation-deprecated-sync \ + -Wno-global-constructors \ -Wno-missing-field-initializers \ -Wno-old-style-cast \ -Wno-padded \ diff --git a/toxcore/crypto_core_test.cc b/toxcore/crypto_core_test.cc index 15b7d763716..cf2012ac25f 100644 --- a/toxcore/crypto_core_test.cc +++ b/toxcore/crypto_core_test.cc @@ -65,14 +65,14 @@ std::pair memcmp_median(uint8_t const *src, uint8_t const *sam */ TEST(CryptoCore, MemcmpTimingIsDataIndependent) { // A random piece of memory. - std::array src; + std::vector src(CRYPTO_TEST_MEMCMP_SIZE); random_bytes(src.data(), CRYPTO_TEST_MEMCMP_SIZE); // A separate piece of memory containing the same data. - std::array same = src; + std::vector same = src; // Another piece of memory containing different data. - std::array not_same; + std::vector not_same(CRYPTO_TEST_MEMCMP_SIZE); random_bytes(not_same.data(), CRYPTO_TEST_MEMCMP_SIZE); // Once we have C++17: