Skip to content

Commit

Permalink
Set non-zero exit code if init.g not found
Browse files Browse the repository at this point in the history
Also make the error message in this case visible again.
  • Loading branch information
fingolfin committed Dec 19, 2023
1 parent 25a58b0 commit ad01b66
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dev/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ GAPInput
;;

testexpect)
INPUTRC=/tmp/inputrc expect -c "spawn $GAP -A -b --cover $COVDIR/${TEST_SUITE}.coverage" $SRCDIR/dev/gaptest.expect
INPUTRC=/tmp/inputrc expect -c "spawn $GAP -A -b --cover $COVDIR/${TEST_SUITE}.coverage" $SRCDIR/dev/gaptest.expect
INPUTRC=/tmp/inputrc expect -c "spawn $GAP -A -b --cover $COVDIR/${TEST_SUITE}.coverage -l missing-dir" $SRCDIR/dev/gaptest2.expect
;;

*)
Expand Down
10 changes: 10 additions & 0 deletions dev/gaptest2.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set timeout 10

# from https://serverfault.com/a/981762
expect_before {
timeout { puts " TIMEOUT "; exit 2 }
eof { puts " EOF "; exit 1 }
}

expect "gap: hmm, I cannot find 'lib/init.g' maybe use option '-l <gaproot>'?"
exit
6 changes: 3 additions & 3 deletions src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +1524,9 @@ void InitializeGap (
if ( SyLoadSystemInitFile ) {
GAP_TRY {
if ( READ_GAP_ROOT("lib/init.g") == 0 ) {
Pr( "gap: hmm, I cannot find 'lib/init.g' maybe",
0, 0);
Pr( " use option '-l <gaproot>'?", 0, 0);
Pr( "gap: hmm, I cannot find 'lib/init.g' maybe"

Check warning on line 1527 in src/gap.c

View check run for this annotation

Codecov / codecov/patch

src/gap.c#L1527

Added line #L1527 was not covered by tests
" use option '-l <gaproot>'?\n", 0, 0);
SystemErrorCode = 1;

Check warning on line 1529 in src/gap.c

View check run for this annotation

Codecov / codecov/patch

src/gap.c#L1529

Added line #L1529 was not covered by tests
}
}
GAP_CATCH {
Expand Down

0 comments on commit ad01b66

Please sign in to comment.