* [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC)
@ 2025-06-04 7:21 Michal Orzel
2025-06-04 8:07 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: Michal Orzel @ 2025-06-04 7:21 UTC (permalink / raw)
To: xen-devel; +Cc: Michal Orzel, Roger Pau Monné, Anthony PERARD
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.
Fixes: 96a587a05736 ("tools/tests: Add install target for vPCI")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
Changes in v2:
- change Fixes tag
- add `run` rule adjustment from Roger
---
tools/tests/vpci/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
index 9450f7593a41..f2226a5543bc 100644
--- a/tools/tests/vpci/Makefile
+++ b/tools/tests/vpci/Makefile
@@ -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:
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC)
2025-06-04 7:21 [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC) Michal Orzel
@ 2025-06-04 8:07 ` Jan Beulich
2025-06-04 8:25 ` Orzel, Michal
2025-06-04 9:05 ` Roger Pau Monné
0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2025-06-04 8:07 UTC (permalink / raw)
To: Michal Orzel; +Cc: Roger Pau Monné, Anthony PERARD, xen-devel
On 04.06.2025 09:21, Michal Orzel wrote:
> 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 ...
> 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.
>
> Fixes: 96a587a05736 ("tools/tests: Add install target for vPCI")
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> ---
> Changes in v2:
> - change Fixes tag
> - add `run` rule adjustment from Roger
> ---
> tools/tests/vpci/Makefile | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
> index 9450f7593a41..f2226a5543bc 100644
> --- a/tools/tests/vpci/Makefile
> +++ b/tools/tests/vpci/Makefile
> @@ -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
> +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:
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC)
2025-06-04 8:07 ` Jan Beulich
@ 2025-06-04 8:25 ` Orzel, Michal
2025-06-04 9:05 ` Roger Pau Monné
1 sibling, 0 replies; 5+ messages in thread
From: Orzel, Michal @ 2025-06-04 8:25 UTC (permalink / raw)
To: Jan Beulich; +Cc: Roger Pau Monné, Anthony PERARD, xen-devel
On 04/06/2025 10:07, Jan Beulich wrote:
> On 04.06.2025 09:21, Michal Orzel wrote:
>> 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 ...
>
>> 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.
>>
>> Fixes: 96a587a05736 ("tools/tests: Add install target for vPCI")
>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
>> ---
>> Changes in v2:
>> - change Fixes tag
>> - add `run` rule adjustment from Roger
>> ---
>> tools/tests/vpci/Makefile | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
>> index 9450f7593a41..f2226a5543bc 100644
>> --- a/tools/tests/vpci/Makefile
>> +++ b/tools/tests/vpci/Makefile
>> @@ -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
If this is just s/cannot/will not/ I hope this can be done on commit.
~Michal
> 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
>
>> +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:
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC)
2025-06-04 8:07 ` Jan Beulich
2025-06-04 8:25 ` Orzel, Michal
@ 2025-06-04 9:05 ` Roger Pau Monné
2025-06-04 9:23 ` Jan Beulich
1 sibling, 1 reply; 5+ messages in thread
From: Roger Pau Monné @ 2025-06-04 9:05 UTC (permalink / raw)
To: Jan Beulich; +Cc: Michal Orzel, Anthony PERARD, xen-devel
On Wed, Jun 04, 2025 at 10:07:46AM +0200, Jan Beulich wrote:
> On 04.06.2025 09:21, Michal Orzel wrote:
> > 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:
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks, Roger.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC)
2025-06-04 9:05 ` Roger Pau Monné
@ 2025-06-04 9:23 ` Jan Beulich
0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2025-06-04 9:23 UTC (permalink / raw)
To: Roger Pau Monné, Michal Orzel; +Cc: Anthony PERARD, xen-devel
On 04.06.2025 11:05, Roger Pau Monné wrote:
> On Wed, Jun 04, 2025 at 10:07:46AM +0200, Jan Beulich wrote:
>> On 04.06.2025 09:21, Michal Orzel wrote:
>>> 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?
Yeah, that would be good enough for now.
Jan
> If so, I don't have any further objections:
>
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
>
> Thanks, Roger.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-04 9:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 7:21 [PATCH v2] tests/vpci: Use $(CC) instead of $(HOSTCC) Michal Orzel
2025-06-04 8:07 ` Jan Beulich
2025-06-04 8:25 ` Orzel, Michal
2025-06-04 9:05 ` Roger Pau Monné
2025-06-04 9:23 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.