tests/vpci: Use $(CC) instead of $(HOSTCC)
PATCH v2 1/1 tests/vpci: Use $(CC) instead of $(HOSTCC)
When cross-compiling, HOSTCC can be different than CC. With the recent install rule addition, this would put a binary of a wrong format in the destdir (e.g. building tests on x86 host for Arm target).
Take the opportunity to adjust the run rule to only run the test if HOSTCC is CC, else print a warning message.
---
Changes in v2:
- change Fixes tag
- add run rule adjustment from Roger
--- tools/tests/vpci/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/tests/vpci/Makefile +5 -1
@@ -8,10 +8,14 @@ all: $(TARGET) .PHONY: run run: $(TARGET) +ifeq ($(CC),$(HOSTCC)) ./$(TARGET) +else + $(warning HOSTCC != CC, cannot run test) +endif $(TARGET): vpci.c vpci.h list.h main.c emul.h - $(HOSTCC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c + $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c .PHONY: clean clean:
Signature · 1 line
2.25.1
Quoted 1 line · Michal Orzel
When cross-compiling, HOSTCC can be different than CC.
I'm sorry for being pedantic, but the two can also be different for other reasons (and I'd like to avoid this becoming a bad precedent, then getting copied elsewhere). Both may target the same architecture. Hence I'd like to suggest ...
Quoted 22 lines
With the recent
installrule addition, this would put a binary of a wrong format in the destdir (e.g. building tests on x86 host for Arm target).Take the opportunity to adjust the
runrule to only run the test if HOSTCC is CC, else print a warning message.Fixes 96a587a05736 ("tools/tests: Add install target for vPCI")Signed-off-by Michal Orzel <[email protected]>---
Changes in v2:
- change Fixes tag
- addrunrule adjustment from Roger--- tools/tests/vpci/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/tests/vpci/Makefile +0
-0
tools/tests/vpci/Makefile all: $(TARGET) · line 14
Quoted 7 lines
tools/tests/vpci/Makefile +3
-0@@ -8,10 +8,14 @@ all: $(TARGET) .PHONY: run run: $(TARGET) +ifeq ($(CC),$(HOSTCC)) ./$(TARGET) +else + $(warning HOSTCC != CC, cannot run test)
... s/cannot/will not/ here. Alternatively, -dumpmachine output of both could be compared, yet even that would leave us with false negatives (e.g. x86_64-suse-linux vs x86_64-pc-linux-gnu as I can see for my system compiler vs the ones I built myself).
Jan
Quoted 8 lines
tools/tests/vpci/Makefile +2
-1+endif $(TARGET): vpci.c vpci.h list.h main.c emul.h - $(HOSTCC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c + $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c .PHONY: clean clean:
Quoted 31 lines · Jan Beulich
Quoted 1 line · Michal Orzel
When cross-compiling, HOSTCC can be different than CC.
I'm sorry for being pedantic, but the two can also be different for other reasons (and I'd like to avoid this becoming a bad precedent, then getting copied elsewhere). Both may target the same architecture. Hence I'd like to suggest ...
Quoted 23 lines
With the recent
installrule addition, this would put a binary of a wrong format in the destdir (e.g. building tests on x86 host for Arm target).Take the opportunity to adjust the
runrule to only run the test if HOSTCC is CC, else print a warning message.Fixes 96a587a05736 ("tools/tests: Add install target for vPCI")Signed-off-by Michal Orzel <[email protected]>---
Changes in v2:
- change Fixes tag
- addrunrule adjustment from Roger--- tools/tests/vpci/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/tests/vpci/Makefile +0
-0@@ -8,10 +8,14 @@ all: $(TARGET)
Quoted 8 lines
tools/tests/vpci/Makefile all: $(TARGET) · line 14
Quoted 6 lines
tools/tests/vpci/Makefile +3
-0.PHONY: run run: $(TARGET) +ifeq ($(CC),$(HOSTCC)) ./$(TARGET) +else + $(warning HOSTCC != CC, cannot run test)... s/cannot/will not/ here. Alternatively, -dumpmachine output of both
If this is just s/cannot/will not/ I hope this can be done on commit.
~Michal
Quoted 15 lines
could be compared, yet even that would leave us with false negatives (e.g. x86_64-suse-linux vs x86_64-pc-linux-gnu as I can see for my system compiler vs the ones I built myself).
Jan
Quoted 8 lines
tools/tests/vpci/Makefile +2
-1+endif $(TARGET): vpci.c vpci.h list.h main.c emul.h - $(HOSTCC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c + $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c .PHONY: clean clean:
Roger Pau Monné
Reviewed-byQuoted 7 lines · Jan Beulich
Quoted 1 line · Michal Orzel
When cross-compiling, HOSTCC can be different than CC.
I'm sorry for being pedantic, but the two can also be different for other reasons (and I'd like to avoid this becoming a bad precedent, then getting copied elsewhere). Both may target the same architecture. Hence I'd like to suggest ...
Would you be fine with:
"Depending on the build environment, HOSTCC can be different than CC. With ..."
And the s/cannot/will not/ adjustment below?
If so, I don't have any further objections:
Thanks, Roger.
Quoted 9 lines · Roger Pau Monné
Quoted 7 lines · Jan Beulich
Quoted 1 line · Michal Orzel
When cross-compiling, HOSTCC can be different than CC.
I'm sorry for being pedantic, but the two can also be different for other reasons (and I'd like to avoid this becoming a bad precedent, then getting copied elsewhere). Both may target the same architecture. Hence I'd like to suggest ...
Quoted 6 lines
Would you be fine with:
"Depending on the build environment, HOSTCC can be different than CC. With ..."
And the s/cannot/will not/ adjustment below?
Yeah, that would be good enough for now.
Jan
Quoted 5 lines
If so, I don't have any further objections:
Reviewed-by Roger Pau Monné <[email protected]>Thanks, Roger.