Makefile: add portable mode
PATCH 1/1 Makefile: add portable mode
Add a 'portable' mode that packages all relevant flat files and helper scripts into a tarball named 'kut-portable.tar.gz'.
This mode is useful for compiling tests on one machine and running them on another without needing to clone the entire repository. It allows the runner scripts and unit test configurations to remain local to the machine under test.
--- .gitignore | 2 ++ Makefile | 17 +++++++++++++++++ 2 files changed, 19 insertions(+)
.gitignore +2 -0
@@ -18,6 +18,8 @@ cscope.* /lib/config.h /config.mak /*-run +/kut-portable +kut-portable.tar.gz /msr.out /tests /build-head
Makefile +17 -0
@@ -125,6 +125,23 @@ all: directories $(shell (cd $(SRCDIR) && git rev-parse --verify --short=8 HEAD) standalone: all @scripts/mkstandalone.sh +portable: all + rm -f kut-portable.tar.gz + rm -rf kut-portable + mkdir -p kut-portable/scripts/s390x + mkdir -p kut-portable/$(TEST_DIR) + cp build-head kut-portable + cp errata.txt kut-portable + cp config.mak kut-portable + sed -i '/^ERRATATXT/cERRATATXT=errata.txt' kut-portable/config.mak + cp run_tests.sh kut-portable + cp -r scripts/* kut-portable/scripts + cp $(TEST_DIR)-run kut-portable + cp $(TEST_DIR)/*.flat kut-portable/$(TEST_DIR) + cp $(TEST_DIR)/unittests.cfg kut-portable/$(TEST_DIR) + cp $(TEST_DIR)/run kut-portable/$(TEST_DIR) + tar -czf kut-portable.tar.gz kut-portable + install: standalone mkdir -p $(DESTDIR) install tests/* $(DESTDIR)
Signature · 1 line
2.43.0
Hi,
Quoted 7 lines · Jon Kohler
Add a 'portable' mode that packages all relevant flat files and helper scripts into a tarball named 'kut-portable.tar.gz'.
This mode is useful for compiling tests on one machine and running them on another without needing to clone the entire repository. It allows the runner scripts and unit test configurations to remain local to the machine under test.
Have you tried make standalone? You can then copy the tests directory, or even a particular test.
Thanks,
Alex
Quoted 53 lines
Signed-off-by Jon Kohler <[email protected]>--- .gitignore | 2 ++ Makefile | 17 +++++++++++++++++ 2 files changed, 19 insertions(+).gitignore +2
-0@@ -18,6 +18,8 @@ cscope.* /lib/config.h /config.mak /*-run +/kut-portable +kut-portable.tar.gz /msr.out /tests /build-headMakefile +17
-0@@ -125,6 +125,23 @@ all: directories $(shell (cd $(SRCDIR) && git rev-parse --verify --short=8 HEAD) standalone: all @scripts/mkstandalone.sh +portable: all + rm -f kut-portable.tar.gz + rm -rf kut-portable + mkdir -p kut-portable/scripts/s390x + mkdir -p kut-portable/$(TEST_DIR) + cp build-head kut-portable + cp errata.txt kut-portable + cp config.mak kut-portable + sed -i '/^ERRATATXT/cERRATATXT=errata.txt' kut-portable/config.mak + cp run_tests.sh kut-portable + cp -r scripts/* kut-portable/scripts + cp $(TEST_DIR)-run kut-portable + cp $(TEST_DIR)/*.flat kut-portable/$(TEST_DIR) + cp $(TEST_DIR)/unittests.cfg kut-portable/$(TEST_DIR) + cp $(TEST_DIR)/run kut-portable/$(TEST_DIR) + tar -czf kut-portable.tar.gz kut-portable + install: standalone mkdir -p $(DESTDIR) install tests/* $(DESTDIR)Signature · 1 line
2.43.0
Quoted 15 lines · Alexandru Elisei
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
Hi,
Quoted 3 lines · Jon Kohler
Add a 'portable' mode that packages all relevant flat files and helper scripts into a tarball named 'kut-portable.tar.gz'.
Quoted 7 lines
Quoted 4 lines
This mode is useful for compiling tests on one machine and running them on another without needing to clone the entire repository. It allows the runner scripts and unit test configurations to remain local to the machine under test.
Have you tried make standalone? You can then copy the tests directory, or even a particular test.
Yes, standalone does not work when copying tests from one host to another. The use case for portable mode is to be able to compile within one environment and test in completely separate environment. I was not able to accomplish that with standalone mode by itself.
Quoted 57 lines
Thanks,
AlexQuoted 53 lines
Signed-off-by Jon Kohler <[email protected]>---
.gitignore | 2 ++Makefile| 17 +++++++++++++++++2 files changed, 19 insertions(+).gitignore +0
-0@@ -18,6 +18,8 @@ cscope.*
/lib/config.h
/config.mak
/*-run.gitignore +2
-0+/kut-portable +kut-portable.tar.gz/msr.out
/tests
/build-headMakefile +0
-0@@ -125,6 +125,23 @@ all: directories $(shell (cd $(SRCDIR) && git rev-parse --verify --short=8 HEAD)standalone: all
@scripts/mkstandalone.shMakefile +17
-0+portable: all + rm -f kut-portable.tar.gz + rm -rf kut-portable + mkdir -p kut-portable/scripts/s390x + mkdir -p kut-portable/$(TEST_DIR) + cp build-head kut-portable + cp errata.txt kut-portable + cp config.mak kut-portable + sed -i '/^ERRATATXT/cERRATATXT=errata.txt' kut-portable/config.mak + cp run_tests.sh kut-portable + cp -r scripts/* kut-portable/scripts + cp $(TEST_DIR)-run kut-portable + cp $(TEST_DIR)/*.flat kut-portable/$(TEST_DIR) + cp $(TEST_DIR)/unittests.cfg kut-portable/$(TEST_DIR) + cp $(TEST_DIR)/run kut-portable/$(TEST_DIR) + tar -czf kut-portable.tar.gz kut-portable +install: standalone
mkdir -p $(DESTDIR)
install tests/* $(DESTDIR)Signature · 1 line
2.43.0
Quoted 20 lines · Jon Kohler
Quoted 20 lines · Alexandru Elisei
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
Hi,
Quoted 7 lines · Jon Kohler
Add a 'portable' mode that packages all relevant flat files and helper scripts into a tarball named 'kut-portable.tar.gz'.
This mode is useful for compiling tests on one machine and running them on another without needing to clone the entire repository. It allows the runner scripts and unit test configurations to remain local to the machine under test.
Quoted 8 lines
Quoted 2 lines
Have you tried make standalone? You can then copy the tests directory, or even a particular test.
Yes, standalone does not work when copying tests from one host to another. The use case for portable mode is to be able to compile within one environment and test in completely separate environment. I was not able to accomplish that with standalone mode by itself.
standalone scripts should be portable. If they're missing something, then we should fix that. Also 'make install' should include everything necessary, otherwise it should be fixed. Then, we could consider adding another target like 'make package' which would do 'make install' to a temporary directory and tar/gzip or whatever the installation into a package.
Thanks,
drew
Quoted 39 lines · Andrew Jones
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
Quoted 20 lines · Jon Kohler
Quoted 20 lines · Alexandru Elisei
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
Hi,
Quoted 7 lines · Jon Kohler
Add a 'portable' mode that packages all relevant flat files and helper scripts into a tarball named 'kut-portable.tar.gz'.
This mode is useful for compiling tests on one machine and running them on another without needing to clone the entire repository. It allows the runner scripts and unit test configurations to remain local to the machine under test.
Quoted 8 lines
Quoted 2 lines
Have you tried make standalone? You can then copy the tests directory, or even a particular test.
Yes, standalone does not work when copying tests from one host to another. The use case for portable mode is to be able to compile within one environment and test in completely separate environment. I was not able to accomplish that with standalone mode by itself.
Quoted 6 lines
standalone scripts should be portable. If they're missing something, then we should fix that. Also 'make install' should include everything necessary, otherwise it should be fixed. Then, we could consider adding another target like 'make package' which would do 'make install' to a temporary directory and tar/gzip or whatever the installation into a package.
Thanks, Drew. The standalone scripts are not portable in my experience, as in I can not just pick them up, copy them as is, and put them on another host with different directory layouts, etc (and importantly, no kvm-unit-tests repo whatsoever).
The make package idea is effectively what I’m doing here, but it happens to use the word portable instead of package (and not using make install to do the data movement).
That bit is important:
The biggest tidbit is that things like the errata path is hard coded, so in my “make portable” it fixes those things to be not hard coded, and all is well after files are tar’d up and then untar'd later.
Also, in standalone mode, you’d be missing the runner scripts, etc, so it makes it harder to tweak and iterate locally on the system under test.
Happy to take guidance if I’m missing something painfully obvious with the existing standalone setup (I felt this way when I started looking at this!) as it doesn’t do what I’d think it would do.
Thanks again,
Jon
Quoted 2 lines
Thanks,
drew
Quoted 46 lines · Jon Kohler
Quoted 39 lines · Andrew Jones
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
Quoted 20 lines · Jon Kohler
Quoted 20 lines · Alexandru Elisei
!-------------------------------------------------------------------|
CAUTION: External Email|-------------------------------------------------------------------!
Hi,
Quoted 7 lines · Jon Kohler
Add a 'portable' mode that packages all relevant flat files and helper scripts into a tarball named 'kut-portable.tar.gz'.
This mode is useful for compiling tests on one machine and running them on another without needing to clone the entire repository. It allows the runner scripts and unit test configurations to remain local to the machine under test.
Quoted 8 lines
Quoted 2 lines
Have you tried make standalone? You can then copy the tests directory, or even a particular test.
Yes, standalone does not work when copying tests from one host to another. The use case for portable mode is to be able to compile within one environment and test in completely separate environment. I was not able to accomplish that with standalone mode by itself.
Quoted 6 lines
standalone scripts should be portable. If they're missing something, then we should fix that. Also 'make install' should include everything necessary, otherwise it should be fixed. Then, we could consider adding another target like 'make package' which would do 'make install' to a temporary directory and tar/gzip or whatever the installation into a package.
Quoted 4 lines
Thanks, Drew. The standalone scripts are not portable in my experience, as in I can not just pick them up, copy them as is, and put them on another host with different directory layouts, etc (and importantly, no kvm-unit-tests repo whatsoever).
They should work without a kvm-unit-tests repo (they used to anyway). If they're not working when moved to a host that doesn't have anything except bash and qemu, then we should fix them. Which architecture are you mainly testing?
Quoted 4 lines
The make package idea is effectively what I’m doing here, but it happens to use the word portable instead of package (and not using make install to do the data movement).
I know, but I'm suggesting that we do use 'make install' rather than introduce an independent target which should be 'make install' plus packaging. We don't want to maintain multiple independent targets which do almost the same thing.
Quoted 5 lines
That bit is important:
The biggest tidbit is that things like the errata path is hard coded, so in my “make portable” it fixes those things to be not hard coded, and all is well after files are tar’d up and then untar'd later.
So let's fix 'make install' to make sure nothing installed has hard coded paths (which standalone should do, since it should only depend on /tmp)
Quoted 3 lines
Also, in standalone mode, you’d be missing the runner scripts, etc, so it makes it harder to tweak and iterate locally on the system under test.
standalone scripts don't need the run_tests.sh since they include everything from unittests.cfg already. It probably would make sense to provide a script that allows running all or a subset of tests at once, which would just be a for-loop, e.g.
run_subset() { for t in ${tests}/${1} ${tests}/${1}_*; do [ -e $t ] && $t; done; }Running tests with different parameters than what are specified in the unittests.cfg file isn't currently possible, unless they're also configurable with environment variables like MACHINE, ACCEL, TIMEOUT, and MAX_SMP. If more configuration changes are necessary, then a make target for packaging $TEST_DIR/run and the .flat files is probably the right way to go, but it still isn't clear to me if that's what you're trying to do.
Quoted 4 lines
Happy to take guidance if I’m missing something painfully obvious with the existing standalone setup (I felt this way when I started looking at this!) as it doesn’t do what I’d think it would do.
There's a good chance that standalone hasn't been maintained along with the rest of the scripts, since we don't currently have a CI test for it. But, unless you need to modify test parameters, then we should try to fix it (and add CI for it).
Thanks,
drew