aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/tests
Commit message (Collapse)AuthorAgeFilesLines
* util/tests: initialize variableErik Faye-Lund2020-04-161-1/+1
| | | | | | | | | This just silences a compiler-warning about a potentially uninitialized variable. It's not uninitialized, but it's a bit hard for the compiler to see. So let's just initialize it to zero. Reviewed-by: Brian Paul <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4577>
* meson: inline `inc_common`Eric Engestrom2020-03-288-8/+8
| | | | | | | | | Let's make it clear what includes are being added everywhere, so that they can be cleaned up. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4360>
* util/sparse_array: Finish the sparse_array in the testsJason Ekstrand2020-03-201-0/+2
| | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4228>
* gitlab-ci: Add ppc64el and s390x cross-build jobsMichel Dänzer2020-02-052-0/+2
| | | | | | | | | | | | | Using LLVM 8 for ppc64el and 7 for s390x (which hits some coroutine related issues with LLVM 8). There are some test failures we need to ignore for now. Also, the timeout needs to be bumped from the default 30s for some tests, because they can take longer under emulation. Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3643>
* util/hash_table: added hash functions for integer typesAnthony Pesch2020-01-234-4/+4
| | | | | | | | | | | | | | | | | A few hash_table users roll their own integer hash functions which call _mesa_hash_data to perform the hashing which ultimately calls into XXH32 with a dynamic key length. When using small keys with a constant size the hash rate can be greatly improved by inlining XXH32 and providing it a constant key length, see: https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html Additionally, this patch removes calls to _mesa_key_hash_string and makes them instead call _mesa_has_string directly, matching the new integer hash functions. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
* util/vector: Fix u_vector_foreach when head rolls overC Stout2020-01-172-0/+131
| | | | | | | Also add unit tests for u_vector. Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3453> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3453>
* u_format: move format tests to util/tests/Eric Engestrom2019-12-273-1/+896
| | | | | | Suggested-by: Eric Anholt <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/format: add trivial srgb<->linear conversion testEric Engestrom2019-12-272-0/+52
| | | | | | | | | This would've caught 8829f9ccb0267d113283 ("u_format: add ETC2 to util_format_srgb/util_format_linear"). Suggested-by: Eric Anholt <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: Add a util_sparse_array data structureJason Ekstrand2019-10-312-0/+112
| | | | Reviewed-by: Lionel Landwerlin <[email protected]>
* util/tests: Avoid int64_t overflow issues in fast_idiv_by_const testMichel Dänzer2019-10-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Flagged by UBSan: ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:233:14: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself #0 0x55b4c1a2a428 in rand_sint ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:233 #1 0x55b4c1a2ad3a in random_sdiv_test ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:308 #2 0x55b4c1a2b837 in fast_idiv_by_const_int32_Test::TestBody() ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:410 #3 0x55b4c1abc13f in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #4 0x55b4c1aa7a4d in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #5 0x55b4c1a4ce57 in testing::Test::Run() ../src/gtest/src/gtest.cc:2474 #6 0x55b4c1a4f530 in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2656 #7 0x55b4c1a51cbe in testing::TestCase::Run() ../src/gtest/src/gtest.cc:2774 #8 0x55b4c1a6d698 in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:4649 #9 0x55b4c1abfd58 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #10 0x55b4c1aab425 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #11 0x55b4c1a64cba in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:4257 #12 0x55b4c1ae4b73 in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2233 #13 0x55b4c1ae4a33 in main ../src/gtest/src/gtest_main.cc:37 #14 0x7ff172d1dbba in __libc_start_main ../csu/libc-start.c:308 #15 0x55b4c1a28dc9 in _start (/home/daenzer/src/mesa-git/mesa/build-amd64-sanitize/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test+0x96dc9) ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:309:52: runtime error: negation of -9223372036854775808 cannot be represented in type 'long int'; cast to an unsigned type to negate this value to itself #0 0x563b24dafd2d in random_sdiv_test ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:309 #1 0x563b24db0f0f in fast_idiv_by_const_int64_Test::TestBody() ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:473 #2 0x563b24e41111 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #3 0x563b24e2ca1f in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #4 0x563b24dd1e29 in testing::Test::Run() ../src/gtest/src/gtest.cc:2474 #5 0x563b24dd4502 in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2656 #6 0x563b24dd6c90 in testing::TestCase::Run() ../src/gtest/src/gtest.cc:2774 #7 0x563b24df266a in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:4649 #8 0x563b24e44d2a in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #9 0x563b24e303f7 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #10 0x563b24de9c8c in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:4257 #11 0x563b24e69b45 in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2233 #12 0x563b24e69a05 in main ../src/gtest/src/gtest_main.cc:37 #13 0x7f9a90330bba in __libc_start_main ../csu/libc-start.c:308 #14 0x563b24daddc9 in _start (/home/daenzer/src/mesa-git/mesa/build-amd64-sanitize/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test+0x96dc9) v2: * Use INT64_MIN instead of LLONG_MIN (Jason Ekstrand) * Simpler test for INT64_MIN result from rand_sint (Jason Ekstrand) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* util: Use uint64_t for shifting left in sign_extend and struncMichel Dänzer2019-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shifting int64_t values left into the sign bit has undefined behaviour: ../src/util/fast_idiv_by_const.c:175:14: runtime error: left shift of 131 by 56 places cannot be represented in type 'long int' #0 0x561337ed10c1 in sign_extend ../src/util/fast_idiv_by_const.c:175 #1 0x561337ed1335 in util_compute_fast_sdiv_info ../src/util/fast_idiv_by_const.c:239 #2 0x561337e17519 in fast_idiv_by_const_int8_Test::TestBody() ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:357 #3 0x561337ea815d in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #4 0x561337e93a6b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #5 0x561337e38e75 in testing::Test::Run() ../src/gtest/src/gtest.cc:2474 #6 0x561337e3b54e in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2656 #7 0x561337e3dcdc in testing::TestCase::Run() ../src/gtest/src/gtest.cc:2774 #8 0x561337e596b6 in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:4649 #9 0x561337eabd76 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #10 0x561337e97443 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #11 0x561337e50cd8 in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:4257 #12 0x561337ed0b91 in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2233 #13 0x561337ed0a51 in main ../src/gtest/src/gtest_main.cc:37 #14 0x7f85ba483bba in __libc_start_main ../csu/libc-start.c:308 #15 0x561337e14dc9 in _start (/home/daenzer/src/mesa-git/mesa/build-amd64-sanitize/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test+0x96dc9) ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:51:14: runtime error: left shift of negative value -63 #0 0x55fc3c0e67cc in strunc ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:51 #1 0x55fc3c0e6d93 in smul_high ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:140 #2 0x55fc3c0e7067 in fast_sdiv ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:181 #3 0x55fc3c0e858b in fast_idiv_by_const_int8_Test::TestBody() ../src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp:358 #4 0x55fc3c17915d in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #5 0x55fc3c164a6b in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #6 0x55fc3c109e75 in testing::Test::Run() ../src/gtest/src/gtest.cc:2474 #7 0x55fc3c10c54e in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2656 #8 0x55fc3c10ecdc in testing::TestCase::Run() ../src/gtest/src/gtest.cc:2774 #9 0x55fc3c12a6b6 in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:4649 #10 0x55fc3c17cd76 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #11 0x55fc3c168443 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #12 0x55fc3c121cd8 in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:4257 #13 0x55fc3c1a1b91 in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2233 #14 0x55fc3c1a1a51 in main ../src/gtest/src/gtest_main.cc:37 #15 0x7fd224759bba in __libc_start_main ../csu/libc-start.c:308 #16 0x55fc3c0e5dc9 in _start (/home/daenzer/src/mesa-git/mesa/build-amd64-sanitize/src/util/tests/fast_idiv_by_const/fast_idiv_by_const_test+0x96dc9) v2: * Use two casts instead of changing the argument type (Jason Ekstrand) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* meson: Add msvc compat args to util/testsDylan Baker2019-10-101-0/+1
| | | | | | | To keep this building with msvc Acked-by: Eric Engestrom <[email protected]> Acked-by: Kristian H. Kristensen <[email protected]>
* Fix timespec_from_nsec test for 32-bit time_tJon Turney2019-09-171-1/+1
| | | | | | | | | Since struct timespec's tv_sec member is of type time_t, adjust the expected value to allow for the truncation which will occur with 32-bit time_t. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* util/timespec: use unsigned 64 bit integers for nsec valuesLionel Landwerlin2019-08-221-21/+4
| | | | | | | | | | | | | | | We added this utility for vulkan where all timeouts are given as uint64_t values. We can switch from signed to unsigned as this is the only user and if we ever deal with signed integers somewhere else we'll have to be careful to use the corresponding timespec_(add|sub)_msec and always pass absolute values. v2: Forgot to drop the test calling add_nsec() with a negative number Signed-off-by: Lionel Landwerlin <[email protected]> Reported-by: Juan A. Suarez Romero <[email protected]> Fixes: d2d70c3bb5 ("util: add a timespec helper") Acked-by: Daniel Stone <[email protected]>
* meson: drop unused dep_{thread,dl}Eric Engestrom2019-08-034-4/+4
| | | | | | | | Unused as of last commit. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* meson: replace libmesa_util with idep_mesautilEric Engestrom2019-08-037-13/+7
| | | | | | | | | | | This automates the include_directories and dependencies tracking so that all users of libmesa_util don't need to add them manually. Next commit will remove the ones that were only added for that reason. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* util: add a timespec helperLionel Landwerlin2019-07-292-0/+340
| | | | | | | | Copied from Weston, upon Daniel's suggestion Signed-off-by: Lionel Landwerlin <[email protected]> Suggested-by: Daniel Stone <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* util: Add a helper for faster remaindersConnor Abbott2019-05-312-0/+131
| | | | | | | | | | This should be at least as fast as using fast_idiv_by_const, and has the advantage that the precomputation is simple enough to be evaluated at Mesa-compile time for hash tables and sets which have a fixed table of possible divisors. Acked-by: Eric Anholt <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* util/set: Add a _mesa_set_search_or_add() functionConnor Abbott2019-05-311-0/+33
| | | | | | | | | | Unlike _mesa_set_search_and_add(), it doesn't replace an entry if it's found, returning it instead. This is useful for nir_instr_set, where we have to know both the original original instruction and its equivalent. Reviewed-by: Eric Anholt <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* tests/vma: fix build with MSVCDylan Baker2019-05-031-0/+8
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util/tests: Use define instead of VLADylan Baker2019-05-035-20/+25
| | | | | | | To allow the this test to be built with MSVC, which doesn't support VLAs. Reviewed-by: Eric Anholt <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-291-12/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* Delete autotoolsDylan Baker2019-04-155-214/+0
| | | | | | | | | | Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Marek Olšák <[email protected]> Acked-by: Jason Ekstrand <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Acked-by: Matt Turner <[email protected]>
* util/tests: compile to something sensible in release buildsEric Engestrom2019-02-1412-0/+24
| | | | | | | | assert()-based tests make no sense without asserts, so make sure asserts are compiled in, even if the rest of the code has asserts turned off. Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Lionel Landwerlin <[email protected]>
* meson: Add tests to suitesDylan Baker2018-11-205-5/+10
| | | | | | | | | | | | | | | | Meson test has a concepts of suites, which allow tests to be grouped together. This allows for a subtest of tests to be run only (say only the tests for nir). A test can be added to more than one suite, but for the most part I've only added a test to a single suite, though I've added a compiler group that includes nir, glsl, and glcpp tests. To use this you'll need to invoke meson test directly, instead of ninja test (which always runs all targets). it can be invoked as: `meson test -C builddir --suite $suitename` (meson test has addition options that are pretty useful). Tested-By: Gert Wollny <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* util: use C99 declaration in the for-loop hash_table_foreach() macroEric Engestrom2018-10-252-2/+1
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* util: Add tests for fast integer division by constantsJason Ekstrand2018-10-103-0/+545
| | | | | | | | | While I generally trust rediculousfish to have done his homework, we've made some adjustments to suit the needs of mesa and it'd be good to test those. Also, there's no better place than unit tests to clearly document the different edge cases of the different methods. Reviewed-by: Marek Olšák <[email protected]>
* util/string_buffer: fix warning in testsCaio Marcelo de Oliveira Filho2018-07-181-3/+3
| | | | | | | | | | | | | | | | | And also specify the maximum size when writing to static buffers. The warning below refers to the case where "str5" could be larger than "str5 - str4", then the strcat would have overlapping dst and src. Compiler doesn't pick up the bound from the snprintf above, so we make clear the bounds of str5 by using strncat() instead of strcat(). ../../src/util/tests/string_buffer/string_buffer_test.cpp: In member function ‘virtual void string_buffer_string_buffer_tests_Test::TestBody()’: ../../src/util/tests/string_buffer/string_buffer_test.cpp:106:10: warning: ‘char* strcat(char*, const char*)’ accessing 81 or more bytes at offsets 48 and 128 may overlap 1 byte at offset 128 [-Wrestrict] strcat(str4, str5); ~~~~~~^~~~~~~~~~~~ Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* util/hash_table: add helper to remove entry by keyCaio Marcelo de Oliveira Filho2018-07-134-1/+67
| | | | | | And the corresponding test case. Reviewed-by: Eric Anholt <[email protected]>
* util/set: helper to remove entry by keyCaio Marcelo de Oliveira Filho2018-07-121-0/+28
| | | | | | v2: Add unit test. (Eric Anholt) Reviewed-by: Eric Anholt <[email protected]>
* util/set: add a clone functionCaio Marcelo de Oliveira Filho2018-07-121-0/+32
| | | | | | v2: Add unit test. (Eric Anholt) Reviewed-by: Eric Anholt <[email protected]>
* util/set: add a basic unit testCaio Marcelo de Oliveira Filho2018-07-123-0/+127
| | | | Reviewed-by: Eric Anholt <[email protected]>
* vma/tests: Fix compilation if limits.h defines PAGE_SIZE (v2)Jon Turney2018-07-061-8/+8
| | | | | | | | | | per POSIX, limits.h may define PAGE_SIZE when the value is not indeterminate v2: just change the variable name, since there's no intended correlation here between this value and the machine's actual page size. Signed-off-by: Jon Turney <[email protected]> Reviewed-by: Scott D Phillips <[email protected]>
* util/tests/vma: Fix warning c++11-narrowingScott D Phillips2018-06-051-1/+1
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106801 Fixes: 943fecc569 ("util: Add a randomized test for the virtual memory allocator") Reviewed-by: Dylan Baker <[email protected]>
* util: Add a randomized test for the virtual memory allocatorScott D Phillips2018-05-313-0/+312
| | | | | | | | | | | | | | | | | The test pseudo-randomly makes allocations and deallocations with the virtual memory allocator and checks that the results are consistent. Specifically, we test that: * no result from the allocator overlaps an already allocated range * allocated memory fulfills the stated alignment requirement * a failed result from the allocator could not have been fulfilled * memory freed to the allocator can later be allocated again v2: - fix if() in test() to actually run fill() v3: - add c++11 build flag (Jason) - test the full 64-bit range (Jason) Reviewed-by: Jason Ekstrand <[email protected]>
* autotools: include meson build files in tarballDylan Baker2018-01-192-0/+4
| | | | | | | | | | | | This adds the meson.build, meson_options.txt, and a few scripts that are used exclusively by the meson build. v2: - Remove accidentally included changes needed to test make dist with LLVM > 3.9 Signed-off-by: Dylan Baker <[email protected]> Acked-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* meson: Use consistent style for testsDylan Baker2018-01-112-15/+18
| | | | | | | Don't use intermediate variables, use consistent whitespace. Acked-by: Eric Engestrom <[email protected]> Signed-off-by: Dylan Baker <[email protected]>
* meson: convert gtest to an internal dependencyDylan Baker2017-10-031-2/+2
| | | | | | | | | | | | In truth gtest is an external dependency that upstream expects you to "vendor" into your own tree. As such, it makes sense to treat it more like a dependency than an internal library, and collect it's requirements together in a dependency object. v2: - include with -isystem instead of setting compiler args (Eric) Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: fix in-class initialization of static memberThomas Helland2017-09-281-3/+6
| | | | | | | | | | | | | | Fix a compile error with G++ 4.4 string_buffer_test.cpp:43: error: ISO C++ forbids initialization of member ‘str1’ string_buffer_test.cpp:43: error: making ‘str1’ static string_buffer_test.cpp:43: error: invalid in-class initialization of static data member of non-integral type ‘const char*’ Tested-by: Vinson Lee <vlee at freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103002
* meson: Add build Intel "anv" vulkan driverDylan Baker2017-09-272-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows building and installing the Intel "anv" Vulkan driver using meson and ninja, the driver has been tested against the CTS and has seems to pass the same series of tests (they both segfault when the CTS tries to run wayland wsi tests). There are still a mess of TODO, XXX, and FIXME comments in here. Those are mostly for meson bugs I'm trying to fix, or for additional things to implement for other drivers/features. I have configured all intermediate libraries and optional tools to not build by default, meaning they will only be built if they're pulled in as a dependency of a target that will actually be installed) this allows us to avoid massive if chains, while ensuring that only the bits that need to be built are. v2: - enable anv, x11, and wayland by default - add configure option to disable valgrind v3: - fix typo in meson_options (Nicholas) v4: - Remove dead code (Eric) - Remove change to generator that was from v0 (Eric) - replace if chain with loop (Eric) - Fix typos (Eric) - define HAVE_DLOPEN for both libdl and builtin dl cases (Eric) v5: - rebase on util string buffer implementation Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> (v4)
* util: Add tests for the string bufferThomas Helland2017-09-262-0/+159
| | | | | | | | | | | | | | | | | | | | | | | More tests could probably be added, but this should cover concatenation, resizing, clearing, formatted printing, and checking the length, so it should be quite complete. Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de> V2: Address review feedback from Timothy, plus fixes - Use a large enough char array - Actually test the formatted appending - Test that clear function resets string length V3: Port to gtest V4: Fix test makefile Fix copyright header Fix missing extern C Use more appropriate name for C-file Add tests for append_char
* mesa: Add .gitignore entries for make check binariesKristian Høgsberg Kristensen2016-05-251-0/+1
| | | | | Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Acked-by: Matt Turner <[email protected]>
* util/hash_table: add _mesa_hash_table_clear (v4)Nicolai Hähnle2016-02-032-0/+92
| | | | | | v4: coding style change (Matt Turner) Reviewed-by: Ian Romanick <[email protected]> (v3)
* util/hash: Silence comparison between signed and unsigned integer warnings ↵Ian Romanick2015-02-173-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in tests delete_management.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ delete_management.c:69:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = size - 100; i < size; i++) { ^ delete_management.c:79:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] assert(key_value(entry->key) >= size - 100 && ^ delete_management.c:79:70: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] assert(key_value(entry->key) >= size - 100 && ^ insert_many.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ insert_many.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ insert_many.c:67:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] assert(ht->entries == size); ^ random_entry.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < size; i++) { ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util/hash: Silence unused parameter warnings in testsIan Romanick2015-02-179-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | delete_and_lookup.c:37:21: warning: unused parameter ‘key’ [-Wunused-parameter] badhash(const void *key) ^ delete_and_lookup.c:43:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ delete_and_lookup.c:43:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ collision.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ collision.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ destroy_callback.c:50:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ destroy_callback.c:50:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_many.c:46:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_many.c:46:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_and_lookup.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ insert_and_lookup.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ null_destroy.c:32:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ null_destroy.c:32:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ random_entry.c:52:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ random_entry.c:52:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ remove_null.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ remove_null.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ replacement.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter] main(int argc, char **argv) ^ replacement.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter] main(int argc, char **argv) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util/hash_table: Try to hit a double-insertion bug in the collision testJason Ekstrand2015-02-071-1/+13
| | | | Reviewed-by: Eric Anholt <[email protected]>
* hash_table: Rename insert_with_hash to insert_pre_hashedJason Ekstrand2015-01-151-4/+4
| | | | | | | We already have search_pre_hashed. This makes the APIs match better. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/hash_table: Rework the API to know about hashingJason Ekstrand2014-12-149-50/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the hash_table API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash table to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_hash_table_insert(ht, _mesa_pointer_hash(key), key, data); In the above case, there is no reason why the hash table shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash table will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. v2: change to call the old entrypoint "pre_hashed" rather than "with_hash", like cworth's equivalent change upstream (change by anholt, acked-in-general by Jason). Signed-off-by: Jason Ekstrand <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util: List hash_table tests as check_PROGRAMS.Matt Turner2014-12-121-1/+1
| | | | EXTRA_PROGRAMS is not what you want for binaries listed in TEST.
* util: remove ralloc_testEmil Velikov2014-08-082-80/+0
| | | | | | | | | The tests in an empty stub, which we're currently building twice. If anyone is interested in expanding it (adding actual tests) they can always bring it back. Suggested-by: Kenneth Graunke <[email protected]> Signed-off-by: Emil Velikov <[email protected]>