lib/tst_test: Warn on repeated options

The library is not designed in a way that would allow us to pass an
option mutiple times, in such case the last option occurence replaces
all previous ones.

This patch adds a warning in a case that the option pointer is non-NULL,
which means that it has been set at least once already.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
diff --git a/lib/tst_test.c b/lib/tst_test.c
index c7b46d0..fbec56a 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -468,6 +468,9 @@
 	if (i >= topts_len)
 		tst_brk(TBROK, "Invalid option '%c' (should not happen)", opt);
 
+	if (*toptions[i].arg)
+		tst_res(TWARN, "Option -%c passed multiple times", opt);
+
 	*(toptions[i].arg) = optarg ? optarg : "";
 }