From: Nick Bowler Date: Wed, 14 Apr 2021 23:14:54 +0000 (-0400) Subject: Properly return failure status from main. X-Git-Tag: v1.2~7 X-Git-Url: https://git.draconx.ca/gitweb/slotifier.git/commitdiff_plain/4e1fa5cd8519f2de9bd504e03c0d6394b104692a Properly return failure status from main. 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. --- diff --git a/src/slotifier.c b/src/slotifier.c index 03485f5..3998926 100644 --- a/src/slotifier.c +++ b/src/slotifier.c @@ -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 index 0000000..af2712f --- /dev/null +++ b/tests/misc.at @@ -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 . + +AT_SETUP([file load error]) + +AT_CHECK([slotifier /this/file/should/not/exist], [1], [], [ignore]) + +AT_CLEANUP diff --git a/testsuite.at b/testsuite.at index d7e6a2b..885c2ac 100644 --- a/testsuite.at +++ b/testsuite.at @@ -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])