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

Run samples against Docker net-tools container #19677

Merged
merged 3 commits into from
Feb 3, 2020

Conversation

pfl
Copy link
Collaborator

@pfl pfl commented Oct 8, 2019

Provide a script that runs the sample and starts a 'net-tools' container using the correct sample test Linux binary as counterpart. The Docker container executable will then return a success/not success value, whereby the script can deduce whether the sample completed successfully or not.

@zephyrbot
Copy link
Collaborator

zephyrbot commented Oct 8, 2019

All checks are passing now.

checkpatch (informational only, not a failure)

-:442: WARNING:LONG_LINE_STRING: line over 80 characters
#442: FILE: scripts/net/run-sample-tests.sh:296:
+	    start_docker "/net-tools/libcoap/examples/etsi_coaptest.sh -i eth0 192.0.2.1"

- total: 0 errors, 1 warnings, 559 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: AVOID_EXTERNS BRACES CONFIG_EXPERIMENTAL CONST_STRUCT DATE_TIME FILE_PATH_CHANGES MINMAX NETWORKING_BLOCK_COMMENT_STYLE PRINTK_WITHOUT_KERN_LEVEL SPLIT_STRING VOLATILE

NOTE: If any of the errors are false positives, please report
      them to the maintainers.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

pfalcon
pfalcon previously requested changes Oct 8, 2019
Copy link
Contributor

@pfalcon pfalcon left a comment

Choose a reason for hiding this comment

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

If the script introduced is supposed to perform heavy-weight operations, like running something in docker, can it please named in way which hints of that, instead of innocent name of "run-sample". If you don't have your own ideas, "run-sample-in-docker" would sound good to me.

samples/net/run-sample.sh Outdated Show resolved Hide resolved
@pfl pfl force-pushed the docker_samples branch 2 times, most recently from a4a2370 to 16d5112 Compare October 18, 2019 10:38
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

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

Looks good. I think we need to think more about how to override the default IP numbering scheme.

samples/net/sockets/echo_client/prj.conf Outdated Show resolved Hide resolved
scripts/net/run-sample-tests.sh Outdated Show resolved Hide resolved
scripts/net/run-sample-tests.sh Show resolved Hide resolved
CODEOWNERS Outdated Show resolved Hide resolved
@pfl pfl force-pushed the docker_samples branch 3 times, most recently from 324786a to b2d8d9b Compare October 28, 2019 11:11
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

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

Sanitychecker does not like MIT license, should we change this to Apache-2?

samples/net/sockets/echo_client/Kconfig Outdated Show resolved Hide resolved
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

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

LGTM

@jukkar
Copy link
Member

jukkar commented Oct 30, 2019

ping @nashif @pfalcon could you re-review the PR please

@jukkar jukkar requested review from nashif and pfalcon October 30, 2019 07:59
@pfalcon
Copy link
Contributor

pfalcon commented Oct 31, 2019

I don't see my comment #19677 (review) being addressed or replied to. However if there's no desire to make things easier to users (just today results of Zephyr UX study were presented at the TSC F2F meeting, and the results aren't stellar), let it be so.

@pfalcon pfalcon dismissed their stale review October 31, 2019 18:43

Dismissing to avoid blocking from my side

@pfl
Copy link
Collaborator Author

pfl commented Nov 1, 2019

I don't see my comment #19677 (review) being addressed or replied to. However if there's no desire to make things easier to users (just today results of Zephyr UX study were presented at the TSC F2F meeting, and the results aren't stellar), let it be so.

Here I tried to keep the naming generic/balanced. We might figure out something else than a Docker container to run the tests in; if so the script needs a major overhaul, but the "familiar" name would be kept. So I'm inclined to keep the name as not very docker specific as it is now.

@pfalcon
Copy link
Contributor

pfalcon commented Nov 1, 2019

@pfl: Sounds good, thanks for reply.

@jukkar
Copy link
Member

jukkar commented Nov 4, 2019

ping @nashif can you recheck and give +1 if ok.

@pfl
Copy link
Collaborator Author

pfl commented Nov 5, 2019

ping @nashif were there any concerns still?

@nashif
Copy link
Member

nashif commented Nov 5, 2019

few things:

  • Can you squash all commits related to the script in one single commit? There is no value in getting all of this into the tree when the script is being submitted the first time.
  • There is no documentation or any guidance on how this script can or should be used.
  • when I run it without any options, I am getting very cryptic output:
scripts/net/run-sample-tests.sh
$ZEPHYR_BASE /home/anashif/zephyrproject/zephyr
$NET_TOOLS_BASE /home/anashif/zephyrproject/zephyr/../net-tools
'zephyr' not supported
Sample 'zephyr' failed with return value '1'
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/networks: dial unix /var/run/docker.sock: connect: permission denied
  • Don't you need to update west.yml to point to net-tools with docker image?

@pfl
Copy link
Collaborator Author

pfl commented Nov 22, 2019

  • Can you squash all commits related to the script in one single commit? There is no value in getting all of this into the tree when the script is being submitted the first time.

Done, there is now one commit for the script itself and another for the echo_client sample.

  • There is no documentation or any guidance on how this script can or should be used.

Added a README to help with that.

  • when I run it without any options, I am getting very cryptic output:

Fixed wording of cryptic output, now it mentions that it could not figure out which sample is wanted.

@pfl
Copy link
Collaborator Author

pfl commented Nov 27, 2019

ping @nashif ?

jukkar added a commit to jukkar/zephyr that referenced this pull request Dec 3, 2019
The network sample automatic testing feature in PR zephyrproject-rtos#19677 is moved
to 2.2 so removing it from 2.1 release note.

Signed-off-by: Jukka Rissanen <[email protected]>
dleach02 pushed a commit that referenced this pull request Dec 3, 2019
The network sample automatic testing feature in PR #19677 is moved
to 2.2 so removing it from 2.1 release note.

Signed-off-by: Jukka Rissanen <[email protected]>
@pfl
Copy link
Collaborator Author

pfl commented Dec 12, 2019

ping @nashif ?

@jukkar
Copy link
Member

jukkar commented Jan 7, 2020

@nashif can you recheck this one?


* Install Docker
* Check out the net-tools project from github
* Change working directory to docker/ in the net-tools repository
Copy link
Member

Choose a reason for hiding this comment

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

is this step needed? I can't run the following command as specified from within the docker/ directory.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Documentation fixed...

* Install Docker
* Check out the net-tools project from github
* Change working directory to docker/ in the net-tools repository
* Run './net-setup.sh --config docker.conf'
Copy link
Member

Choose a reason for hiding this comment

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

Maybe 'sudo ./net-setup.sh --config docker.conf'

Copy link
Member

Choose a reason for hiding this comment

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

The script will do sudo if needed.

* Change working directory to docker/ in the net-tools repository
* Run './net-setup.sh --config docker.conf'

This creates a Docker image called 'net-tools' on your local machine.
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, nothing happens here.. I get:

i9:net-tools((HEAD detached at 354fd05)): sudo ./net-setup.sh --config docker.conf
Using docker.conf configuration file.
Creating zeth
Error response from daemon: network with name net-tools0 already exists
bridge br- does not exist!
br-

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an issue with net-tools, fix is zephyrproject-rtos/net-tools#40

In essence, the following needs to be done:

* Install Docker
* Check out the net-tools project from github
Copy link
Member

Choose a reason for hiding this comment

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

net-tools is part of the west manifest, the current sha in west.yml is old and does not have docker/ directory, you need to update west.yml with the latest net-tools and point the user to it, i.e. ../tools/net-tools. there is no need to checkout a new instance of it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@nashif
Copy link
Member

nashif commented Jan 7, 2020

-:322: WARNING:TYPO_SPELLING: 'childs' may be misspelled - perhaps 'children'?

maybe you want to address this as well :)

Add Kconfig option NET_SAMPLE_SEND_ITERATIONS that sets the number of
times the Zephyr echo client sample sends its data. By default the
value is zero, which means indefinite, and demonstrates the same
behavior as before.

Signed-off-by: Patrik Flykt <[email protected]>
Net-tools revision 4bff01084d225996e4aae84b98be5969e2f9f33d
is needed for running network sample test scripts.

Signed-off-by: Patrik Flykt <[email protected]>
Add a script that sets up Docker networking and starts the net-tools
Docker container. If successful, run Zephyr with native_posix and
execute the appropriate net-tools container executable. The proper
net-tools executable and arguments is selected depending on the
basename of the sample directory. This script needs to be updated
if the net-tools Docker image is updated in some incompatible way.

The net-tools directory is assumed to exist at the same level as
the Zephyr base directory, but its location can be set using the
'-N' command line argument. Likewise, '-Z' sets the Zephyr top level
directory.

When stopping Zephyr, go through all child processes since running a
native posix or other variant of Zephyr may cause a hierarchy of
processes to be created.

Fixes: zephyrproject-rtos#19540

Signed-off-by: Patrik Flykt <[email protected]>
@pfl
Copy link
Collaborator Author

pfl commented Jan 24, 2020

maybe you want to address this as well :)

Yes, it is horrible with misspelled function names :-)

@jukkar
Copy link
Member

jukkar commented Jan 24, 2020

ping @nashif could you recheck?

@pfl
Copy link
Collaborator Author

pfl commented Jan 27, 2020

ping @nashif

Copy link
Member

@jhedberg jhedberg left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Any chance @nashif that you could take another look before we merge?

@pfl
Copy link
Collaborator Author

pfl commented Feb 3, 2020

Ping @nashif ?

@nashif nashif merged commit 65ffc71 into zephyrproject-rtos:master Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants