Git Product home page Git Product logo

Comments (3)

racko avatar racko commented on May 6, 2024

It always works with the version that fuzztest is using in their own builds:

fuzztest/WORKSPACE

Lines 23 to 28 in 4c3852b

http_archive(
name = "com_google_absl",
sha256 = "0ddd37f347c58d89f449dd189a645bfd97bcd85c5284404a3af27a3ca3476f39",
strip_prefix = "abseil-cpp-fad946221cec37175e762c399760f54b9de9a9fa",
url = "https://github.com/abseil/abseil-cpp/archive/fad946221cec37175e762c399760f54b9de9a9fa.tar.gz",
)

from fuzztest.

thealberto avatar thealberto commented on May 6, 2024

Hi all,
I'm using the latest version of absl.

http_archive(
    name = "com_google_absl",
    sha256 = "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5",
    strip_prefix = "abseil-cpp-20230802.0",
    url = "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz",
)

Unfortunately a couple of fixes are necessary:

End of search list.
In file included from external/com_google_fuzztest/fuzztest/internal/type_support.cc:15:
external/com_google_fuzztest/./fuzztest/internal/type_support.h:31:10: fatal error: 'absl/strings/has_absl_stringify.h' file not found
   31 | #include "absl/strings/has_absl_stringify.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The path for has_absl_stringify has changed so it is necessary to change it to absl/strings/internal/has_absl_stringify.h so you have to modify type_support.h

Once done if you try again you should have the following error:

In file included from external/com_google_fuzztest/./fuzztest/internal/table_of_recent_compares.h:31:
external/com_google_fuzztest/./fuzztest/internal/type_support.h:90:46: error: no template named 'HasAbslStringify' in namespace 'absl'; did you mean 'absl::strings_internal::HasAbslStringify'?
   90 | inline constexpr bool has_absl_stringify_v = absl::HasAbslStringify<T>::value;
      |                                              ^~~~~~~~~~~~~~~~~~~~~~
      |                                              absl::strings_internal::HasAbslStringify
external/com_google_absl/absl/strings/internal/has_absl_stringify.h:42:8: note: 'absl::strings_internal::HasAbslStringify' declared here
   42 | struct HasAbslStringify : std::false_type {};
      |        ^
1 error generated.

This time add strings_internal:: on line 90 as suggested.

Now you should be able to use bazel test and bazel run

[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.
INFO: Found 1 test target...
Target //:alberto up-to-date:
  bazel-bin/alberto
INFO: Elapsed time: 14.652s, Critical Path: 9.12s
INFO: 131 processes: 1 internal, 130 linux-sandbox.
INFO: Build completed successfully, 131 total actions
//:alberto                                                               PASSED in 0.0s

Executed 1 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
โžœ  woff2 git:(ccbeb246d2) bazel run --copt=-I./include :alberto
INFO: Analyzed target //:alberto (0 packages loaded, 3 targets configured).
INFO: Found 1 target...
Target //:alberto up-to-date:
  bazel-bin/alberto
INFO: Elapsed time: 0.139s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: external/bazel_tools/tools/test/test-setup.sh ./alberto
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //:alberto
-----------------------------------------------------------------------------
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.
โžœ  woff2 git:(ccbeb246d2) 

@racko is it worth a PR?

from fuzztest.

racko avatar racko commented on May 6, 2024

@thealberto Don't ask me, I'm just another user ๐Ÿ˜‚

That being said, as a reviewer I would comment that internal headers and APIs must not be used. Thus, for a proper solution, somebody needs to figure out how HasAbslStringify should be replaced without accessing internals.

Looking for a solution, I found that while you are using the latest release from Sep 18, 2023, fuzztest's main branch actually requires abseil/abseil-cpp@fad9462 from Dec 7, 2023 : At the time of writing I found absl/strings/has_absl_stringify.h in abseil's master branch:

// `HasAbslStringify<T>` detects if type `T` supports the `AbslStringify()`
// customization point (see
// https://abseil.io/docs/cpp/guides/format#abslstringify for the
// documentation).
//
// Note that there are types that can be `StrCat`-ed that do not use the
// `AbslStringify` customization point (for example, `int`).

template <typename T, typename = void>
struct HasAbslStringify : std::false_type {};

template <typename T>
struct HasAbslStringify<
    T, std::enable_if_t<std::is_void<decltype(AbslStringify(
           std::declval<strings_internal::UnimplementedSink&>(),
           std::declval<const T&>()))>::value>> : std::true_type {};

from fuzztest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.