Skip to contentSkip to conversation

tests/vpci: install test

PATCH Superseded Roger Pau Monne 2 participants 8 messages Mar 9, 2023 – Mar 13, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/vpci: install test

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

---
XenRT has recently gained the ability to run the tests in tools/tests that are installed, so the install target is needed for that use-case.

---
 tools/tests/vpci/Makefile | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
tools/tests/vpci/Makefile +10 -4
index 5075bc2be2..3b85b689d3 100644
@@ -1,7 +1,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-TARGET := test_vpci
+TARGET := test-vpci
 
 .PHONY: all
 all: $(TARGET)
@@ -11,17 +11,23 @@ run: $(TARGET)
 	./$(TARGET)
 
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(HOSTCC) -g -o $@ vpci.c main.c
+	$(CC) -o $@ vpci.c main.c
 
 .PHONY: clean
 clean:
-	rm -rf $(TARGET) *.o *~ vpci.h vpci.c list.h
+	$(RM) -- $(TARGET) *.o *~ vpci.h vpci.c list.h
 
 .PHONY: distclean
 distclean: clean
 
 .PHONY: install
-install:
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
+
+.PHONY: uninstall
+uninstall:
+	$(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
 
 vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c
 	# Remove includes and add the test harness header
Signature · 1 line
2.39.0
#1 lore raw
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 6 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

Quoted 12 lines
tools/tests/vpci/Makefile +1 -1
@@ -1,7 +1,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-TARGET := test_vpci
+TARGET := test-vpci
 
 .PHONY: all
 all: $(TARGET)

tools/tests/vpci/Makefile run: $(TARGET) · line 14

Quoted 5 lines
tools/tests/vpci/Makefile +1 -1
@@ -11,17 +11,23 @@ run: $(TARGET)
 	./$(TARGET)
 
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(HOSTCC) -g -o $@ vpci.c main.c
+	$(CC) -o $@ vpci.c main.c

You're losing -g and you're also not covering for it by adding $(CFLAGS) (there should have been use of $(HOSTCFLAGS) already before, I suppose).

Jan

#2 lore raw
Quoted 18 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 4 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Quoted 7 lines
Quoted 2 lines

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

The run rule is not hooked up in any of the upper level makefile logic, so I think it's usage (like in other tests that also use CC and have such rule) is left to callers that know that HOSTCC == CC.

Quoted 14 lines
Quoted 14 lines
tools/tests/vpci/Makefile +1 -1
@@ -1,7 +1,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-TARGET := test_vpci
+TARGET := test-vpci
 
 .PHONY: all
 all: $(TARGET)
@@ -11,17 +11,23 @@ run: $(TARGET)
 	./$(TARGET)
 
Quoted 6 lines

tools/tests/vpci/Makefile run: $(TARGET) · line 14

Quoted 3 lines
tools/tests/vpci/Makefile +1 -1
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(HOSTCC) -g -o $@ vpci.c main.c
+	$(CC) -o $@ vpci.c main.c

You're losing -g and you're also not covering for it by adding $(CFLAGS) (there should have been use of $(HOSTCFLAGS) already before, I suppose).

Wasn't sure whether I should add CFLAGS and LDFLAGS here, I guess LDFLAGS is really not needed because the test is not linked against any library, but could be added just in case.

Thanks, Roger.

#3 lore raw
Quoted 22 lines · Roger Pau Monné
Quoted 21 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 6 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

Quoted 6 lines
Quoted 4 lines

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

The run rule is not hooked up in any of the upper level makefile logic,

What about the run-tests-% goal in the top level Makefile?

Quoted 24 lines

so I think it's usage (like in other tests that also use CC and have such rule) is left to callers that know that HOSTCC == CC.

Quoted 14 lines
Quoted 14 lines
tools/tests/vpci/Makefile +1 -1
@@ -1,7 +1,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-TARGET := test_vpci
+TARGET := test-vpci
 
 .PHONY: all
 all: $(TARGET)
@@ -11,17 +11,23 @@ run: $(TARGET)
 	./$(TARGET)
 
Quoted 6 lines

tools/tests/vpci/Makefile run: $(TARGET) · line 14

Quoted 3 lines
tools/tests/vpci/Makefile +1 -1
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
-	$(HOSTCC) -g -o $@ vpci.c main.c
+	$(CC) -o $@ vpci.c main.c

You're losing -g and you're also not covering for it by adding $(CFLAGS) (there should have been use of $(HOSTCFLAGS) already before, I suppose).

Quoted 3 lines

Wasn't sure whether I should add CFLAGS and LDFLAGS here, I guess LDFLAGS is really not needed because the test is not linked against any library, but could be added just in case.

Perhaps. I find $(LDFLAGS) odd to use anyway - by its name it ought to be passed to $(LD), not $(CC).

Jan

#4 lore raw
Quoted 23 lines · Jan Beulich
Quoted 22 lines · Roger Pau Monné
Quoted 21 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 6 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

The run rule is not hooked up in any of the upper level makefile logic,

What about the run-tests-% goal in the top level Makefile?

Urg, I wasn't aware of that target. I assume just removing the run target from the vpci makefile would be an acceptable solution then.

It's still the user that needs to explicitly call run-tests-vpci, so it would better know that HOSTCC == CC before attempting that.

Note cpu-policy and resource should also be fixed, but I don't plan to do it as part of this patch.

Roger.

#5 lore raw
Quoted 29 lines · Roger Pau Monné
Quoted 28 lines · Jan Beulich
Quoted 27 lines · Roger Pau Monné
Quoted 25 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 6 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The run rule is not hooked up in any of the upper level makefile logic,

What about the run-tests-% goal in the top level Makefile?

Urg, I wasn't aware of that target. I assume just removing the run target from the vpci makefile would be an acceptable solution then.

I'm afraid I wouldn't view this as acceptable. I would very much like to retain these run: goals, as I view it as important that such tests be possible to run easily and right from the build area. What might be acceptable to me is if ...

Quoted 2 lines

It's still the user that needs to explicitly call run-tests-vpci, so it would better know that HOSTCC == CC before attempting that.

... the run: rune would be enclosed in "ifeq ($(CC),$(HOSTCC))". Yet even that is fragile. For tests like this I view it as secondary to be runnable on the destination architecture, and hence I continue to think that if installing such tests is really wanted, binaries for host and target should be properly separated.

Jan

#6 lore raw
Quoted 42 lines · Jan Beulich
Quoted 29 lines · Roger Pau Monné
Quoted 28 lines · Jan Beulich
Quoted 27 lines · Roger Pau Monné
Quoted 25 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 6 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The run rule is not hooked up in any of the upper level makefile logic,

What about the run-tests-% goal in the top level Makefile?

Urg, I wasn't aware of that target. I assume just removing the run target from the vpci makefile would be an acceptable solution then.

I'm afraid I wouldn't view this as acceptable. I would very much like to retain these run: goals, as I view it as important that such tests be possible to run easily and right from the build area. What might be acceptable to me is if ...

Quoted 8 lines
Quoted 2 lines

It's still the user that needs to explicitly call run-tests-vpci, so it would better know that HOSTCC == CC before attempting that.

... the run: rune would be enclosed in "ifeq ($(CC),$(HOSTCC))". Yet even that is fragile. For tests like this I view it as secondary to be runnable on the destination architecture, and hence I continue to think that if installing such tests is really wanted, binaries for host and target should be properly separated.

vpci test is special in this regard when compared to the rest of the tests that do make use of the hypercall interface to a degree, and hence are not expected to be run from the build host as they require to be run from a Xen domain.

I think the benefit of having the test run part of XenRT is greater than the downfall of installing a test as part of the distribution.

I've added a guard to the run target in order to check that HOSTCC == CC, hope that is enough.

Thanks, Roger.

#7 lore raw
Quoted 52 lines · Roger Pau Monné
Quoted 42 lines · Jan Beulich
Quoted 29 lines · Roger Pau Monné
Quoted 28 lines · Jan Beulich
Quoted 27 lines · Roger Pau Monné
Quoted 25 lines · Jan Beulich
Quoted 6 lines · Roger Pau Monne

Introduce an install target, like it's used by other tests. This allows running the test on the installed systems, which is easier than running it during the build phase when dealing with automated testing. Strictly speaking the vpci test doesn't require to be run on a Xen host currently, but that allows easier integration with logic that runs the rest of the tests.

I accept that as a possible way of looking at things, but personally I remain unconvinced of this model. To me what is installed should be of value to users. If there was a properly separated directory where all (and only) tests were put, I might agree with installing. (Nevertheless this isn't an objection, merely a remark.)

Quoted 6 lines

While there also adjust the makefile to use $(RM), and rename the resulting binary to use a dash instead of an underscore (again to match the rest of the tests).

Since the resulting test binary is now part of the distribution CC must be used instead of HOSTCC.

This breaks the run: goal, doesn't it? If the new mode is wanted, I think the two kinds of binaries (and rules) need separating (maybe a way can be found to avoid duplicating the rules, which would seem desirable).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The run rule is not hooked up in any of the upper level makefile logic,

What about the run-tests-% goal in the top level Makefile?

Urg, I wasn't aware of that target. I assume just removing the run target from the vpci makefile would be an acceptable solution then.

I'm afraid I wouldn't view this as acceptable. I would very much like to retain these run: goals, as I view it as important that such tests be possible to run easily and right from the build area. What might be acceptable to me is if ...

Quoted 8 lines
Quoted 2 lines

It's still the user that needs to explicitly call run-tests-vpci, so it would better know that HOSTCC == CC before attempting that.

... the run: rune would be enclosed in "ifeq ($(CC),$(HOSTCC))". Yet even that is fragile. For tests like this I view it as secondary to be runnable on the destination architecture, and hence I continue to think that if installing such tests is really wanted, binaries for host and target should be properly separated.

Quoted 4 lines

vpci test is special in this regard when compared to the rest of the tests that do make use of the hypercall interface to a degree, and hence are not expected to be run from the build host as they require to be run from a Xen domain.

Right, which is why I said "for tests like this" (which includes in particular also the x86 emulator harness).

Quoted 5 lines

I think the benefit of having the test run part of XenRT is greater than the downfall of installing a test as part of the distribution.

I've added a guard to the run target in order to check that HOSTCC == CC, hope that is enough.

With that at least I won't further object to the change.

Jan