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
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 <<EOF > 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 <string>"
--- /dev/null
+#include <forb.h>
+#include <stdio.h>
+
+int forb_main(forb_orb orb, int argc, char *argv[])
+{
+ int i;
+ for (i=0; i<argc; i++)
+ printf("%s%s", argv[i], i+1 < argc ? " " : "");
+ printf("\n");
+ if (argc < 2 || strcmp(argv[1], "--exit") != 0) {
+ /* Allow starting the next shared library */
+ forb_signal_server_ready(orb);
+ /* Exit only this thread, not the whole forbrun */
+ pthread_exit(0);
+ }
+ return 0;
+}