Fix: Tests: `gen-ust-events` doesn't error out on invalid option
[lttng-tools.git] / tests / utils / testapp / gen-ust-events / gen-ust-events.c
index 353523b7c2c3ccd18d8f4fcf0b8f908dc35a0065..7ce86bcaeb874de64a7a282d65a928d68b171e69 100644 (file)
@@ -1,18 +1,8 @@
 /*
- * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
+ * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
  *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; version 2.1 of the License.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
 #define _LGPL_SOURCE
@@ -100,7 +90,6 @@ int main(int argc, char **argv)
                        break;
                case '?':
                        /* getopt_long already printed an error message. */
-                       break;
                default:
                        ret = -1;
                        goto end;
@@ -109,6 +98,17 @@ int main(int argc, char **argv)
 
        if (optind != argc) {
                fprintf(stderr, "Error: takes long options only.\n");
+
+               /*
+                * Aborting the test program for now because callers typically don't check
+                * the test program return value, and the transition from positional
+                * arguments to getopt causes hangs when caller scripts are not updated.
+                * An abort is easier to diagnose and fix. This is a temporary solution:
+                * we should eventually ensure that all scripts test and report the test
+                * app return values.
+                */
+               abort();
+
                ret = -1;
                goto end;
        }
This page took 0.023569 seconds and 4 git commands to generate.