Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'gap --version' to send its output to stdout and include a trailing newline #5864

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions dev/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,24 @@ GAPInput
testexpect)
INPUTRC=/tmp/inputrc expect -c "spawn $GAP -A -b $(gap_cover_arg 1)" $SRCDIR/dev/gaptest.expect
INPUTRC=/tmp/inputrc expect -c "spawn $GAP -A -b $(gap_cover_arg 2) -l missing-dir" $SRCDIR/dev/gaptest2.expect

# not using expect but in a similar vein: check `gap --version output`
echo "Testing 'gap --version'"
$GAP --version 0>gap_stdin 1>gap_stdout 2>gap_stderr
if [ -s gap_stdin ] ; then
echo "Error, 'gap --version' prints to stdin but should not"
exit 1
fi
if [ -s gap_stderr ] ; then
echo "Error, 'gap --version' prints to stderr but should not"
exit 1
fi
if ! fgrep -q 'GAP 4.' gap_stdout; then
# must look like "GAP 4.X.y ..."
echo "Error, 'gap --version' does not print expected output to stdout"
exit 1
fi

;;

*)
Expand Down
3 changes: 2 additions & 1 deletion src/gasman.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
#endif

#ifdef GAP_MEM_CHECK
#include <stdio.h>
#include <sys/mman.h>
#endif

Expand Down Expand Up @@ -1140,7 +1141,7 @@

Int enableMemCheck(Char ** argv, void * dummy)
{
SyFputs( "# Warning: --enableMemCheck causes SEVERE slowdowns. Starting GAP may take several days!\n", 3 );
fputs("# Warning: --enableMemCheck causes SEVERE slowdowns. Starting GAP may take several days!\n", stderr);

Check warning on line 1144 in src/gasman.c

View check run for this annotation

Codecov / codecov/patch

src/gasman.c#L1144

Added line #L1144 was not covered by tests
EnableMemCheck = 1;
return 1;
}
Expand Down
13 changes: 7 additions & 6 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,19 +465,20 @@

static Int enableMemCheck(Char ** argv, void * dummy)
{
SyFputs( "# Error: --enableMemCheck not supported by this copy of GAP\n", 3);
SyFputs( " pass --enable-memory-checking to ./configure\n", 3 );
fputs("# Error: --enableMemCheck not supported by this copy of GAP\n", stderr);
fputs(" pass --enable-memory-checking to ./configure\n", stderr);

Check warning on line 469 in src/system.c

View check run for this annotation

Codecov / codecov/patch

src/system.c#L468-L469

Added lines #L468 - L469 were not covered by tests
SyExit(2);
}
#endif


static Int printVersion(Char ** argv, void * dummy)
{
SyFputs("GAP ", 1);
SyFputs(SyBuildVersion, 1);
SyFputs(" built on ", 1);
SyFputs(SyBuildDateTime, 1);
fputs("GAP ", stdout);
fputs(SyBuildVersion, stdout);
fputs(" built on ", stdout);
fputs(SyBuildDateTime, stdout);
fputs("\n", stdout);
SyExit(0);
}

Expand Down
Loading