Skip to content

tests/relic: move from unittests to regular test#10189

Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom
smlng:pr/tests/pkg_relic
Nov 27, 2018
Merged

tests/relic: move from unittests to regular test#10189
miri64 merged 1 commit intoRIOT-OS:masterfrom
smlng:pr/tests/pkg_relic

Conversation

@smlng
Copy link
Copy Markdown
Member

@smlng smlng commented Oct 18, 2018

Contribution description

This moves tests for the relic package from unittests to a regular
test, which should help to decrease binary size of unittests.

Testing procedure

run the tests, i.e. BOARD=<your-favourite> make -C tests/pkg_relic flash test

Issues/PRs references

@smlng smlng added Area: tests Area: tests and testing framework Area: pkg Area: External package ports Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Oct 18, 2018
@smlng smlng requested a review from jnohlgard October 18, 2018 07:23
@smlng smlng added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Oct 18, 2018
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Oct 21, 2018

Question, the DISABLE_TEST_FOR_ARM_CORTEX_M := tests-relic and others has not been propagated here. What is the reason for this ?

nucleo-l053r8 \
#

TEST_BOARDS_LLVM_COMPILE := native \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be done in the relic package to blacklist llvm if it is not compatible using TOOLCHAIN_BLACKLIST += llvm with the correct conditionals.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ah thanks, that line didn't work anyway

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ah thanks, that line didn't work anyway

TEST_BOARDS_LLVM_COMPILE := native \
#

CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(4*THREAD_STACKSIZE_DEFAULT\)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This was not set for this test in unittests why now ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

First this test was blacklisted for all platforms other than native in the unittests. I tried to run it on different boards, and I got a hard fault + reboot with increased stack size that is fixed but the test gets stuck anyway.

Copy link
Copy Markdown
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

Some big changes from what was in unittests that are not currently justified.

If the update is correct, it should be specified in the migration commit message.

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Oct 21, 2018

The test currently fails on iotlab-m3 and samr21-xpro.

With a stack size of -DTHREAD_STACKSIZE_MAIN=\(5*THREAD_STACKSIZE_DEFAULT\) test successfully executes on both boards.

@smlng smlng added 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 23, 2018
#

export TEST_BOARDS_LLVM_COMPILE := native
TOOLCHAIN_BLACKLIST += llvm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be in the relic package as it is a package issue, not from the application (like others packages using it). git grep TOOLCHAINS_BLACKLIST
And sorry it was TOOLCHAINS_BLACKLIST I was missing the S. Btw, the documentation uses the wrong name… will update it.

And currently, building in native works for ubuntu 18.04

/home/harter/work/git/RIOT/tests/pkg_relic/bin/native/tests_pkg_relic.elf
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.

main(): This is RIOT! (Version: 2018.10-devel-1204-g19e1b-inetm02-pr/riot/10189/move_from_unittests_to_regular_test)
.
OK (1 tests)

so should only disable for arm like in

ifneq (,$(filter cortex-m%,$(CPU_ARCH)))
# jerryscript package package is not using system includes right now, so
# many newlib hearders (not even stdio.h) is found
# Fixed in #9821 (so remove when merged)
TOOLCHAINS_BLACKLIST += llvm
endif

I suspect the issue with llvm to be the same as jerryscript by the way #9821

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indeed it is the same issue, so you can reuse the same comment as jerryscript.

It compiles with llvm with this fix, I can do a PR for the fix:

diff --git a/pkg/relic/Makefile b/pkg/relic/Makefile
index 7e2466c9d..d73aecbee 100644
--- a/pkg/relic/Makefile
+++ b/pkg/relic/Makefile
@@ -18,7 +18,7 @@ all: $(PKG_BUILDDIR)/Makefile

 $(PKG_BUILDDIR)/Makefile: $(TOOLCHAIN_FILE)
        cd $(PKG_BUILDDIR) && \
-       COMP="$(filter-out -Werror -Werror=old-style-definition -Werror=strict-prototypes -std=gnu99, $(CFLAGS) ) " \
+       COMP="$(INCLUDES) $(filter-out -Werror -Werror=old-style-definition -Werror=strict-prototypes -std=gnu99, $(CFLAGS) ) " \
        cmake -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
                  -DCHECK=off -DTESTS=0 -DBENCH=0 -DSHLIB=off -Wno-dev $(RELIC_CONFIG_FLAGS) .

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so just to clarify: its either blacklisting llvm for the relic package or applying your fix for jerryscript to make it work with llvm? Or is both somehow needed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would say it is now blacklisting because it does not work for llvm and cortex-m, it is a fact, and it is an immediate solution.

Making it work for llvm is an improvement that needs work, so a new feature somehow with specific review. So can come in a second step.

I do not delay this PR because of something that was broken for years.
I was just adding details so the blacklisting comment would be accurate.

INCLUDES += -I$(PKGDIRBASE)/relic/include

ifneq (,$(filter cortex-m%,$(CPU_ARCH)))
# jerryscript package package is not using system includes right now, so
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same but with relic instead of jerryscript. :p

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah fixed the wording

@smlng smlng force-pushed the pr/tests/pkg_relic branch from d9bbda4 to 569f542 Compare October 24, 2018 09:41
@cladmi cladmi added CI: run tests If set, CI server will run tests on hardware for the labeled PR 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 Nov 27, 2018
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Nov 27, 2018

I added the run tests label as it uses CI_WHITELIST and re-triggered murdock.

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Nov 27, 2018

I will finish reviewing after murdock.

Copy link
Copy Markdown
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

I successfully tested with IoT-LAB nodes with the following board and command:

BOARDS="samr21-xpro pba-d-01-kw2x b-l475e-iot01a nrf52dk arduino-zero nrf52840dk iotlab-m3 microbit frdm-kw41z"
for board in ${BOARDS}; do BOARD=${board} RIOT_CI_BUILD=1 IOTLAB_NODE=auto-ssh BUILD_IN_DOCKER=1 DOCKER="sudo docker" make --no-print-directory -C tests/pkg_relic clean all flash test || break; done

Additional compile tests that I ran:

It does not compile on wsn430-v1_3b due to missing time.h.
With the latest update of riotdocker image (ubuntu bionic), it does not fail for arduino-mega2560 anymore as time.h is available, but does not have enough memory to link.
It failed In the xenial image it fails because of missing time.h.

So ok to keep them blacklisted.

Python flake8 error

travis is complaining because the regexp for the test is not a python regex string so r'match_string'. By rebasing to riot/master it would be using the same environment as murdock, not sure it it would still be detected.

Change for the python test described inlined.

After this it would be ok to go



def testfunc(child):
child.expect('OK \(\d+ tests\)', timeout=120)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

flake8 is correctly complaining about this one, this should be a regex string

Suggested change
child.expect('OK \(\d+ tests\)', timeout=120)
child.expect(r'OK \(\d+ tests\)', timeout=120)

When rebasing to riot/master it will not be detected anymore as it will be using riotdocker image that uses the repository flake8 version but the error is still valid.

This moves tests for the relic package from unittests to a regular
test, which should help to decrease binary size of unittests.
@smlng smlng force-pushed the pr/tests/pkg_relic branch from 569f542 to 618fd16 Compare November 27, 2018 19:41
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Nov 27, 2018

@smlng Please tell when you force push, github does not send any notification about it

Copy link
Copy Markdown
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

Diff is the same as before the rebase/squash except the regex fix.

Tested the rebase again with the same boards as before.

Also a recent version of flake8 does not complain anymore about the test script.

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Nov 27, 2018

Just waiting for murdock and it will be good to merge.

@smlng
Copy link
Copy Markdown
Member Author

smlng commented Nov 27, 2018

@cladmi sorry about the force-push. On another note: the regex is wrong in some other tests in master too.

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Nov 27, 2018

I know, it was already mentioned in another test migration out of tests/unittests, but static-tests are mainly only done on changed files.

@miri64 miri64 merged commit c5ff183 into RIOT-OS:master Nov 27, 2018
@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Nov 28, 2018

Thank you for doing the migration, I find it magic all the issues there can be with simple tasks like this.

@aabadie aabadie added this to the Release 2019.01 milestone Dec 2, 2018
@smlng smlng deleted the pr/tests/pkg_relic branch June 25, 2019 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports Area: tests Area: tests and testing framework 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 Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants