mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
tests: Make g_aligned_alloc tests fail if preconditions aren't checked
Previously, these tests would always pass. If the precondition check failed (as we want it to), the subprocess would exit unsuccessfully; but if the precondition check wrongly passed, the subprocess would continue, allocate a nonzero amount of memory, and fail the g_assert_null(), resulting in the subprocess exiting unsuccessfully and the test still passing. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
@@ -922,7 +922,7 @@ aligned_alloc_nz (void)
|
||||
|
||||
/* Test an alignment that’s zero */
|
||||
a = g_aligned_alloc (16, sizeof(char), 0);
|
||||
g_assert_null (a);
|
||||
g_aligned_free (a);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ aligned_alloc_npot (void)
|
||||
|
||||
/* Test an alignment that’s not a power of two */
|
||||
a = g_aligned_alloc (16, sizeof(char), 15);
|
||||
g_assert_null (a);
|
||||
g_aligned_free (a);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -944,7 +944,7 @@ aligned_alloc_nmov (void)
|
||||
|
||||
/* Test an alignment that’s not a multiple of sizeof(void*) */
|
||||
a = g_aligned_alloc (16, sizeof(char), sizeof(void *) / 2);
|
||||
g_assert_null (a);
|
||||
g_aligned_free (a);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user