From: Mathieu Desnoyers Date: Mon, 31 Aug 2015 21:25:07 +0000 (-0400) Subject: test: elf move constants to top of implementation X-Git-Tag: v2.8.0-rc1~95 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8d8a8c5c04302d2c33face8a9f8f4c5d9c6299fd;p=lttng-ust.git test: elf move constants to top of implementation Declare them static const. Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/ust-elf/prog.c b/tests/ust-elf/prog.c index a39bbc5f..5090bcf7 100644 --- a/tests/ust-elf/prog.c +++ b/tests/ust-elf/prog.c @@ -45,9 +45,26 @@ #define BUILD_ID_LEN 20 #define DBG_FILE "main.elf.debug" +static const uint8_t x86_build_id[BUILD_ID_LEN] = { + 0x27, 0x79, 0x2a, 0xe7, 0xaa, 0xef, 0x72, 0x5c, 0x9c, 0x52, + 0x80, 0xec, 0x1e, 0x18, 0xd8, 0x09, 0x02, 0xba, 0xbc, 0x82 +}; +static const uint8_t x86_64_build_id[BUILD_ID_LEN] = { + 0x0f, 0x87, 0xb2, 0xe2, 0x24, 0x9c, 0xe1, 0xc2, 0x24, 0xb1, + 0xf8, 0xb6, 0x65, 0x83, 0xa3, 0xc1, 0xcb, 0x30, 0x5c, 0x63 +}; +static const uint8_t armeb_build_id[BUILD_ID_LEN] = { + 0x60, 0x5d, 0x26, 0xa0, 0x0e, 0x30, 0xa4, 0x29, 0xf4, 0xf1, + 0x85, 0x53, 0xda, 0x90, 0x68, 0xe1, 0xf5, 0x67, 0xbe, 0x42 +}; +static const uint8_t aarch64_be_build_id[BUILD_ID_LEN] = { + 0xb9, 0x0a, 0xa0, 0xed, 0xd1, 0x41, 0x42, 0xc3, 0x34, 0x85, + 0xfa, 0x27, 0x2e, 0xa9, 0x2f, 0xd2, 0xe4, 0xf7, 0xb6, 0x60 +}; + static void test_elf(const char *test_dir, const char *arch, uint64_t exp_memsz, - uint8_t *exp_build_id, uint32_t exp_crc) + const uint8_t *exp_build_id, uint32_t exp_crc) { char path[PATH_MAX]; struct lttng_ust_elf *elf = NULL; @@ -100,22 +117,6 @@ void test_elf(const char *test_dir, const char *arch, uint64_t exp_memsz, int main(int argc, char **argv) { - uint8_t X86_BUILD_ID[BUILD_ID_LEN] = { - 0x27, 0x79, 0x2a, 0xe7, 0xaa, 0xef, 0x72, 0x5c, 0x9c, 0x52, - 0x80, 0xec, 0x1e, 0x18, 0xd8, 0x09, 0x02, 0xba, 0xbc, 0x82 - }; - uint8_t X86_64_BUILD_ID[BUILD_ID_LEN] = { - 0x0f, 0x87, 0xb2, 0xe2, 0x24, 0x9c, 0xe1, 0xc2, 0x24, 0xb1, - 0xf8, 0xb6, 0x65, 0x83, 0xa3, 0xc1, 0xcb, 0x30, 0x5c, 0x63 - }; - uint8_t ARMEB_BUILD_ID[BUILD_ID_LEN] = { - 0x60, 0x5d, 0x26, 0xa0, 0x0e, 0x30, 0xa4, 0x29, 0xf4, 0xf1, - 0x85, 0x53, 0xda, 0x90, 0x68, 0xe1, 0xf5, 0x67, 0xbe, 0x42 - }; - uint8_t AARCH64_BE_BUILD_ID[BUILD_ID_LEN] = { - 0xb9, 0x0a, 0xa0, 0xed, 0xd1, 0x41, 0x42, 0xc3, 0x34, 0x85, - 0xfa, 0x27, 0x2e, 0xa9, 0x2f, 0xd2, 0xe4, 0xf7, 0xb6, 0x60 - }; const char *test_dir; plan_tests(NUM_TESTS); @@ -127,10 +128,10 @@ int main(int argc, char **argv) test_dir = argv[1]; } - test_elf(test_dir, "x86", X86_MEMSZ, X86_BUILD_ID, X86_CRC); - test_elf(test_dir, "x86_64", X86_64_MEMSZ, X86_64_BUILD_ID, X86_64_CRC); - test_elf(test_dir, "armeb", ARMEB_MEMSZ, ARMEB_BUILD_ID, ARMEB_CRC); - test_elf(test_dir, "aarch64_be", AARCH64_BE_MEMSZ, AARCH64_BE_BUILD_ID, + test_elf(test_dir, "x86", X86_MEMSZ, x86_build_id, X86_CRC); + test_elf(test_dir, "x86_64", X86_64_MEMSZ, x86_64_build_id, X86_64_CRC); + test_elf(test_dir, "armeb", ARMEB_MEMSZ, armeb_build_id, ARMEB_CRC); + test_elf(test_dir, "aarch64_be", AARCH64_BE_MEMSZ, aarch64_be_build_id, AARCH64_BE_CRC); return EXIT_SUCCESS;