summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2013-07-09 14:22:55 +0300
committerUri Lublin <uril@redhat.com>2013-07-16 23:37:27 +0300
commitb66d755447c0b91e4d09bbe2d942696106514046 (patch)
tree5f7e01976930e727fa0a7f448c145ec3e7e5770c /server
parentcbcd9eea363d287708e244e5afa3d25e9aa00810 (diff)
downloadspice-b66d755447c0b91e4d09bbe2d942696106514046.tar.gz
spice-b66d755447c0b91e4d09bbe2d942696106514046.tar.xz
spice-b66d755447c0b91e4d09bbe2d942696106514046.zip
server/tests: remove option from usage if AUTOMATED_TESTS is not configured
Diffstat (limited to 'server')
-rw-r--r--server/tests/test_display_base.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index a4fdae9e..d8ff8d1f 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -62,6 +62,7 @@ static int control = 3; //used to know when we can take a screenshot
static int rects = 16; //number of rects that will be draw
static int has_automated_tests = 0; //automated test flag
+__attribute__((noreturn))
static void sigchld_handler(int signal_num) // wait for the child process and exit
{
int status;
@@ -878,6 +879,19 @@ void init_automated()
sigaction(SIGCHLD, &sa, NULL);
}
+__attribute__((noreturn))
+void usage(const char *argv0, const int exitcode)
+{
+#ifdef AUTOMATED_TESTS
+ const char *autoopt=" [--automated-tests]";
+#else
+ const char *autoopt="";
+#endif
+
+ printf("usage: %s%s\n", argv0, autoopt);
+ exit(exitcode);
+}
+
void spice_test_config_parse_args(int argc, char **argv)
{
struct option options[] = {
@@ -893,19 +907,18 @@ void spice_test_config_parse_args(int argc, char **argv)
switch (val) {
case '?':
printf("unrecognized option '%s'\n", argv[optind - 1]);
- goto invalid_option;
+ usage(argv[0], EXIT_FAILURE);
case 0:
break;
}
}
+ if (argc > optind) {
+ printf("unknown argument '%s'\n", argv[optind]);
+ usage(argv[0], EXIT_FAILURE);
+ }
if (has_automated_tests) {
init_automated();
}
return;
-
-invalid_option:
- printf("Invalid option!\n"
- "usage: %s [--automated-tests]\n", argv[0]);
- exit(0);
}