murdock: initial hardware-in-the-loop support#8801
Conversation
4d1acce to
a8667a3
Compare
|
|
||
| info-unittests: | ||
| @echo $(UNIT_TESTS) | ||
|
|
There was a problem hiding this comment.
It won't be useful to give info for any test? Why only for unittests (at least in the examples you're giving).
There was a problem hiding this comment.
Only unittests are split into tests-*. This info target outputs that information. I want to use that to split up the unittests into seperate binaries for platforms where all tests don't fit.
There was a problem hiding this comment.
I want to use that to split up the unittests into seperate binaries for platforms where all tests don't fit.
finally (:
|
This is ready for review. |
|
I'll proactively squash now that I'm happy ;) |
|
I added more tests. Let's see what murdock says. |
makefiles/murdock.inc.mk
Outdated
|
|
||
| # don't whitelist tests if there's no binary | ||
| ifeq (1,$(RIOTNOLINK)) | ||
| TEST_WHITELIST:= |
There was a problem hiding this comment.
Maybe call this variable TEST_BOARD_WHITELIST to be more explicit ?
There was a problem hiding this comment.
+1
With the TEST_WHITELIST = all lines I was wondering if all was a make target.
There was a problem hiding this comment.
how about TEST_ON_CI_WHITELIST?
There was a problem hiding this comment.
are boards in CI_BOARDS_WHITELIST compile-tested or not?
There was a problem hiding this comment.
are boards in CI_BOARDS_WHITELIST compile-tested or not?
Good point. Since you need to build before running, there's no need for it indeed. The HIL test will also check the build.
There was a problem hiding this comment.
I even missed it was a variable only for CI and not for tests in general. So yes having it explicit is good.
cladmi
left a comment
There was a problem hiding this comment.
I agree with the global idea and implementation.
Its good to separate building machine from testing machine.
I just added some remarks inline.
| make -C${appdir} clean all -j${JOBS:-4} | ||
| RES=$? | ||
|
|
||
| # run tests |
There was a problem hiding this comment.
The compile function compiles and runs tests, maybe it could be renamed and split in subfunctions.
This would allow removing the 5 levels of if.
There was a problem hiding this comment.
Tests are only actually run on native (see below).
On other boards, the compile function runs "make test-murdock", which in turn creates a "run_test" job. thus the test jobs only created by compile().
Without massive refactoring, it has to be done like this.
There was a problem hiding this comment.
No problem to run everything at once.
I was just talking about renaming the function, which could then in bash, call two sub functions to split the function in two in the script. But its cosmetic and only used by murdock. So do as you wish with it.
There was a problem hiding this comment.
the murdock scripts use the actual function name to sort the results. Thus if "compile" gets changed into e.g., "dispatch_compile_and_test", murdock would call that job "dispatch_compile_and_test//" and also put the job's output into that folder + /output.txt. Thus I'm reluctant to change too much for now.
makefiles/murdock.inc.mk
Outdated
|
|
||
| # don't whitelist tests if there's no binary | ||
| ifeq (1,$(RIOTNOLINK)) | ||
| TEST_WHITELIST:= |
There was a problem hiding this comment.
+1
With the TEST_WHITELIST = all lines I was wondering if all was a make target.
| endif | ||
|
|
||
| # create $(BINDIR)/.test file only if BOARD is in $(TEST_WHITELIST) | ||
| link: $(BINDIR)/.test |
There was a problem hiding this comment.
Using the .test file here is only for knowing if there is a test because without running make another time right? which is a good reason, just asking.
A make runavailabletest that does nothing if there is no tests could be nice when run from command line.
But it would be another PR and both would be necessary.
Makefile remark:
Right now the rm -f $@ does nothing. Because if the file is there, even if TEST_WHITELIST is changed, it will not be deleted. The target could be set .PHONY to be re-run everytime.
Right now this file is created even when not in murdock, so you could remove the link: $(BINDIR)/.test dependency line and just make murdock script generate it make clean all "${BINDIR}/.test"
There was a problem hiding this comment.
Makefile remark:
will fix
There was a problem hiding this comment.
The target could be set .PHONY to be re-run everytime.
I chose that option so if the Makefile changes, this removes a potentially existing .test.
There was a problem hiding this comment.
The target could be set .PHONY to be re-run everytime.
I chose that option so if the Makefile changes, this removes a potentially existing .test after Makefile changes.
.murdock
Outdated
| BOARD=$board make -C${appdir} test | ||
| RES=$? | ||
| else | ||
| if is_in_list "$board" "$TEST_BOARDS_AVAILABLE"; then |
| if [ $RUN_TESTS -eq 1 -o "$board" = "native" ]; then | ||
| if [ -f "${BINDIR}/.test" ]; then | ||
| if [ "$board" = "native" ]; then | ||
| BOARD=$board make -C${appdir} test |
There was a problem hiding this comment.
Why not run the native tests also with test-murdock this would allow separating their output in murdock result ?
There was a problem hiding this comment.
This is an optimization. Justs running the test saves the CI to create a job (with the attached .elf), copy job to the murdock master (over potentially slow network), then dispatch to a worker. That's an unnecessary network round trip.
The end result is that failed native tests end up as failed compile job, which is IMO cosmetic and (for now) worth the benefits of saving the network bandwidth.
| # | ||
|
|
||
| # (HACK) get actual flash binary from FFLAGS. | ||
| FLASHFILE:=$(filter $(HEXFILE) $(ELFFILE:.elf=.bin) $(ELFFILE),$(FFLAGS)) |
There was a problem hiding this comment.
It will not work for boards using jlink.sh as flasher as it does not get the filename from command line but from an environment variable… so there is nothing in FFLAGS.
Also having a FLASHFILE variable is something I am interested to fix in general.
Move the FLASHFILE outside of FFLAGS and be called as $(FLASHER) $(FFLAGS) $(FLASHFILE).
We currently mix FLASHFILE and HEXFILE/ELFFILE/BINFILE names right now, and some HEXFILE are .bin.
Also, for nucleo boards we generate only an hex file when a .bin file is needed to flash over the mounted volume. And we will need to be able to generate both outputs to handle different flashing.
There was a problem hiding this comment.
Yeah. I started fixing that for this PR, then decided that I'd prefer to support boards working with this FLASHFILE hack first and solve the problem afterwards. Ideally, once solved elsewhere, only the "FLASHFILE" variable has to be removed,and until then, we can run tests on all boards where the hack works.
There was a problem hiding this comment.
Yep, should be fixed in its proper PR.
@kYc0o please open another PR for extending the enabled tests, so we split infrastructure and its application. Otherwise, this PR is unnecessarily blocked until all tests complete successfully. |
OK, I pushed here since it was already adding some tests, and I wasn't sure it would work also for a separated PR. I'll open another one then. |
IMO whe should get this in. @cladmi care to ACK? |
|
@smlng @cgundogan maybe you could take a look? |
|
@cladmi ping ACK now and I'll bring a random berlin bottled craft beer to the next pizza day! |
cladmi
left a comment
There was a problem hiding this comment.
Looks good now.
Sorry I was on a "lets finish this quickly before doing reviews" streak and yeah takes longer than expected…
(which beer ? :p)
|
Please rebase |
|
Its good for me, I let you merge when you want if you want more feedback. |
Let's see how the nightly looks like. |
|
Ahja, and let's not tell everyone that on-hardware test can be triggered using the "CI: run tests" label, and test this a bit with selected PR's first. 😏 |
Surprise! |
Contribution description
This PR adds:
the make target "test-murdock", which will run "make test" for the given board on murdock. (needs authentication to be set up)
a per-application variable "TEST_WHITELIST", which is supposed to contain a list of boards on which CI should execute "make test".
some code in
.murdockthat executes "make test" after successful compilation, on nightly builds or if the label "CI: run tests" is set.Don't merge (yet), this needs a worker for every board in "TEST_WHITELIST", otherwise CI builds stall forever.