Page MenuHomePhabricator

[libcxx][test][NFC] Add tests for hash_function() and key_eq() in unordered containers
Needs ReviewPublic

Authored by rarutyun on Feb 14 2022, 2:58 AM.

Details

Reviewers
ldionne
zoecarver
Mordante
Quuxplusone
kboyarinov
Group Reviewers
Restricted Project
Summary

Add tests for hasher hash_function() const and key_equal key_eq() const observers in unordered containers

Diff Detail

Unit TestsFailed

TimeTest
1,910 mslibcxx CI Debug iterators > llvm-libc++-shared-cfg-in.std/containers/unord/unord_multimap::key_eq.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/libcxx/test/std/containers/unord/unord.multimap/key_eq.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_DEBUG=1 -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/test/std/containers/unord/unord.multimap/Output/key_eq.pass.cpp.dir/t.tmp.exe
1,340 mslibcxx CI Debug iterators > llvm-libc++-shared-cfg-in.std/containers/unord/unord_multiset::key_eq.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/libcxx/test/std/containers/unord/unord.multiset/key_eq.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -I /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-noexcept-type -Wno-atomic-alignment -Wno-user-defined-literals -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_DEBUG=1 -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/3369878a404e-1/llvm-project/libcxx-ci/build/generic-debug-iterators/test/std/containers/unord/unord.multiset/Output/key_eq.pass.cpp.dir/t.tmp.exe

Event Timeline

kboyarinov requested review of this revision.Feb 14 2022, 2:58 AM
kboyarinov created this revision.

https://reviews.llvm.org/harbormaster/unit/view/2593320/
https://reviews.llvm.org/harbormaster/unit/view/2593321/

/home/libcxx-builder/.buildkite-agent/builds/998e9b442c55-1/llvm-project/libcxx-ci/build/generic-debug-iterators/include/c++/v1/__hash_table:330: _LIBCPP_ASSERT '::std::__libcpp_is_constant_evaluated() || (__get_const_db()->__dereferenceable(this))' failed. Attempted to dereference a non-dereferenceable unordered container iterator

/home/libcxx-builder/.buildkite-agent/builds/998e9b442c55-1/llvm-project/libcxx-ci/build/generic-debug-iterators/include/c++/v1/__hash_table:442: _LIBCPP_ASSERT '::std::__libcpp_is_constant_evaluated() || (__get_const_db()->__dereferenceable(this))' failed. Attempted to dereference a non-dereferenceable unordered container const_iterator

What's the deal with these failures? The test code doesn't jump out at me as wrong, so I wonder if you've uncovered a bug. Thoughts?

Could you rebase onto main and re-upload this? I suspect the failures might go away now that we've changed a few things about the debug mode.

Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2022, 2:38 PM
rarutyun commandeered this revision.May 3 2022, 3:20 PM
rarutyun updated this revision to Diff 426865.
rarutyun edited reviewers, added: kboyarinov; removed: rarutyun.
rarutyun set the repository for this revision to rG LLVM Github Monorepo.
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald TranscriptMay 3 2022, 3:20 PM

Could you rebase onto main and re-upload this? I suspect the failures might go away now that we've changed a few things about the debug mode.

Rebased

I looked into this a bit, and I think we might not be registering debug iterators properly in unordered_set and unordered_map when we insert. I'm not sure why the rest of the test suite would be happy with this, though.