[PATCH] coverage: Fix option processing on FreeBSD

Gedare Bloom gedare at rtems.org
Sat Mar 27 14:43:27 UTC 2021


ok, but add a comment about the fragility of this ordering in the code

On Fri, Mar 12, 2021 at 10:18 AM Alex White <alex.white at oarcorp.com> wrote:
>
> Covoar uses getopt() to process the command line options. If getopt() is
> POSIX-compliant, it will return -1 when it encounters the first
> non-option command line argument. It appears that it behaves this way on
> FreeBSD, but on Linux getopt() continues to process arguments while
> skipping any non-options. This changes the order of arguments passed to
> covoar by coverage.py to group all options at the beginning. This allows
> hosts with POSIX-compliant getopt() implementations to correctly process
> all command line options.
> ---
>  tester/rt/coverage.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
> index a561d26..77e5b69 100644
> --- a/tester/rt/coverage.py
> +++ b/tester/rt/coverage.py
> @@ -361,8 +361,8 @@ class covoar(object):
>          exe = self._find_covoar()
>          command = exe + ' -O ' + covoar_result_dir + \
>                    ' -p ' + self.project_name + \
> -                  ' ' + self.executables + ' '
> -        command += self.covoar_cmd
> +                  ' ' + self.covoar_cmd + ' '
> +        command += self.executables
>
>          log.notice()
>          log.notice('Running coverage analysis: %s (%s)' % (set_name, covoar_result_dir))
> --
> 2.27.0
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list