diff mbox series

test: make requirement for gawk explicit

Message ID 1586769836-310-1-git-send-email-Cedric_Hombourger@mentor.com
State Accepted
Headers show
Series test: make requirement for gawk explicit | expand

Commit Message

Cedric Hombourger April 13, 2020, 9:23 a.m. UTC
The awk code used to translate wrapper declarations into linker
options requires features from GNU Awk. Systems with awk == mawk
will silently fail to produce a list -Wl,--wrap options (a null
string is returned in the shell expansion).

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
 test/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic April 13, 2020, 1:53 p.m. UTC | #1
Hi Cedric,

On 13/04/20 11:23, Cedric Hombourger wrote:
> The awk code used to translate wrapper declarations into linker
> options requires features from GNU Awk. Systems with awk == mawk
> will silently fail to produce a list -Wl,--wrap options (a null
> string is returned in the shell expansion).
> 
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> ---
>  test/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/Makefile b/test/Makefile
> index 073fe6a..2b2070a 100644
> --- a/test/Makefile
> +++ b/test/Makefile
> @@ -35,7 +35,7 @@ EXTRA_LDFLAGS += $(strip $(subst ",,$(CONFIG_EXTRA_LDFLAGS)))#"))
>  endif
>  
>  ## transfer __mock_*() functions to according linker flags via rudimentary regex awk parsing
> -LDMOCKS = `/usr/bin/awk '/^[^(extern)|(static)]*([\*_[:alnum:]]+[[:blank:]]+)+[\*]*__wrap_/{where = match($$0,"__wrap_[_[:alnum:]]+"); if (RSTART > 0) { print "-Wl,--wrap=" substr($$0, RSTART+7, RLENGTH-7);}}' $(basename $@).c`
> +LDMOCKS = `/usr/bin/gawk '/^[^(extern)|(static)]*([\*_[:alnum:]]+[[:blank:]]+)+[\*]*__wrap_/{where = match($$0,"__wrap_[_[:alnum:]]+"); if (RSTART > 0) { print "-Wl,--wrap=" substr($$0, RSTART+7, RLENGTH-7);}}' $(basename $@).c`
>  
>  quiet_cmd_linktestexe = LD      $(basename $@)
>        cmd_linktestexe = $(srctree)/scripts/trylink \
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/test/Makefile b/test/Makefile
index 073fe6a..2b2070a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -35,7 +35,7 @@  EXTRA_LDFLAGS += $(strip $(subst ",,$(CONFIG_EXTRA_LDFLAGS)))#"))
 endif
 
 ## transfer __mock_*() functions to according linker flags via rudimentary regex awk parsing
-LDMOCKS = `/usr/bin/awk '/^[^(extern)|(static)]*([\*_[:alnum:]]+[[:blank:]]+)+[\*]*__wrap_/{where = match($$0,"__wrap_[_[:alnum:]]+"); if (RSTART > 0) { print "-Wl,--wrap=" substr($$0, RSTART+7, RLENGTH-7);}}' $(basename $@).c`
+LDMOCKS = `/usr/bin/gawk '/^[^(extern)|(static)]*([\*_[:alnum:]]+[[:blank:]]+)+[\*]*__wrap_/{where = match($$0,"__wrap_[_[:alnum:]]+"); if (RSTART > 0) { print "-Wl,--wrap=" substr($$0, RSTART+7, RLENGTH-7);}}' $(basename $@).c`
 
 quiet_cmd_linktestexe = LD      $(basename $@)
       cmd_linktestexe = $(srctree)/scripts/trylink \