]> git.draconx.ca Git - slotifier.git/commitdiff
Properly return failure status from main.
authorNick Bowler <nbowler@draconx.ca>
Wed, 14 Apr 2021 23:14:54 +0000 (19:14 -0400)
committerNick Bowler <nbowler@draconx.ca>
Thu, 15 Apr 2021 01:16:12 +0000 (21:16 -0400)
Due to an oversight, several failure cases in main are not properly
causing slotifier to exit with a failure status.  Fix that up, and
add a test case which tickles one of the affected error paths.

src/slotifier.c
tests/misc.at [new file with mode: 0644]
testsuite.at

index 03485f5b88d37d76749560c181fca7c8faad2bbd..3998926e490c15bb94eb884d602a5fba8c112ed5 100644 (file)
@@ -439,5 +439,5 @@ int main(int argc, char **argv)
                ret = EXIT_FAILURE;
 out:
        gerbv_destroy_project(gp);
-       return 0;
+       return ret;
 }
diff --git a/tests/misc.at b/tests/misc.at
new file mode 100644 (file)
index 0000000..af2712f
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright © 2021 Nick Bowler
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+AT_SETUP([file load error])
+
+AT_CHECK([slotifier /this/file/should/not/exist], [1], [], [ignore])
+
+AT_CLEANUP
index d7e6a2bb02fc3b7a8eb01373e653a738ebca31c5..885c2accc874e13b7bb806f945343acbcfbb3030 100644 (file)
@@ -1,4 +1,4 @@
-AT_COPYRIGHT([Copyright © 2018 Nick Bowler])
+AT_COPYRIGHT([Copyright © 2018, 2021 Nick Bowler])
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -19,3 +19,4 @@ AT_COLOR_TESTS
 AT_TESTED([slotifier])
 
 m4_include([tests/simple.at])
+m4_include([tests/misc.at])