Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/riotboot: fix test running test in docker. #12446

Merged
merged 1 commit into from
Oct 18, 2019

Conversation

fjmolinas
Copy link
Contributor

Contribution description

This PR fixes riotboot test when building in docker.

I'm not sure this is necessarily the best fix, since the issue actually comes from:

RIOT/Makefile.include

Lines 491 to 521 in 8a1e78b

ifeq ($(BUILD_IN_DOCKER),1)
link: ..in-docker-container
else
ifeq (,$(RIOTNOLINK))
link: ..compiler-check ..build-message $(BUILD_FILES) print-size
else
link: ..compiler-check ..build-message $(BASELIBS)
endif # RIOTNOLINK
$(ELFFILE): $(BASELIBS)
$(Q)$(_LINK) -o $@
$(BINDIR)/$(APPLICATION_MODULE).a: pkg-build $(BUILDDEPS)
$(Q)DIRS="$(DIRS)" "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk
$(BINDIR)/$(APPLICATION_MODULE).a: FORCE
# Other modules are built by application.inc.mk and packages building
_SUBMAKE_LIBS = $(filter-out $(BINDIR)/$(APPLICATION_MODULE).a $(APPDEPS), $(BASELIBS))
$(_SUBMAKE_LIBS): $(BINDIR)/$(APPLICATION_MODULE).a pkg-build
# 'print-size' triggers a rebuild. Use 'info-buildsize' if you do not need to rebuild.
print-size: $(ELFFILE)
$(Q)$(SIZE) $(SIZEFLAGS) $<
%.hex: %.elf
$(Q)$(OBJCOPY) $(OFLAGS) -Oihex $< $@
%.bin: %.elf
$(Q)$(OBJCOPY) $(OFLAGS) -Obinary $< $@
endif # BUILD_IN_DOCKER

So it comes from the fact that the following target is not defined when calling make test and BUILD_IN_DOCKER is set.

%.bin: %.elf
	$(Q)$(OBJCOPY) $(OFLAGS) -Obinary $< $@

Although this is not actually a build instruction it does require the tool-chain.

I think the proposed solution might be better since it is not very intrusive and can be easily introduced and backported without changing the default handling of for BUILD_IN_DOCKER. I think the handling itself is flaud

I also think this should be back-ported.

Testing procedure

As reported in #12003, the following command fails in master:

BUILD_IN_DOCKER=1 RIOTBOOT_SKIP_COMPILE=1 BOARD=iotlab-m3 make --no-print-directory -C tests/riotboot clean flash test
master
�main(): This is RIOT! (Version: 2020.01-devel-32-g9bc60-HEAD)
Hello riotboot!
You are running RIOT on a(n) iotlab-m3 board.
This board features a(n) stm32f1 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000000
Image start address: 0x08001400
Header chksum: 0x8d7ab9a1

>  curslotnr
Current slot=0
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000000
Image start address: 0x08001400
Header chksum: 0x8d7ab9a1

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x08001400
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x8001000 image: 0x08001400
slot 1: metadata: 0x8040800 image: 0x00000000
> 
compiling /home/francisco/workspace/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
make[1]: *** No rule to make target '/home/francisco/workspace/RIOT/tests/riotboot/bin/iotlab-m3/tests_riotboot-slot1.bin', needed by '/home/francisco/workspace/RIOT/tests/riotboot/bin/iotlab-m3/tests_riotboot-slot1.hdr'.  Stop.
/home/francisco/workspace/RIOT/tests/riotboot/../../Makefile.include:689: recipe for target 'test' failed
make: *** [test] Error 1
This PR
�main(): This is RIOT! (Version: 2020.01-devel-33-gdbc94-pr_fix_tests_riotboot)
Hello riotboot!
You are running RIOT on a(n) iotlab-m3 board.
This board features a(n) stm32f1 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x08001400
Header chksum: 0x8d82b9a3

>  curslotnr
Current slot=0
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x08001400
Header chksum: 0x8d82b9a3

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x08001400
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x8001000 image: 0x08001400
slot 1: metadata: 0x8040800 image: 0x08040c00
> 
[TEST PASSED]

Issues/PRs references

Related to #12003

@fjmolinas fjmolinas added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: OTA Area: Over-the-air updates labels Oct 14, 2019
@fjmolinas
Copy link
Contributor Author

@cladmi in RIOT-OS/Release-Specs#140 (comment)_

Can you take a look at this one? It should fix the tests.

@cladmi
Copy link
Contributor

cladmi commented Oct 15, 2019

@fjmolinas I will look at it. Could you already run it on murdock to check the output?

@cladmi
Copy link
Contributor

cladmi commented Oct 15, 2019

I think it will still compile the header and concatenated file while testing as it uses a different APP_VER.

It would fix the issue anyway with BUILD_IN_DOCKER but would be important for documentation.

@fjmolinas fjmolinas added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Oct 15, 2019
@fjmolinas
Copy link
Contributor Author

I think it will still compile the header and concatenated file while testing as it uses a different APP_VER.

Yes it will, but the hdr is always re-compiled from what I understand, because of the FORCE.

I was thinking of changing that as well, but it felt like a much bigger change to do before for a realease fix.

@cladmi
Copy link
Contributor

cladmi commented Oct 15, 2019

I will try finding time this afternoon or so.

@fjmolinas
Copy link
Contributor Author

I will try finding time this afternoon or so.

do what?

@cladmi
Copy link
Contributor

cladmi commented Oct 15, 2019

To review

@fjmolinas
Copy link
Contributor Author

To review

Thanks!

@cladmi
Copy link
Contributor

cladmi commented Oct 15, 2019

Even if you changed all the riotboot files, the test is not re-triggered. It must be done with disable-cache.

@fjmolinas
Copy link
Contributor Author

Even if you changed all the riotboot files, the test is not re-triggered. It must be done with disable-cache.

>: (

@fjmolinas fjmolinas added CI: disable test cache If set, CI will always run all tests regardless of whether they have been run successfully before CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Oct 15, 2019
@fjmolinas
Copy link
Contributor Author

I think I shouldn't have removed the elf-files from TEST_EXTRA_FILES I'll re-add them (later since I'm AFK right now) and re-triger murdock.

@fjmolinas fjmolinas force-pushed the pr_fix_tests_riotboot branch 2 times, most recently from 0fbd170 to b3febae Compare October 15, 2019 19:06
@fjmolinas
Copy link
Contributor Author

There is one riotboot test that is not passing. But it seems to have been an issue wth a worker, the following did pass:

    tests/riotboot/nrf52dk:llvm
    tests/riotboot/samr21-xpro:llvm
    tests/riotboot/samr21-xpro:gnu

@fjmolinas fjmolinas removed the CI: disable test cache If set, CI will always run all tests regardless of whether they have been run successfully before label Oct 15, 2019
@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

The test worked on my boards with the setup used for the initial issue and the release testing with BUILD_IN_DOCKER=1 and no local toolchain.

I tested frdm-k64f, frdm-kw41z, nrf52dk, pba-d-01-kw2x, sltb001a.
https://ci-ilab.imp.fu-berlin.de/view/all/job/experimental-pull-request-tests/84/consoleText

So on the code, adding the BUILD_FILES += $(SLOT_RIOT_BINS) is the solution.

One conceptual question, would it make sense to still define the BUILD_FILES += $(SLOT_RIOT_BINS) (and may ELFS) in riotboot.mk?
It would not be for fixing the test, but to say "compiling when you want the applications slots should generate both slots binaries/elfs".
And so result in a comment update.


I will do a local testing of why BUILD_FILES += $(SLOT_RIOT_ELFS) is needed for the test in CI. My first guess would be that changing to TEST_EXTRA_FILES = $(SLOT_RIOT_BINS) may prevent it but not sure yet.

@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

Second thought I would also generate the ELF slots and so keep them in BUILD_FILES as they are used for debugging.

@fjmolinas
Copy link
Contributor Author

I will do a local testing of why BUILD_FILES += $(SLOT_RIOT_ELFS) is needed for the test in CI. My first guess would be that changing to TEST_EXTRA_FILES = $(SLOT_RIOT_BINS) may prevent it but not sure yet.

Do you want me to re-trigger a build to get the error message?

@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

@fjmolinas The murdock queue is empty so could be good yes.

@fjmolinas
Copy link
Contributor Author

Agreed, it was just if first a smaller change would be easier to backport before doing the full cleanup.

Can I squash right away?

@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

Yeah sure. It is easy to know what you changed.

@fjmolinas fjmolinas force-pushed the pr_fix_tests_riotboot branch from 3ac7510 to 62dbe13 Compare October 17, 2019 12:40
@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

Hmm without docker it requires the elf files, I missed this I guess.

@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

I try to find out why.

@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

%.bin: %.elf
$(Q)$(OBJCOPY) $(OFLAGS) -Obinary $&lt; $@

I am stupid, it was the line in the original comment. I did not realize it was only defined when not building in docker.

@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

As the test is compiling again, it will of course look at the dependencies of the .bin, but as murdock only has a few files and uses RIOTBOOT_SKIP_COMPILE=1 so it will try to generate the elf file again but does not know how. (And we would not want to rebuild it anyway there).

So we need to send the .elf file and will anyway generate the .bin and when building with BUILD_IN_DOCKER both the .bin and the .elf.

@fjmolinas fjmolinas removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 17, 2019
@fjmolinas fjmolinas force-pushed the pr_fix_tests_riotboot branch from 62dbe13 to 4d898f8 Compare October 17, 2019 15:10
@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

The new version works

The test from #12446 (comment)
worked and is supposed to be the murdock behavior with BOARD=samr21-xpro bash test.sh

BOARD=samr21-xpro bash test.sh
+ make
Building application "tests_riotboot" for "samr21-xpro" with MCU "samd21".

"make" -C /home/harter/work/git/RIOT/boards/samr21-xpro
"make" -C /home/harter/work/git/RIOT/core
"make" -C /home/harter/work/git/RIOT/cpu/samd21
"make" -C /home/harter/work/git/RIOT/cpu/cortexm_common
"make" -C /home/harter/work/git/RIOT/cpu/cortexm_common/periph
"make" -C /home/harter/work/git/RIOT/cpu/sam0_common
"make" -C /home/harter/work/git/RIOT/cpu/sam0_common/periph
"make" -C /home/harter/work/git/RIOT/cpu/samd21/periph
"make" -C /home/harter/work/git/RIOT/drivers
"make" -C /home/harter/work/git/RIOT/drivers/periph_common
"make" -C /home/harter/work/git/RIOT/sys
"make" -C /home/harter/work/git/RIOT/sys/auto_init
"make" -C /home/harter/work/git/RIOT/sys/checksum
"make" -C /home/harter/work/git/RIOT/sys/isrpipe
"make" -C /home/harter/work/git/RIOT/sys/newlib_syscalls_default
"make" -C /home/harter/work/git/RIOT/sys/pm_layered
"make" -C /home/harter/work/git/RIOT/sys/riotboot
"make" -C /home/harter/work/git/RIOT/sys/shell
"make" -C /home/harter/work/git/RIOT/sys/stdio_uart
"make" -C /home/harter/work/git/RIOT/sys/tsrb
"make" -C /home/harter/work/git/RIOT/boards/samr21-xpro
"make" -C /home/harter/work/git/RIOT/core
"make" -C /home/harter/work/git/RIOT/cpu/samd21
"make" -C /home/harter/work/git/RIOT/cpu/cortexm_common
"make" -C /home/harter/work/git/RIOT/cpu/cortexm_common/periph
"make" -C /home/harter/work/git/RIOT/cpu/sam0_common
"make" -C /home/harter/work/git/RIOT/cpu/sam0_common/periph
"make" -C /home/harter/work/git/RIOT/cpu/samd21/periph
"make" -C /home/harter/work/git/RIOT/drivers
"make" -C /home/harter/work/git/RIOT/drivers/periph_common
"make" -C /home/harter/work/git/RIOT/sys
"make" -C /home/harter/work/git/RIOT/sys/checksum
"make" -C /home/harter/work/git/RIOT/sys/newlib_syscalls_default
"make" -C /home/harter/work/git/RIOT/sys/pm_layered
"make" -C /home/harter/work/git/RIOT/sys/riotboot
"make" -C /home/harter/work/git/RIOT/sys/stdio_uart
compiling /home/harter/work/git/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.0.riot.bin...
   text	   data	    bss	    dec	    hex	filename
  11636	    504	   2612	  14752	   39a0	/home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot.elf
+++ make info-debug-variable-FLASHFILE info-debug-variable-TEST_EXTRA_FILES
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-TEST_EXTRA_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin
++ echo '!' -name tests_riotboot-slot0-extended.bin
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-TEST_EXTRA_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.elf
++ echo '!' -name tests_riotboot-slot0.elf
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-TEST_EXTRA_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.elf
++ echo '!' -name tests_riotboot-slot1.elf
+ TEST_FILES='! -name tests_riotboot-slot0-extended.bin
! -name tests_riotboot-slot0.elf
! -name tests_riotboot-slot1.elf'
+ find bin/ '!' -name tests_riotboot-slot0-extended.bin '!' -name tests_riotboot-slot0.elf '!' -name tests_riotboot-slot1.elf -type f -exec rm -r '{}' ';'
+ rm -r bin/samr21-xpro/application_tests_riotboot/ bin/samr21-xpro/auto_init/ bin/samr21-xpro/board/ bin/samr21-xpro/checksum/ bin/samr21-xpro/core/ bin/samr21-xpro/cortexm_common/ bin/samr21-xpro/cortexm_common_periph/ bin/samr21-xpro/cpu/ bin/samr21-xpro/drivers/ bin/samr21-xpro/isrpipe/ bin/samr21-xpro/newlib_syscalls_default/ bin/samr21-xpro/periph/ bin/samr21-xpro/periph_common/ bin/samr21-xpro/pm_layered/ bin/samr21-xpro/riotboot/ bin/samr21-xpro/riotbuild/ bin/samr21-xpro/sam0_common/ bin/samr21-xpro/sam0_common_periph/ bin/samr21-xpro/shell/ bin/samr21-xpro/stdio_uart/ bin/samr21-xpro/sys/ bin/samr21-xpro/tsrb/
+ ls bin/samr21-xpro
tests_riotboot-slot0.elf
tests_riotboot-slot0-extended.bin
tests_riotboot-slot1.elf
+ make flash-only
/home/harter/work/git/RIOT/dist/tools/edbg/edbg  --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin --verify || /home/harter/work/git/RIOT/dist/tools/edbg/edbg  --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin --verify --program
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Verification...................
at address 0x1004 expected 0x00, read 0x02
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Programming............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ done.
Verification............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ done.
+ make test
expecting slot number 0, app_ver 0
curslotnr
/home/harter/work/git/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --noprefix --no-repeat-command-on-empty-line
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
main(): This is RIOT! (Version: 2020.01-devel-1-g4d898-pr/riot/12446/fix_test_running_test_in_docker_)
Hello riotboot!
You are running RIOT on a(n) samr21-xpro board.
This board features a(n) samd21 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000000
Image start address: 0x00001100
Header chksum: 0x7f7aaea1

>  curslotnr
Current slot=0
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000000
Image start address: 0x00001100
Header chksum: 0x7f7aaea1

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x00001100
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x1000 image: 0x00001100
slot 1: metadata: 0x20800 image: 0x00000000
> 
compiling /home/harter/work/git/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.1.riot.bin...
/home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 133120 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.1.riot.bin --verify || /home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 133120 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.1.riot.bin --verify --program
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Verification...
at address 0x20800 expected 0x52, read 0x00
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Programming.................................................... done.
Verification.................................................... done.
expecting slot number 1, app_ver 1
curslotnr
/home/harter/work/git/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --noprefix --no-repeat-command-on-empty-line
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
main(): This is RIOT! (Version: 2020.01-devel-1-g4d898-pr/riot/12446/fix_test_running_test_in_docker_)
Hello riotboot!
You are running RIOT on a(n) samr21-xpro board.
This board features a(n) samd21 MCU.
riotboot_test: running from slot 1
Image magic_number: 0x544f4952
Image Version: 0x00000001
Image start address: 0x00020900
Header chksum: 0x6f80a6a4

>  curslotnr
Current slot=1
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000001
Image start address: 0x00020900
Header chksum: 0x6f80a6a4

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x00001100
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x1000 image: 0x00001100
slot 1: metadata: 0x20800 image: 0x00020900
> 
compiling /home/harter/work/git/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.2.riot.bin...
/home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 0x1000 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.2.riot.bin --verify || /home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 0x1000 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.2.riot.bin --verify --program
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Verification...
at address 0x1004 expected 0x02, read 0x00
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Programming.................................................... done.
Verification.................................................... done.
expecting slot number 0, app_ver 2
curslotnr
/home/harter/work/git/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --noprefix --no-repeat-command-on-empty-line
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
main(): This is RIOT! (Version: 2020.01-devel-1-g4d898-pr/riot/12446/fix_test_running_test_in_docker_)
Hello riotboot!
You are running RIOT on a(n) samr21-xpro board.
This board features a(n) samd21 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x00001100
Header chksum: 0x7f82aea3

>  curslotnr
Current slot=0
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x00001100
Header chksum: 0x7f82aea3

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x00001100
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x1000 image: 0x00001100
slot 1: metadata: 0x20800 image: 0x00020900
> 
[TEST PASSED]

When replacing info-debug-variable-TEST_EXTRA_FILES to info-debug-variable-BUILD_FILES in the test (I should have made this configurable now that I look at it), it works when doing BUILD_IN_DOCKER=1 BOARD=samr21-xpro bash test.sh

BUILD_IN_DOCKER=1 DOCKER="sudo docker" BOARD=samr21-xpro bash test.sh
+ make
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' -v '/home/harter/.gitcache:/data/riotbuild/gitcache:delegated' -e 'GIT_CACHE_DIR=/data/riotbuild/gitcache'   \
    -e 'BOARD=samr21-xpro' \
    -w '/data/riotbuild/riotbase/tests/riotboot/' \
    'riot/riotbuild:latest' make   
�[1;32mBuilding application "tests_riotboot" for "samr21-xpro" with MCU "samd21".�[0m

"make" -C /data/riotbuild/riotbase/boards/samr21-xpro
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/samd21
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/sam0_common
"make" -C /data/riotbuild/riotbase/cpu/sam0_common/periph
"make" -C /data/riotbuild/riotbase/cpu/samd21/periph
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/checksum
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/riotboot
"make" -C /data/riotbuild/riotbase/sys/shell
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/boards/samr21-xpro
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/samd21
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/sam0_common
"make" -C /data/riotbuild/riotbase/cpu/sam0_common/periph
"make" -C /data/riotbuild/riotbase/cpu/samd21/periph
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/checksum
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/riotboot
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
compiling /data/riotbuild/riotbase/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /data/riotbuild/riotbase/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.0.riot.bin...
   text	   data	    bss	    dec	    hex	filename
  11636	    504	   2612	  14752	   39a0	/data/riotbuild/riotbase/tests/riotboot/bin/samr21-xpro/tests_riotboot.elf
+++ make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin
++ echo '!' -name tests_riotboot-slot0-extended.bin
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.bin
++ echo '!' -name tests_riotboot-slot0.bin
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.bin
++ echo '!' -name tests_riotboot-slot1.bin
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.elf
++ echo '!' -name tests_riotboot-slot0.elf
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.elf
++ echo '!' -name tests_riotboot-slot1.elf
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot.elf
++ echo '!' -name tests_riotboot.elf
++ for i in $(make info-debug-variable-FLASHFILE info-debug-variable-BUILD_FILES)
+++ basename /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin
++ echo '!' -name tests_riotboot-slot0-extended.bin
+ TEST_FILES='! -name tests_riotboot-slot0-extended.bin
! -name tests_riotboot-slot0.bin
! -name tests_riotboot-slot1.bin
! -name tests_riotboot-slot0.elf
! -name tests_riotboot-slot1.elf
! -name tests_riotboot.elf
! -name tests_riotboot-slot0-extended.bin'
+ find bin/ '!' -name tests_riotboot-slot0-extended.bin '!' -name tests_riotboot-slot0.bin '!' -name tests_riotboot-slot1.bin '!' -name tests_riotboot-slot0.elf '!' -name tests_riotboot-slot1.elf '!' -name tests_riotboot.elf '!' -name tests_riotboot-slot0-extended.bin -type f -exec rm -r '{}' ';'
+ rm -r bin/samr21-xpro/application_tests_riotboot/ bin/samr21-xpro/auto_init/ bin/samr21-xpro/board/ bin/samr21-xpro/checksum/ bin/samr21-xpro/core/ bin/samr21-xpro/cortexm_common/ bin/samr21-xpro/cortexm_common_periph/ bin/samr21-xpro/cpu/ bin/samr21-xpro/drivers/ bin/samr21-xpro/isrpipe/ bin/samr21-xpro/newlib_syscalls_default/ bin/samr21-xpro/periph/ bin/samr21-xpro/periph_common/ bin/samr21-xpro/pm_layered/ bin/samr21-xpro/riotboot/ bin/samr21-xpro/riotbuild/ bin/samr21-xpro/sam0_common/ bin/samr21-xpro/sam0_common_periph/ bin/samr21-xpro/shell/ bin/samr21-xpro/stdio_uart/ bin/samr21-xpro/sys/ bin/samr21-xpro/tsrb/
+ ls bin/samr21-xpro
tests_riotboot.elf
tests_riotboot-slot0.bin
tests_riotboot-slot0.elf
tests_riotboot-slot0-extended.bin
tests_riotboot-slot1.bin
tests_riotboot-slot1.elf
+ make flash-only
/home/harter/work/git/RIOT/dist/tools/edbg/edbg  --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin --verify || /home/harter/work/git/RIOT/dist/tools/edbg/edbg  --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0-extended.bin --verify --program
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Verification...................
at address 0x1004 expected 0x00, read 0x02
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Programming............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ done.
Verification............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ done.
+ make test
expecting slot number 0, app_ver 0
curslotnr
/home/harter/work/git/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --noprefix --no-repeat-command-on-empty-line
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
main(): This is RIOT! (Version: 2020.01-devel-1-g4d898-pr/riot/12446/fix_test_running_test_in_docker_)
Hello riotboot!
You are running RIOT on a(n) samr21-xpro board.
This board features a(n) samd21 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000000
Image start address: 0x00001100
Header chksum: 0x7f7aaea1

>  curslotnr
Current slot=0
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000000
Image start address: 0x00001100
Header chksum: 0x7f7aaea1

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x00001100
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x1000 image: 0x00001100
slot 1: metadata: 0x20800 image: 0x00000000
> 
compiling /home/harter/work/git/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.1.riot.bin...
/home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 133120 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.1.riot.bin --verify || /home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 133120 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot1.1.riot.bin --verify --program
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Verification...
at address 0x20800 expected 0x52, read 0x00
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Programming.................................................... done.
Verification.................................................... done.
expecting slot number 1, app_ver 1
curslotnr
/home/harter/work/git/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --noprefix --no-repeat-command-on-empty-line
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
main(): This is RIOT! (Version: 2020.01-devel-1-g4d898-pr/riot/12446/fix_test_running_test_in_docker_)
Hello riotboot!
You are running RIOT on a(n) samr21-xpro board.
This board features a(n) samd21 MCU.
riotboot_test: running from slot 1
Image magic_number: 0x544f4952
Image Version: 0x00000001
Image start address: 0x00020900
Header chksum: 0x6f80a6a4

>  curslotnr
Current slot=1
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000001
Image start address: 0x00020900
Header chksum: 0x6f80a6a4

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x00001100
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x1000 image: 0x00001100
slot 1: metadata: 0x20800 image: 0x00020900
> 
compiling /home/harter/work/git/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.2.riot.bin...
/home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 0x1000 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.2.riot.bin --verify || /home/harter/work/git/RIOT/dist/tools/edbg/edbg --offset 0x1000 --target atmel_cm0p --verbose --file /home/harter/work/git/RIOT/tests/riotboot/bin/samr21-xpro/tests_riotboot-slot0.2.riot.bin --verify --program
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Verification...
at address 0x1004 expected 0x02, read 0x00
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800001974 01.1A.00FB (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev B)
Programming.................................................... done.
Verification.................................................... done.
expecting slot number 0, app_ver 2
curslotnr
/home/harter/work/git/RIOT/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --noprefix --no-repeat-command-on-empty-line
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
main(): This is RIOT! (Version: 2020.01-devel-1-g4d898-pr/riot/12446/fix_test_running_test_in_docker_)
Hello riotboot!
You are running RIOT on a(n) samr21-xpro board.
This board features a(n) samd21 MCU.
riotboot_test: running from slot 0
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x00001100
Header chksum: 0x7f82aea3

>  curslotnr
Current slot=0
> curslothdr
 curslothdr
Image magic_number: 0x544f4952
Image Version: 0x00000002
Image start address: 0x00001100
Header chksum: 0x7f82aea3

> getslotaddr 0
 getslotaddr 0
Slot 0 address=0x00001100
> dumpaddrs
 dumpaddrs
slot 0: metadata: 0x1000 image: 0x00001100
slot 1: metadata: 0x20800 image: 0x00020900
> 
[TEST PASSED]

@fjmolinas fjmolinas added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 17, 2019
@cladmi
Copy link
Contributor

cladmi commented Oct 17, 2019

The comment is clear enough for me, but it will be more the maintainer that reviews it that will have an opinion.

@fjmolinas
Copy link
Contributor Author

@aabadie can you take a look at this one?

@fjmolinas fjmolinas requested review from aabadie and removed request for aabadie October 18, 2019 09:51
tests/riotboot/Makefile Outdated Show resolved Hide resolved
@aabadie
Copy link
Contributor

aabadie commented Oct 18, 2019

I confirm this PR is fixing the mentioned issue. Comparing PR with master shows the testing procedure is fixed.
Will #12003 be fully fixed once this one is merged ? (if yes, use fixes #12003 in the PR "Related PRs/issues" section).

- When running `BUILD_IN_DOCKER=1 make -C tests/riotboot test`
  new slot binaries (fw + hdr) need to be generated.
  `%.bin: %.elf` is no defined when building in docker, so the
  fw binaries $(SLOT_RIOT_ELFS:%.elf=%.bin) are added to
  BUILD_FILES
@fjmolinas fjmolinas force-pushed the pr_fix_tests_riotboot branch from 4d898f8 to 57b09f1 Compare October 18, 2019 13:56
@fjmolinas
Copy link
Contributor Author

Will #12003 be fully fixed once this one is merged ? (if yes, use fixes #12003 in the PR "Related PRs/issues" section).

No, there is still the bootloader issue.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@aabadie aabadie added the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Oct 18, 2019
@aabadie
Copy link
Contributor

aabadie commented Oct 18, 2019

I added the Needs backport label, since it's marked as a bug.

@aabadie aabadie merged commit 04712db into RIOT-OS:master Oct 18, 2019
@aabadie
Copy link
Contributor

aabadie commented Oct 18, 2019

Please provide a backport @fjmolinas.

@fjmolinas
Copy link
Contributor Author

Backport provided in #12499

@kb2ma kb2ma added this to the Release 2019.10 milestone Oct 27, 2019
@fjmolinas fjmolinas deleted the pr_fix_tests_riotboot branch July 31, 2020 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: OTA Area: Over-the-air updates CI: disable test cache If set, CI will always run all tests regardless of whether they have been run successfully before CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants