test: elf move constants to top of implementation
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 31 Aug 2015 21:25:07 +0000 (17:25 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 31 Aug 2015 22:27:42 +0000 (18:27 -0400)
Declare them static const.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/ust-elf/prog.c

index a39bbc5f02427b7c0c5d4cf03b4c7ddffef30e57..5090bcf75da26912f4972e86a606c581a8a79f4a 100644 (file)
 #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;
This page took 0.026413 seconds and 4 git commands to generate.