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

[Unittesting P2] Add testing framework #563



Copy link

commented Aug 23, 2019

This adds the unit testing machinery and CI integration.

Should be applied after P1 (#562).
Hint: easer review doing commit by commit.

spiccinini added 7 commits Aug 22, 2019
restructure lua modules in files/path structure
This change allows uniform and easy path handling in unit tests.
Also the removal of comments is adapted and improved.
testing: add dockerfile for unittesting
Based on a (very small!) Alpine Linux image with lua 5.1 and
luarocks installed.
As some openwrt modules are needed or extremely helpful, eg uci,
libjson-c, luci-lib-ip, nixio, they are installed directly from
the 18.06.4 x86_64 packages. The rationale is to have a minimal
maintenance but at the same time do not reinvent the wheel.
Some modules should be faked instead of installed, eg: iwinfo.
testing: add tools for downloading packages from a 'debian style' repo
This tools allow downloading packages from openwrt repositories without
needing the full URL to the package, minimizing the maintenance effort.
testing: add ./tools/dockertestshell script
This tool provides an easy way to develop or test things within the testing docker image.
Some features:
* /home/$USER is mounted inside the docker image so each change you do to the code from
inside is maintained when you close the docker container
* the same applies to /tmp
* same user outside and inside docker
* network access is garanted
* allows specifying a different image tag (allowing easy upgades)
* and some goodies like bashrc, some useful ENV variables, PS1 modification, etc.

This script is also used by the run_tests script.
testing: add ./run_tests script
This script must be used to run the tests, it builds the docker
image if it is not available, and then run the tests.
When an upgrade must me done to the Docker image it can be forced
incrementing the tag in run_tests
ci: add unit-testing to travis
CI is refactored into two stages: unittests and pkgbuild.

This comment has been minimized.

Copy link
Contributor Author

commented Aug 24, 2019

Ok, travis pipeline is failing because there is no test yet (because I splited the patch series). In part 3 #564 it should be working.

.travis.yml Show resolved Hide resolved
Copy link

left a comment

Haven't tried, but looks healthy!

.travis.yml Show resolved Hide resolved

@gmarcos87 gmarcos87 self-requested a review Sep 2, 2019

@gmarcos87 gmarcos87 merged commit 2ebced2 into libremesh:master Sep 2, 2019

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.