From 51a2acb4f65c0ea1a5a169ee92693068f2a8769c Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 18 Feb 2011 22:40:50 +0100 Subject: [PATCH] forb: Add tests for forbrun command line parameters --- src/forb/src/forbrun/tests/Makefile.omk | 4 ++++ src/forb/src/forbrun/tests/forbrun.sh | 13 ++++++++++++- src/forb/src/forbrun/tests/forbrun_printargs.c | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/forb/src/forbrun/tests/forbrun_printargs.c diff --git a/src/forb/src/forbrun/tests/Makefile.omk b/src/forb/src/forbrun/tests/Makefile.omk index 2eaa706e..220ab1ce 100644 --- a/src/forb/src/forbrun/tests/Makefile.omk +++ b/src/forb/src/forbrun/tests/Makefile.omk @@ -8,6 +8,10 @@ shared_LIBRARIES += test_client test_client_SOURCES = test_client.c test_client_CLIENT_IDL = test_obj.idl +shared_LIBRARIES += forbrun_printargs +forbrun_printargs_SOURCES = forbrun_printargs.c + + INCLUDES += -I. lib_LOADLIBES = forb ulut fosa rt wvtest diff --git a/src/forb/src/forbrun/tests/forbrun.sh b/src/forb/src/forbrun/tests/forbrun.sh index 7c5fde1e..0faad99b 100755 --- a/src/forb/src/forbrun/tests/forbrun.sh +++ b/src/forb/src/forbrun/tests/forbrun.sh @@ -5,7 +5,18 @@ WVSTART "Without any parameters do nothing" WVPASS forbrun -WVSTART "argv[0] in forb_main() contains the name of the library" +WVSTART "Passing of command line parameters to forb_main() in libraries" +WVPASS sh -c 'forbrun -- libforbrun_printargs.so \ + -- libforbrun_printargs.so 1 2 3 4 \ + -- libforbrun_printargs.so --exit > output' +cat < expected +libforbrun_printargs.so +libforbrun_printargs.so 1 2 3 4 +libforbrun_printargs.so --exit +EOF +WVPASS diff -u expected output + +WVSTART "Non-zero return value in forb_main() causes forbrun to fail " WVFAIL sh -c 'forbrun -- libtest_obj.so 2> error' WVPASSEQ "$(cat error)" "Usage: libtest_obj.so " diff --git a/src/forb/src/forbrun/tests/forbrun_printargs.c b/src/forb/src/forbrun/tests/forbrun_printargs.c new file mode 100644 index 00000000..86aa4eb7 --- /dev/null +++ b/src/forb/src/forbrun/tests/forbrun_printargs.c @@ -0,0 +1,17 @@ +#include +#include + +int forb_main(forb_orb orb, int argc, char *argv[]) +{ + int i; + for (i=0; i