tests: Bump alignment for test structures to 64 bytes

Our core test structure is 36 bytes wide. Declaring it with a 32-bit
alignment should thus stripe it to 64 bytes. For some reason, clang+lld
lays them out with a 96-byte stride within the section (does it want an
entire 32-bit word when building with ASan?), getting the code wildly
confused when it tries to step through the structures.

So we could fix all our tests to avoid the fragile section dance, or we
could just waste another 4 bytes per test definition by bumping the
alignment up to 64 bytes, which seems to do enough to magically accord
with what clang+lld+ASan expect.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent fa6ae44719
commit ccb64f301c
  1. 2
      tests/ivi-layout-test-plugin.c
  2. 2
      tests/weston-test-runner.h
  3. 2
      tools/zunitc/inc/zunitc/zunitc_impl.h

@ -47,7 +47,7 @@ struct test_context;
struct runner_test { struct runner_test {
const char *name; const char *name;
void (*run)(struct test_context *); void (*run)(struct test_context *);
} __attribute__ ((aligned (32))); } __attribute__ ((aligned (64)));
#define RUNNER_TEST(name) \ #define RUNNER_TEST(name) \
static void runner_func_##name(struct test_context *); \ static void runner_func_##name(struct test_context *); \

@ -55,7 +55,7 @@ struct weston_test_entry {
const void *table_data; const void *table_data;
size_t element_size; size_t element_size;
int n_elements; int n_elements;
} __attribute__ ((aligned (32))); } __attribute__ ((aligned (64)));
#define TEST_BEGIN(name, arg) \ #define TEST_BEGIN(name, arg) \
static void name(arg) static void name(arg)

@ -77,7 +77,7 @@ struct zuc_registration {
zucimpl_test_fn fn; /**< function implementing base test. */ zucimpl_test_fn fn; /**< function implementing base test. */
zucimpl_test_fn_f fn_f; /**< function implementing test with zucimpl_test_fn_f fn_f; /**< function implementing test with
fixture. */ fixture. */
} __attribute__ ((aligned (32))); } __attribute__ ((aligned (64)));
int int

Loading…
Cancel
Save