lib: add an exit code to use when invalid options are specified
authorThomas Wood <thomas.wood@intel.com>
Wed, 23 Jul 2014 15:29:39 +0000 (16:29 +0100)
committerThomas Wood <thomas.wood@intel.com>
Wed, 23 Jul 2014 15:43:05 +0000 (16:43 +0100)
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
lib/igt_core.c
lib/igt_core.h

index d90e6bb..29c969b 100644 (file)
@@ -389,15 +389,15 @@ out:
        if (!test_with_subtests) {
                if (run_single_subtest) {
                        igt_warn("Unknown subtest: %s\n", run_single_subtest);
-                       exit(-1);
+                       exit(IGT_EXIT_INVALID);
                }
                if (list_subtests)
-                       exit(-1);
+                       exit(IGT_EXIT_INVALID);
        }
 
        if (ret < 0)
                /* exit with no error for -h/--help */
-               exit(ret == -1 ? 0 : ret);
+               exit(ret == -1 ? 0 : IGT_EXIT_INVALID);
 
        print_version();
 
@@ -758,7 +758,7 @@ void igt_exit(void)
 
        if (run_single_subtest && !run_single_subtest_found) {
                igt_warn("Unknown subtest: %s\n", run_single_subtest);
-               exit(-1);
+               exit(IGT_EXIT_INVALID);
        }
 
 
index b19a897..0e84e98 100644 (file)
  */
 #define IGT_EXIT_SUCCESS 0
 
+/**
+ * IGT_EXIT_INVALID
+ *
+ * Exit status indicating an invalid option or subtest was specified
+ */
+#define IGT_EXIT_INVALID 79
+
 
 bool __igt_fixture(void);
 void __igt_fixture_complete(void);