#11169: Make testcc.sh exit with an exit code of 1 if attempting to compile a 
file
fails.
--------------------------------+-------------------------------------------
       Reporter:  drkirkby      |         Owner:              
           Type:  defect        |        Status:  needs_review
       Priority:  major         |     Milestone:  sage-5.0    
      Component:  scripts       |    Resolution:              
       Keywords:  sd32          |   Work issues:              
Report Upstream:  N/A           |     Reviewers:              
        Authors:  David Kirkby  |     Merged in:              
   Dependencies:                |      Stopgaps:              
--------------------------------+-------------------------------------------
Description changed by jdemeyer:

Old description:

> The script {{{$SAGE_LOCAL/bin/testcc.sh}}} checks to see what C compiler
> the environment variable {{{$CC}}} is. But currently the script always
> exits with a 0, even if an error occurs.
>
> This patch will correct that.
>
> Note some forms of error will not be detected. If CC is defined as
> {{{ls}}}, then the code will try to list the C file, which will succeed
> without error. But the changes will allow one to check if a compiler is
> installed or not.
>
> {{{
> drkirkby@hawk:~$ export CC=cc
> drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
> Sun_Studio
> drkirkby@hawk:~$ export CC=gcc
> drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
> GCC
> drkirkby@hawk:~$ export CC=junk
> drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
> Error - junk is not compiling a C file properly
> }}}
>
> Since the {{{testcc.sh}}} script is not under revision control, the
> attached file just needs to replace the one currently in Sage. The patch
> is for review purposes only.

New description:

 The script {{{$SAGE_LOCAL/bin/testcc.sh}}} checks to see what C compiler
 the environment variable {{{$CC}}} is. But currently the script always
 exits with a 0, even if an error occurs.

 This patch will correct that.

 Note some forms of error will not be detected. If CC is defined as
 {{{ls}}}, then the code will try to list the C file, which will succeed
 without error. But the changes will allow one to check if a compiler is
 installed or not.

 {{{
 drkirkby@hawk:~$ export CC=cc
 drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
 Sun_Studio
 drkirkby@hawk:~$ export CC=gcc
 drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
 GCC
 drkirkby@hawk:~$ export CC=junk
 drkirkby@hawk:~$ sage-4.7.alpha3/local/bin/testcc.sh $CC
 Error - junk is not compiling a C file properly
 }}}

 '''Apply''' [attachment:11169_testcc.patch] to the SAGE_ROOT repository.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11169#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to