aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/tests
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* util/tests/hash_table: Link against libmesautil instead of libmesaJason Ekstrand2014-08-051-4/+2
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82159 Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: Move the open-addressing linear-probing hash_table to src/util.Kenneth Graunke2014-08-0413-0/+729
| | | | | | | | | | | | | | | | | This hash table is used in core Mesa, the GLSL compiler, and the i965 driver, which makes it a good candidate for the new src/util module. It's much faster than program/hash_table.[ch] (see commit 6991c2922f5 for data), and José's u_hash_table.c has a comment saying Gallium should probably consider switching to a linear probing hash table at some point. So this seems like the best candidate for a shared data structure. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* util: Move ralloc to a new src/util directory.Kenneth Graunke2014-08-042-0/+78
For a long time, we've wanted a place to put utility code which isn't directly tied to Mesa or Gallium internals. This patch creates a new src/util directory for exactly that purpose, and builds the contents as libmesautil.la. ralloc seemed like a good first candidate. These days, it's directly used by mesa/main, i965, i915, and r300g, so keeping it in src/glsl didn't make much sense. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): More realloc uses and some scons fixes Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>