From: Michael Jeanson Date: Mon, 14 Jan 2019 21:29:28 +0000 (-0500) Subject: Cleanup: test Makefiles X-Git-Tag: v2.12.0-rc1~60 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=37b3de59bcd96baf15c2361d64b47e4f20495fa4;p=lttng-ust.git Cleanup: test Makefiles Remove unnessary complexity and use specific names for test programs. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/.gitignore b/.gitignore index 482c6520..78646d74 100644 --- a/.gitignore +++ b/.gitignore @@ -74,14 +74,13 @@ tests/ust-multi-test/ust-multi-test tests/trace_event/trace_event_test tests/tracepoint/benchmark/tracepoint_benchmark tests/tracepoint/tracepoint_test -tests/snprintf/prog -tests/ust-elf/prog +tests/snprintf/test_snprintf +tests/ust-elf/ust-elf tests/ust-elf/test_ust_elf tests/benchmark/bench1 tests/benchmark/bench2 tests/ctf-types/ctf-types tests/test-app-ctx/hello -tests/gcc-weak-hidden/test-gcc-wh tests/gcc-weak-hidden/test_gcc_weak_hidden # Java agent library diff --git a/configure.ac b/configure.ac index f9ee053f..9ab76501 100644 --- a/configure.ac +++ b/configure.ac @@ -565,6 +565,8 @@ AC_CONFIG_LINKS([ python-lttngust/lttngust/loghandler.py:python-lttngust/lttngust/loghandler.py ]) +AC_CONFIG_FILES([tests/ust-elf/test_ust_elf],[chmod +x tests/ust-elf/test_ust_elf]) + AC_OUTPUT diff --git a/tests/gcc-weak-hidden/Makefile.am b/tests/gcc-weak-hidden/Makefile.am index eaeb2509..be9032a3 100644 --- a/tests/gcc-weak-hidden/Makefile.am +++ b/tests/gcc-weak-hidden/Makefile.am @@ -3,15 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/tests/utils noinst_LTLIBRARIES = libgcc-wh.la libgcc_wh_la_SOURCES = c.c d.c -noinst_PROGRAMS = test-gcc-wh -test_gcc_wh_SOURCES = main.c b.c -test_gcc_wh_LDADD = $(top_builddir)/tests/utils/libtap.a \ +noinst_PROGRAMS = test_gcc_weak_hidden +test_gcc_weak_hidden_SOURCES = main.c b.c +test_gcc_weak_hidden_LDADD = $(top_builddir)/tests/utils/libtap.a \ $(builddir)/libgcc-wh.la - -noinst_SCRIPTS = test_gcc_weak_hidden -CLEANFILES = $(noinst_SCRIPTS) -EXTRA_DIST = test_gcc_weak_hidden.in - -$(noinst_SCRIPTS): %: %.in - $(SED) "s#@ABSTOPSRCDIR@#$(abs_top_srcdir)#g" < $< > $@ - chmod +x $@ diff --git a/tests/gcc-weak-hidden/test_gcc_weak_hidden.in b/tests/gcc-weak-hidden/test_gcc_weak_hidden.in deleted file mode 100755 index 7ad101f7..00000000 --- a/tests/gcc-weak-hidden/test_gcc_weak_hidden.in +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -TEST_DIR=$(dirname $0) -./${TEST_DIR}/test-gcc-wh diff --git a/tests/snprintf/Makefile.am b/tests/snprintf/Makefile.am index 43021562..719e1cc8 100644 --- a/tests/snprintf/Makefile.am +++ b/tests/snprintf/Makefile.am @@ -1,24 +1,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/tests/utils -noinst_PROGRAMS = prog -prog_SOURCES = prog.c -prog_LDADD = $(top_builddir)/snprintf/libustsnprintf.la \ +noinst_PROGRAMS = test_snprintf +test_snprintf_SOURCES = snprintf.c +test_snprintf_LDADD = $(top_builddir)/snprintf/libustsnprintf.la \ $(top_builddir)/tests/utils/libtap.a - -SCRIPT_LIST = test_snprintf - -dist_noinst_SCRIPTS = $(SCRIPT_LIST) - -all-local: - @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - for script in $(SCRIPT_LIST); do \ - cp -f $(srcdir)/$$script $(builddir); \ - done; \ - fi - -clean-local: - @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ - for script in $(SCRIPT_LIST); do \ - rm -f $(builddir)/$$script; \ - done; \ - fi diff --git a/tests/snprintf/prog.c b/tests/snprintf/prog.c deleted file mode 100644 index 8d3fd5c0..00000000 --- a/tests/snprintf/prog.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2009 Pierre-Marc Fournier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "ust_snprintf.h" - -#include "tap.h" - -int main() -{ - char buf[100]; - char *expected; - char test_fmt_str[] = "header %d, %s, %03d, '%3$*d'"; - char escaped_test_fmt_str[] = "header %%d, %%s, %%03d, '%%3$*d'"; - - plan_tests(1); - - expected = "header 9999, hello, 005, ' 9'"; - ust_safe_snprintf(buf, 99, test_fmt_str, 9999, "hello", 5, 9); - - char test_desc_fmt_str[] = "Got expected output string with format string \"%s\""; - char test_desc[sizeof(escaped_test_fmt_str) + sizeof(test_desc_fmt_str) - 1]; - sprintf(test_desc, test_desc_fmt_str, escaped_test_fmt_str); - ok(strcmp(buf, expected) == 0, test_desc); - - return 0; -} diff --git a/tests/snprintf/snprintf.c b/tests/snprintf/snprintf.c new file mode 100644 index 00000000..8d3fd5c0 --- /dev/null +++ b/tests/snprintf/snprintf.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2009 Pierre-Marc Fournier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include "ust_snprintf.h" + +#include "tap.h" + +int main() +{ + char buf[100]; + char *expected; + char test_fmt_str[] = "header %d, %s, %03d, '%3$*d'"; + char escaped_test_fmt_str[] = "header %%d, %%s, %%03d, '%%3$*d'"; + + plan_tests(1); + + expected = "header 9999, hello, 005, ' 9'"; + ust_safe_snprintf(buf, 99, test_fmt_str, 9999, "hello", 5, 9); + + char test_desc_fmt_str[] = "Got expected output string with format string \"%s\""; + char test_desc[sizeof(escaped_test_fmt_str) + sizeof(test_desc_fmt_str) - 1]; + sprintf(test_desc, test_desc_fmt_str, escaped_test_fmt_str); + ok(strcmp(buf, expected) == 0, test_desc); + + return 0; +} diff --git a/tests/snprintf/test_snprintf b/tests/snprintf/test_snprintf deleted file mode 100755 index cc77d408..00000000 --- a/tests/snprintf/test_snprintf +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -TEST_DIR=$(dirname $0) -./${TEST_DIR}/prog diff --git a/tests/ust-elf/Makefile.am b/tests/ust-elf/Makefile.am index 203272ed..f115eea4 100644 --- a/tests/ust-elf/Makefile.am +++ b/tests/ust-elf/Makefile.am @@ -1,13 +1,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/tests/utils -noinst_PROGRAMS = prog -prog_SOURCES = prog.c -prog_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la \ +noinst_PROGRAMS = ust-elf +ust_elf_SOURCES = ust-elf.c +ust_elf_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la \ $(top_builddir)/tests/utils/libtap.a -noinst_SCRIPTS = test_ust_elf -CLEANFILES = $(noinst_SCRIPTS) -EXTRA_DIST = test_ust_elf.in \ +EXTRA_DIST = \ $(srcdir)/data/main.c \ $(srcdir)/data/aarch64_be/main.elf \ $(srcdir)/data/aarch64_be/main.elf.debug \ @@ -22,7 +20,3 @@ EXTRA_DIST = test_ust_elf.in \ $(srcdir)/data/pic/hello.pic \ $(srcdir)/data/pic/hello.c \ $(srcdir)/data/pic/libhello.c - -$(noinst_SCRIPTS): %: %.in - $(SED) "s#@ABSTOPSRCDIR@#$(abs_top_srcdir)#g" < $< > $@ - chmod +x $@ diff --git a/tests/ust-elf/prog.c b/tests/ust-elf/prog.c deleted file mode 100644 index 4036563a..00000000 --- a/tests/ust-elf/prog.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2015 Antoine Busque - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include - -#include -#include "tap.h" - -#define NUM_ARCH 4 -#define NUM_TESTS_PER_ARCH 11 -#define NUM_TESTS_PIC 3 -#define NUM_TESTS (NUM_ARCH * NUM_TESTS_PER_ARCH) + NUM_TESTS_PIC + 1 - -/* - * Expected memsz were computed using libelf, build ID and debug link - * were determined through readelf. - */ -#define X86_MEMSZ 5732 -#define X86_64_MEMSZ 2099376 -#define ARMEB_MEMSZ 34196 -#define AARCH64_BE_MEMSZ 67632 - -#define X86_CRC 0x1531f73c -#define X86_64_CRC 0xa048a98f -#define ARMEB_CRC 0x9d40261b -#define AARCH64_BE_CRC 0x2b8cedce - -#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, - const uint8_t *exp_build_id, uint32_t exp_crc) -{ - char path[PATH_MAX]; - struct lttng_ust_elf *elf = NULL; - int ret = 0; - uint64_t memsz = 0; - int has_build_id = 0; - uint8_t *build_id = NULL; - size_t build_id_len = 0; - int has_debug_link = 0; - char *dbg_file = NULL; - uint32_t crc = 0; - - diag("Testing %s support", arch); - - snprintf(path, PATH_MAX, "%s/data/%s/main.elf", test_dir, arch); - elf = lttng_ust_elf_create(path); - ok(elf != NULL, "lttng_ust_elf_create"); - - ret = lttng_ust_elf_get_memsz(elf, &memsz); - ok(ret == 0, "lttng_ust_elf_get_memsz returned successfully"); - ok(memsz == exp_memsz, - "memsz - expected: %lu, got: %lu", - exp_memsz, memsz); - - ret = lttng_ust_elf_get_build_id(elf, &build_id, &build_id_len, - &has_build_id); - ok(ret == 0, "lttng_ust_elf_get_build_id returned successfully"); - ok(has_build_id == 1, "build id marked as found"); - ok(build_id_len == BUILD_ID_LEN, - "build_id_len - expected: %u, got: %u", - BUILD_ID_LEN, build_id_len); - ok(memcmp(build_id, exp_build_id, build_id_len) == 0, - "build_id has expected value"); - - ret = lttng_ust_elf_get_debug_link(elf, &dbg_file, &crc, - &has_debug_link); - ok(ret == 0, "lttng_ust_elf_get_debug_link returned successfully"); - ok(has_debug_link == 1, "debug link marked as found"); - ok(dbg_file && strcmp(dbg_file, DBG_FILE) == 0, - "debug link filename - expected: %s, got: %s", - DBG_FILE, dbg_file); - ok(crc == exp_crc, - "debug link crc - expected: %#x, got: %#x", - exp_crc, crc); - - free(build_id); - free(dbg_file); - lttng_ust_elf_destroy(elf); -} - -static -void test_pic(const char *test_dir) -{ - char exec_path[PATH_MAX]; - char pie_path[PATH_MAX]; - char pic_path[PATH_MAX]; - struct lttng_ust_elf *elf = NULL; - uint8_t is_pic; - - snprintf(exec_path, PATH_MAX, "%s/data/pic/hello.exec", test_dir); - snprintf(pie_path, PATH_MAX, "%s/data/pic/hello.pie", test_dir); - snprintf(pic_path, PATH_MAX, "%s/data/pic/hello.pic", test_dir); - - elf = lttng_ust_elf_create(exec_path); - is_pic = lttng_ust_elf_is_pic(elf); - ok(is_pic == 0, "hello.exec is not PIC"); - lttng_ust_elf_destroy(elf); - - elf = lttng_ust_elf_create(pie_path); - is_pic = lttng_ust_elf_is_pic(elf); - ok(is_pic == 1, "hello.pie is PIC"); - lttng_ust_elf_destroy(elf); - - elf = lttng_ust_elf_create(pic_path); - is_pic = lttng_ust_elf_is_pic(elf); - ok(is_pic == 1, "hello.pic is PIC"); - lttng_ust_elf_destroy(elf); -} - -int main(int argc, char **argv) -{ - const char *test_dir; - - plan_tests(NUM_TESTS); - - ok(argc == 2, "Invoke as: %s ", argv[0]); - if (argc != 2) { - return EXIT_FAILURE; - } else { - 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, - AARCH64_BE_CRC); - test_pic(test_dir); - - return EXIT_SUCCESS; -} diff --git a/tests/ust-elf/test_ust_elf.in b/tests/ust-elf/test_ust_elf.in old mode 100755 new mode 100644 index 03a995fc..5aed2cba --- a/tests/ust-elf/test_ust_elf.in +++ b/tests/ust-elf/test_ust_elf.in @@ -1,4 +1,4 @@ #!/bin/bash -TEST_DIR=$(dirname $0) -./${TEST_DIR}/prog @ABSTOPSRCDIR@/tests/ust-elf +TEST_DIR=$(dirname "$0") +"${TEST_DIR}/ust-elf" "@abs_top_srcdir@/tests/ust-elf" diff --git a/tests/ust-elf/ust-elf.c b/tests/ust-elf/ust-elf.c new file mode 100644 index 00000000..4036563a --- /dev/null +++ b/tests/ust-elf/ust-elf.c @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2015 Antoine Busque + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include + +#include +#include "tap.h" + +#define NUM_ARCH 4 +#define NUM_TESTS_PER_ARCH 11 +#define NUM_TESTS_PIC 3 +#define NUM_TESTS (NUM_ARCH * NUM_TESTS_PER_ARCH) + NUM_TESTS_PIC + 1 + +/* + * Expected memsz were computed using libelf, build ID and debug link + * were determined through readelf. + */ +#define X86_MEMSZ 5732 +#define X86_64_MEMSZ 2099376 +#define ARMEB_MEMSZ 34196 +#define AARCH64_BE_MEMSZ 67632 + +#define X86_CRC 0x1531f73c +#define X86_64_CRC 0xa048a98f +#define ARMEB_CRC 0x9d40261b +#define AARCH64_BE_CRC 0x2b8cedce + +#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, + const uint8_t *exp_build_id, uint32_t exp_crc) +{ + char path[PATH_MAX]; + struct lttng_ust_elf *elf = NULL; + int ret = 0; + uint64_t memsz = 0; + int has_build_id = 0; + uint8_t *build_id = NULL; + size_t build_id_len = 0; + int has_debug_link = 0; + char *dbg_file = NULL; + uint32_t crc = 0; + + diag("Testing %s support", arch); + + snprintf(path, PATH_MAX, "%s/data/%s/main.elf", test_dir, arch); + elf = lttng_ust_elf_create(path); + ok(elf != NULL, "lttng_ust_elf_create"); + + ret = lttng_ust_elf_get_memsz(elf, &memsz); + ok(ret == 0, "lttng_ust_elf_get_memsz returned successfully"); + ok(memsz == exp_memsz, + "memsz - expected: %lu, got: %lu", + exp_memsz, memsz); + + ret = lttng_ust_elf_get_build_id(elf, &build_id, &build_id_len, + &has_build_id); + ok(ret == 0, "lttng_ust_elf_get_build_id returned successfully"); + ok(has_build_id == 1, "build id marked as found"); + ok(build_id_len == BUILD_ID_LEN, + "build_id_len - expected: %u, got: %u", + BUILD_ID_LEN, build_id_len); + ok(memcmp(build_id, exp_build_id, build_id_len) == 0, + "build_id has expected value"); + + ret = lttng_ust_elf_get_debug_link(elf, &dbg_file, &crc, + &has_debug_link); + ok(ret == 0, "lttng_ust_elf_get_debug_link returned successfully"); + ok(has_debug_link == 1, "debug link marked as found"); + ok(dbg_file && strcmp(dbg_file, DBG_FILE) == 0, + "debug link filename - expected: %s, got: %s", + DBG_FILE, dbg_file); + ok(crc == exp_crc, + "debug link crc - expected: %#x, got: %#x", + exp_crc, crc); + + free(build_id); + free(dbg_file); + lttng_ust_elf_destroy(elf); +} + +static +void test_pic(const char *test_dir) +{ + char exec_path[PATH_MAX]; + char pie_path[PATH_MAX]; + char pic_path[PATH_MAX]; + struct lttng_ust_elf *elf = NULL; + uint8_t is_pic; + + snprintf(exec_path, PATH_MAX, "%s/data/pic/hello.exec", test_dir); + snprintf(pie_path, PATH_MAX, "%s/data/pic/hello.pie", test_dir); + snprintf(pic_path, PATH_MAX, "%s/data/pic/hello.pic", test_dir); + + elf = lttng_ust_elf_create(exec_path); + is_pic = lttng_ust_elf_is_pic(elf); + ok(is_pic == 0, "hello.exec is not PIC"); + lttng_ust_elf_destroy(elf); + + elf = lttng_ust_elf_create(pie_path); + is_pic = lttng_ust_elf_is_pic(elf); + ok(is_pic == 1, "hello.pie is PIC"); + lttng_ust_elf_destroy(elf); + + elf = lttng_ust_elf_create(pic_path); + is_pic = lttng_ust_elf_is_pic(elf); + ok(is_pic == 1, "hello.pic is PIC"); + lttng_ust_elf_destroy(elf); +} + +int main(int argc, char **argv) +{ + const char *test_dir; + + plan_tests(NUM_TESTS); + + ok(argc == 2, "Invoke as: %s ", argv[0]); + if (argc != 2) { + return EXIT_FAILURE; + } else { + 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, + AARCH64_BE_CRC); + test_pic(test_dir); + + return EXIT_SUCCESS; +}