diff --git a/tests/stack-args/main.c b/tests/stack-args/main.c index 1b99266..0e80495 100644 --- a/tests/stack-args/main.c +++ b/tests/stack-args/main.c @@ -9,8 +9,18 @@ #include "interposed.h" -int main() { - foo(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - bar(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); +#include +#include + +int main(int argc, char *argv[]) { + argc = argc; + if (0 == strcmp(argv[1], "int")) { + foo(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + } else if (0 == strcmp(argv[1], "float")) { + bar(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + } else { + fprintf(stderr, "Invalid option: %s\n", argv[1]); + return 1; + } return 0; } diff --git a/tests/stack-args/run.sh b/tests/stack-args/run.sh index 057e908..39e0bfc 100755 --- a/tests/stack-args/run.sh +++ b/tests/stack-args/run.sh @@ -32,7 +32,10 @@ ${PYTHON:-} ../../implib-gen.py -q --target $TARGET libinterposed.so # Build app $CC $CFLAGS main.c libinterposed.so.tramp.S libinterposed.so.init.c $LIBS -LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out > a.out.log +LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out int > a.out.log +diff test.ref a.out.log + +LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH:-} $INTERP ./a.out float > a.out.log diff test.ref a.out.log echo SUCCESS diff --git a/tests/stack-args/test.ref b/tests/stack-args/test.ref index 7bbdd5b..591a301 100644 --- a/tests/stack-args/test.ref +++ b/tests/stack-args/test.ref @@ -1,2 +1 @@ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15