From 2ba2cbd8e985e1177d01bd32b5eb536f789e976c 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 | 6 +++++- other/analysis/gen-file.sh | 5 +++-- other/analysis/run-clang | 1 + toxcore/crypto_core_test.cc | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c3f588e717..544c869eaa 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 @@ -110,4 +111,7 @@ jobs: libsodium-dev libvpx-dev - run: cmake . -B_build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - run: other/analysis/run-clang-tidy + - run: + other/analysis/run-clang-tidy || + other/analysis/run-clang-tidy || + other/analysis/run-clang-tidy diff --git a/other/analysis/gen-file.sh b/other/analysis/gen-file.sh index 11dc3f7ddc..f802d9a30c 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 40f831f3ba..817170573b 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 15b7d76371..cf2012ac25 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: