Message ID | 20230728091812.659418-1-michael.adler@siemens.com |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show |
Series | test: use env to discover gawk binary | expand |
On 28.07.23 11:18, 'Michael Adler' via swupdate wrote: > This commit modifies the method of discovering gawk's binary path to > enhance compatibility across different Linux distributions, particularly > ones like NixOS where gawk is not installed at /usr/bin/gawk. We now > leverage /usr/bin/env to find the gawk binary instead of using a > hard-coded absolute path. > In addition to this, a comment in test/Makefile has been corrected. > Previously, it incorrectly stated that the awk expression transfers > _mock* functions while in fact it transfers _wrap_* functions > > Signed-off-by: Michael Adler <michael.adler@siemens.com> > Signed-off-by: Christian Storm <christian.storm@siemens.com> > --- > test/Makefile | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/test/Makefile b/test/Makefile > index ca10c55..7a542f0 100644 > --- a/test/Makefile > +++ b/test/Makefile > @@ -39,8 +39,9 @@ ifneq ($(CONFIG_EXTRA_LDFLAGS),) > EXTRA_LDFLAGS += $($(STRIP) $(subst ",,$(CONFIG_EXTRA_LDFLAGS)))#")) > endif > > -## transfer __mock_*() functions to according linker flags via rudimentary regex awk parsing > -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` > +## transfer __wrap_*() functions to according linker flags via rudimentary regex awk parsing, > +## e.g. __wrap_channel_get becomes -Wl,--wrap=channel_get. > +LDMOCKS = `/usr/bin/env 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 --git a/test/Makefile b/test/Makefile index ca10c55..7a542f0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -39,8 +39,9 @@ ifneq ($(CONFIG_EXTRA_LDFLAGS),) EXTRA_LDFLAGS += $($(STRIP) $(subst ",,$(CONFIG_EXTRA_LDFLAGS)))#")) endif -## transfer __mock_*() functions to according linker flags via rudimentary regex awk parsing -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` +## transfer __wrap_*() functions to according linker flags via rudimentary regex awk parsing, +## e.g. __wrap_channel_get becomes -Wl,--wrap=channel_get. +LDMOCKS = `/usr/bin/env 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 \