summaryrefslogtreecommitdiff
path: root/tests/bad-buffer-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bad-buffer-test.c')
-rw-r--r--tests/bad-buffer-test.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/tests/bad-buffer-test.c b/tests/bad-buffer-test.c
index 86e0299b..3b54ac6a 100644
--- a/tests/bad-buffer-test.c
+++ b/tests/bad-buffer-test.c
@@ -60,34 +60,12 @@ create_bad_shm_buffer(struct client *client, int width, int height)
return buffer;
}
-static void sighandler(int signum)
-{
- /* this means failure */
- exit(0);
-}
-
-FAIL_TEST(test_truncated_shm_file)
+TEST(test_truncated_shm_file)
{
struct client *client;
struct wl_buffer *bad_buffer;
struct wl_surface *surface;
int frame;
- struct sigaction new_action, old_action;
-
- /* until the bad buffer creation, the SIGABRT or SIGSEGV signals
- * should fail the test. That means returning 0 */
- new_action.sa_handler = sighandler;
- sigemptyset(&new_action.sa_mask);
- new_action.sa_flags = 0;
-
- if (sigaction(SIGSEGV, &new_action, NULL) != 0) {
- fprintf(stderr, "Failed setting new sigaction for SIGSEGV");
- exit(0);
- }
- if (sigaction(SIGABRT, &new_action, &old_action) != 0) {
- fprintf(stderr, "Failed setting new sigaction for SIGABRT");
- exit(0);
- }
client = client_create(46, 76, 111, 134);
assert(client);
@@ -95,15 +73,12 @@ FAIL_TEST(test_truncated_shm_file)
bad_buffer = create_bad_shm_buffer(client, 200, 200);
- /* from this point we expect the signal */
- if (sigaction(SIGABRT, &old_action, NULL) != 0) {
- fprintf(stderr, "Failed setting old sigaction for SIGABRT");
- exit(0);
- }
-
wl_surface_attach(surface, bad_buffer, 0, 0);
wl_surface_damage(surface, 0, 0, 200, 200);
frame_callback_set(surface, &frame);
wl_surface_commit(surface);
- frame_callback_wait(client, &frame);
+ frame_callback_wait_nofail(client, &frame);
+
+ expect_protocol_error(client, &wl_buffer_interface,
+ WL_SHM_ERROR_INVALID_FD);
}