graphics_Gralloc: remove ill-defined test cases
These tests don't make sense because:
1) The only way the (*register) hook can know the handle is
valid is attempting to downcast the handle and access the data.
2) If the handle is non-null, but previously freed or uninitialized,
this should and does result in a seg fault.
BUG=none
TEST=gralloctest now passes
Change-Id: I2d2e6477acb42f5d14f392b7eb3292e365a144f6
Reviewed-on: https://chromium-review.googlesource.com/500651
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Po-Hsien Wang <pwang@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/client/site_tests/graphics_Gralloc/graphics_Gralloc.py b/client/site_tests/graphics_Gralloc/graphics_Gralloc.py
index 36bdf1a..9f9abc7 100644
--- a/client/site_tests/graphics_Gralloc/graphics_Gralloc.py
+++ b/client/site_tests/graphics_Gralloc/graphics_Gralloc.py
@@ -50,8 +50,7 @@
# TODO(ihf): shard this test into multiple control files.
test_names = [
'alloc_varying_sizes', 'alloc_combinations', 'api', 'gralloc_order',
- 'uninitialized_handle', 'freed_handle', 'mapping', 'perform',
- 'ycbcr', 'async'
+ 'mapping', 'perform', 'ycbcr', 'async'
]
# Run the tests and capture stdout.
diff --git a/client/site_tests/graphics_Gralloc/src/gralloctest.c b/client/site_tests/graphics_Gralloc/src/gralloctest.c
index 4d6d3b2..c0f7987 100644
--- a/client/site_tests/graphics_Gralloc/src/gralloctest.c
+++ b/client/site_tests/graphics_Gralloc/src/gralloctest.c
@@ -411,43 +411,6 @@
return 1;
}
-/* This function tests uninitialized buffer handles. */
-static int test_uninitialized_handle(struct gralloc_module_t *module)
-{
- struct gralloctest test;
- buffer_handle_t handle = (buffer_handle_t)(intptr_t)0xdeadbeef;
-
- gralloctest_init(&test, 512, 512, HAL_PIXEL_FORMAT_BGRA_8888,
- GRALLOC_USAGE_SW_READ_OFTEN);
-
- test.handle = handle;
-
- CHECK(register_buffer(module, &test) == 0);
- CHECK(lock(module, &test) == 0);
- CHECK(unlock(module, &test) == 0);
- CHECK(unregister_buffer(module, &test) == 0);
-
- return 1;
-}
-
-/* This function tests that deallocated buffer handles are invalid. */
-static int test_freed_handle(struct gralloc_module_t *module,
- struct alloc_device_t *device)
-{
- struct gralloctest test;
-
- gralloctest_init(&test, 512, 512, HAL_PIXEL_FORMAT_BGRA_8888,
- GRALLOC_USAGE_SW_READ_OFTEN);
-
- CHECK(allocate(device, &test));
- CHECK(deallocate(device, &test));
-
- CHECK(lock(module, &test) == 0);
- CHECK(unlock(module, &test) == 0);
-
- return 1;
-}
-
/* This function tests CPU reads and writes. */
static int test_mapping(struct gralloc_module_t *module,
struct alloc_device_t *device)
@@ -629,8 +592,7 @@
printf("usage: %s <test_name>\n\n", argv0);
printf("A valid test is one the following:\n");
printf("alloc_varying_sizes\nalloc_combinations\napi\ngralloc_order\n");
- printf("uninitialized_handle\nfreed_handle\nmapping\nperform\n");
- printf("ycbcr\nasync\n");
+ printf("mapping\nperform\nycbcr\nasync\n");
}
int main(int argc, char *argv[])
@@ -672,12 +634,6 @@
} else if (strcmp(name, "gralloc_order") == 0) {
if (!test_gralloc_order(module, device))
goto fail;
- } else if (strcmp(name, "uninitialized_handle") == 0) {
- if (!test_uninitialized_handle(module))
- goto fail;
- } else if (strcmp(name, "freed_handle") == 0) {
- if (!test_freed_handle(module, device))
- goto fail;
} else if (strcmp(name, "mapping") == 0) {
if (!test_mapping(module, device))
goto fail;