Run tests with multiple versions and collect return values in Makefile
up vote
0
down vote
favorite
I am developing Emacs package that runs from Emacs-22 to Emacs26, and I'd like to confirm that the test passes with these Emacs.
However, since each log is long, I would like to gather the return value of each test and display it clearly at the end.
How can I write this in Makefile?
The list of Emacs to be tested has been obtained in ALL_EMACS_VERS
as array (22.1 23.4 24.5 25.3 26.1), and now I am running the test as follows.
EMACS ?= emacs
LOAD_PATH := -L $(dir $(lastword $(MAKEFILE_LIST)))
BATCH := $(EMACS) -Q --batch $(LOAD_PATH)
ALL_EMACS_VERS := $(shell compgen -c emacs- | grep -oP '(?<=emacs-)([0-9]|.)+' | sort | uniq)
test:
$(BATCH) -l srt-tests.el -f srt-run-tests
debug-localtest:
for ver in $(ALL_EMACS_VERS); do
echo "=== test by emacs-$${ver}... ===";
EMACS=emacs-$${ver} make test;
done
I'd like to get information on which version the test passed, or did not pass, and output it as follows.
=== test by emacs-22.1 ===
emacs-22.1 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 22.1.1 (mac-apple-darwin)
of 2017-10-07 on osx339.sd.apple.com
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
=== test by emacs-23.4 ===
emacs-23.4 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 23.4.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
of 2012-01-29 on bob.porkrind.org
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
...
(Emacs 24.5, 25.3, 26.1)
...
=== localtest completed!! ===
*FAILED* Emacs-22.1
*FAILED* Emacs-23.4
[PASSED] Emacs-24.5
*FAILED* Emacs-25.3
[PASSED] Emacs-26.1
makefile sh gnu-make
add a comment |
up vote
0
down vote
favorite
I am developing Emacs package that runs from Emacs-22 to Emacs26, and I'd like to confirm that the test passes with these Emacs.
However, since each log is long, I would like to gather the return value of each test and display it clearly at the end.
How can I write this in Makefile?
The list of Emacs to be tested has been obtained in ALL_EMACS_VERS
as array (22.1 23.4 24.5 25.3 26.1), and now I am running the test as follows.
EMACS ?= emacs
LOAD_PATH := -L $(dir $(lastword $(MAKEFILE_LIST)))
BATCH := $(EMACS) -Q --batch $(LOAD_PATH)
ALL_EMACS_VERS := $(shell compgen -c emacs- | grep -oP '(?<=emacs-)([0-9]|.)+' | sort | uniq)
test:
$(BATCH) -l srt-tests.el -f srt-run-tests
debug-localtest:
for ver in $(ALL_EMACS_VERS); do
echo "=== test by emacs-$${ver}... ===";
EMACS=emacs-$${ver} make test;
done
I'd like to get information on which version the test passed, or did not pass, and output it as follows.
=== test by emacs-22.1 ===
emacs-22.1 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 22.1.1 (mac-apple-darwin)
of 2017-10-07 on osx339.sd.apple.com
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
=== test by emacs-23.4 ===
emacs-23.4 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 23.4.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
of 2012-01-29 on bob.porkrind.org
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
...
(Emacs 24.5, 25.3, 26.1)
...
=== localtest completed!! ===
*FAILED* Emacs-22.1
*FAILED* Emacs-23.4
[PASSED] Emacs-24.5
*FAILED* Emacs-25.3
[PASSED] Emacs-26.1
makefile sh gnu-make
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am developing Emacs package that runs from Emacs-22 to Emacs26, and I'd like to confirm that the test passes with these Emacs.
However, since each log is long, I would like to gather the return value of each test and display it clearly at the end.
How can I write this in Makefile?
The list of Emacs to be tested has been obtained in ALL_EMACS_VERS
as array (22.1 23.4 24.5 25.3 26.1), and now I am running the test as follows.
EMACS ?= emacs
LOAD_PATH := -L $(dir $(lastword $(MAKEFILE_LIST)))
BATCH := $(EMACS) -Q --batch $(LOAD_PATH)
ALL_EMACS_VERS := $(shell compgen -c emacs- | grep -oP '(?<=emacs-)([0-9]|.)+' | sort | uniq)
test:
$(BATCH) -l srt-tests.el -f srt-run-tests
debug-localtest:
for ver in $(ALL_EMACS_VERS); do
echo "=== test by emacs-$${ver}... ===";
EMACS=emacs-$${ver} make test;
done
I'd like to get information on which version the test passed, or did not pass, and output it as follows.
=== test by emacs-22.1 ===
emacs-22.1 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 22.1.1 (mac-apple-darwin)
of 2017-10-07 on osx339.sd.apple.com
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
=== test by emacs-23.4 ===
emacs-23.4 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 23.4.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
of 2012-01-29 on bob.porkrind.org
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
...
(Emacs 24.5, 25.3, 26.1)
...
=== localtest completed!! ===
*FAILED* Emacs-22.1
*FAILED* Emacs-23.4
[PASSED] Emacs-24.5
*FAILED* Emacs-25.3
[PASSED] Emacs-26.1
makefile sh gnu-make
I am developing Emacs package that runs from Emacs-22 to Emacs26, and I'd like to confirm that the test passes with these Emacs.
However, since each log is long, I would like to gather the return value of each test and display it clearly at the end.
How can I write this in Makefile?
The list of Emacs to be tested has been obtained in ALL_EMACS_VERS
as array (22.1 23.4 24.5 25.3 26.1), and now I am running the test as follows.
EMACS ?= emacs
LOAD_PATH := -L $(dir $(lastword $(MAKEFILE_LIST)))
BATCH := $(EMACS) -Q --batch $(LOAD_PATH)
ALL_EMACS_VERS := $(shell compgen -c emacs- | grep -oP '(?<=emacs-)([0-9]|.)+' | sort | uniq)
test:
$(BATCH) -l srt-tests.el -f srt-run-tests
debug-localtest:
for ver in $(ALL_EMACS_VERS); do
echo "=== test by emacs-$${ver}... ===";
EMACS=emacs-$${ver} make test;
done
I'd like to get information on which version the test passed, or did not pass, and output it as follows.
=== test by emacs-22.1 ===
emacs-22.1 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 22.1.1 (mac-apple-darwin)
of 2017-10-07 on osx339.sd.apple.com
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
=== test by emacs-23.4 ===
emacs-23.4 -Q --batch -L ./ -l srt-tests.el -f srt-run-tests
Running 30 tests...
GNU Emacs 23.4.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
of 2012-01-29 on bob.porkrind.org
[PASSED] simple:equal
[PASSED] simple:=
...
===== Run 30 Tests, 29 Expected, 1 Failed, 0 Errored =====
make[1]: Leaving directory '/Users/conao/Develop/git/.dotfiles/.emacs.d/local/26.1/site-lisp/srt.el'
...
(Emacs 24.5, 25.3, 26.1)
...
=== localtest completed!! ===
*FAILED* Emacs-22.1
*FAILED* Emacs-23.4
[PASSED] Emacs-24.5
*FAILED* Emacs-25.3
[PASSED] Emacs-26.1
makefile sh gnu-make
makefile sh gnu-make
edited Nov 23 at 1:16
asked Nov 21 at 17:11
Conao3
76316
76316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
The problem has two parts. The first is to give the desired output for one test. If (as the title of your Question suggests) this depends on the return value of the process, this approach will work:
single-test:
(some-command && echo PASS) || echo FAIL
In your case, this becomes:
ARGS := -Q --batch $(LOAD_PATH) -l srt-tests.el -f srt-run-tests
test-emacs-22.1:
(emacs-22.1 $(ARGS) && echo [PASS] emacs-22.1) || echo *FAIL* emacs-22.1
The second part is to iterate over a list of versions. I suggest using a pattern rule:
ALL_EMACS_VERS := 22.1 23.4 24.5 25.3 26.1
TESTS := $(addprefix test-emacs-, $(ALL_EMACS_VERS))
all-tests: $(TESTS)
test-%:
($* $(ARGS) && echo [PASS] $*) || echo *FAIL* $*
Finally, if these processes produce output you wish to suppress:
test-%:
($* $(ARGS) > /dev/null && echo [PASS] $*) || echo *FAIL* $*
EDIT: To print all of the results after all of the script output, the simplest approach is to save them in a file, called e.g. "results":
all-tests: $(TESTS)
@cat results
@rm results
test-%:
@($* $(ARGS) && echo [PASS] $* >> results) || echo *FAIL* $* >> results
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
Yes you did. But your solution is discard Emacs detail test log (such assimple:equal
is pass,, etc.)
– Conao3
Nov 26 at 4:02
|
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
The problem has two parts. The first is to give the desired output for one test. If (as the title of your Question suggests) this depends on the return value of the process, this approach will work:
single-test:
(some-command && echo PASS) || echo FAIL
In your case, this becomes:
ARGS := -Q --batch $(LOAD_PATH) -l srt-tests.el -f srt-run-tests
test-emacs-22.1:
(emacs-22.1 $(ARGS) && echo [PASS] emacs-22.1) || echo *FAIL* emacs-22.1
The second part is to iterate over a list of versions. I suggest using a pattern rule:
ALL_EMACS_VERS := 22.1 23.4 24.5 25.3 26.1
TESTS := $(addprefix test-emacs-, $(ALL_EMACS_VERS))
all-tests: $(TESTS)
test-%:
($* $(ARGS) && echo [PASS] $*) || echo *FAIL* $*
Finally, if these processes produce output you wish to suppress:
test-%:
($* $(ARGS) > /dev/null && echo [PASS] $*) || echo *FAIL* $*
EDIT: To print all of the results after all of the script output, the simplest approach is to save them in a file, called e.g. "results":
all-tests: $(TESTS)
@cat results
@rm results
test-%:
@($* $(ARGS) && echo [PASS] $* >> results) || echo *FAIL* $* >> results
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
Yes you did. But your solution is discard Emacs detail test log (such assimple:equal
is pass,, etc.)
– Conao3
Nov 26 at 4:02
|
show 1 more comment
up vote
2
down vote
The problem has two parts. The first is to give the desired output for one test. If (as the title of your Question suggests) this depends on the return value of the process, this approach will work:
single-test:
(some-command && echo PASS) || echo FAIL
In your case, this becomes:
ARGS := -Q --batch $(LOAD_PATH) -l srt-tests.el -f srt-run-tests
test-emacs-22.1:
(emacs-22.1 $(ARGS) && echo [PASS] emacs-22.1) || echo *FAIL* emacs-22.1
The second part is to iterate over a list of versions. I suggest using a pattern rule:
ALL_EMACS_VERS := 22.1 23.4 24.5 25.3 26.1
TESTS := $(addprefix test-emacs-, $(ALL_EMACS_VERS))
all-tests: $(TESTS)
test-%:
($* $(ARGS) && echo [PASS] $*) || echo *FAIL* $*
Finally, if these processes produce output you wish to suppress:
test-%:
($* $(ARGS) > /dev/null && echo [PASS] $*) || echo *FAIL* $*
EDIT: To print all of the results after all of the script output, the simplest approach is to save them in a file, called e.g. "results":
all-tests: $(TESTS)
@cat results
@rm results
test-%:
@($* $(ARGS) && echo [PASS] $* >> results) || echo *FAIL* $* >> results
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
Yes you did. But your solution is discard Emacs detail test log (such assimple:equal
is pass,, etc.)
– Conao3
Nov 26 at 4:02
|
show 1 more comment
up vote
2
down vote
up vote
2
down vote
The problem has two parts. The first is to give the desired output for one test. If (as the title of your Question suggests) this depends on the return value of the process, this approach will work:
single-test:
(some-command && echo PASS) || echo FAIL
In your case, this becomes:
ARGS := -Q --batch $(LOAD_PATH) -l srt-tests.el -f srt-run-tests
test-emacs-22.1:
(emacs-22.1 $(ARGS) && echo [PASS] emacs-22.1) || echo *FAIL* emacs-22.1
The second part is to iterate over a list of versions. I suggest using a pattern rule:
ALL_EMACS_VERS := 22.1 23.4 24.5 25.3 26.1
TESTS := $(addprefix test-emacs-, $(ALL_EMACS_VERS))
all-tests: $(TESTS)
test-%:
($* $(ARGS) && echo [PASS] $*) || echo *FAIL* $*
Finally, if these processes produce output you wish to suppress:
test-%:
($* $(ARGS) > /dev/null && echo [PASS] $*) || echo *FAIL* $*
EDIT: To print all of the results after all of the script output, the simplest approach is to save them in a file, called e.g. "results":
all-tests: $(TESTS)
@cat results
@rm results
test-%:
@($* $(ARGS) && echo [PASS] $* >> results) || echo *FAIL* $* >> results
The problem has two parts. The first is to give the desired output for one test. If (as the title of your Question suggests) this depends on the return value of the process, this approach will work:
single-test:
(some-command && echo PASS) || echo FAIL
In your case, this becomes:
ARGS := -Q --batch $(LOAD_PATH) -l srt-tests.el -f srt-run-tests
test-emacs-22.1:
(emacs-22.1 $(ARGS) && echo [PASS] emacs-22.1) || echo *FAIL* emacs-22.1
The second part is to iterate over a list of versions. I suggest using a pattern rule:
ALL_EMACS_VERS := 22.1 23.4 24.5 25.3 26.1
TESTS := $(addprefix test-emacs-, $(ALL_EMACS_VERS))
all-tests: $(TESTS)
test-%:
($* $(ARGS) && echo [PASS] $*) || echo *FAIL* $*
Finally, if these processes produce output you wish to suppress:
test-%:
($* $(ARGS) > /dev/null && echo [PASS] $*) || echo *FAIL* $*
EDIT: To print all of the results after all of the script output, the simplest approach is to save them in a file, called e.g. "results":
all-tests: $(TESTS)
@cat results
@rm results
test-%:
@($* $(ARGS) && echo [PASS] $* >> results) || echo *FAIL* $* >> results
edited Nov 27 at 18:39
answered Nov 22 at 22:08
Beta
70.5k7108127
70.5k7108127
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
Yes you did. But your solution is discard Emacs detail test log (such assimple:equal
is pass,, etc.)
– Conao3
Nov 26 at 4:02
|
show 1 more comment
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
Yes you did. But your solution is discard Emacs detail test log (such assimple:equal
is pass,, etc.)
– Conao3
Nov 26 at 4:02
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
Thank you for your reply! I could not think of a way to define a job like this. However, I do not want to discard the log of each test (although my question was not well written). I edited the question so I would be happy to see it.
– Conao3
Nov 23 at 1:17
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
@NaoyaYamashita: it is now unclear what each emacs process should produce.
– Beta
Nov 25 at 16:21
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
What is unclear? I do not want to discard Emacs's all output log, and show test summary at once.
– Conao3
Nov 25 at 16:38
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
@Conao3: Then what is the problem? My solution works.
– Beta
Nov 25 at 22:05
Yes you did. But your solution is discard Emacs detail test log (such as
simple:equal
is pass,, etc.)– Conao3
Nov 26 at 4:02
Yes you did. But your solution is discard Emacs detail test log (such as
simple:equal
is pass,, etc.)– Conao3
Nov 26 at 4:02
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417323%2frun-tests-with-multiple-versions-and-collect-return-values-in-makefile%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown