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

Maska989/ping_test #254

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Maska989/ping_test #254

wants to merge 1 commit into from

Conversation

maska989
Copy link
Contributor

@maska989 maska989 commented Sep 18, 2023

Description

JIRA: CI-326

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

@maska989 maska989 added the Tests label Sep 18, 2023
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
@maska989 maska989 force-pushed the maska989/ping_test branch 2 times, most recently from 7e2369c to b5fd34f Compare September 18, 2023 10:23
@github-actions
Copy link

github-actions bot commented Sep 18, 2023

Unit Test Results

5 681 tests   - 1 779   5 142 ✅  - 1 602   28m 25s ⏱️ - 10m 15s
  313 suites  -   107     537 💤  -   178 
    1 files   ±    0       2 ❌ +    1 

For more details on these failures, see this check.

Results for commit 0981721. ± Comparison against base commit 04b1486.

This pull request removes 1780 and adds 1 tests. Note that renamed tests count towards both.
flash ‑ armv7a9-zynq7000-zedboard:flash
phoenix-rtos-tests/cpp/hello-cpp ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/cpp/hello-cpp
phoenix-rtos-tests/cpp/hello-cpp ‑ armv7a9-zynq7000-zedboard:phoenix-rtos-tests/cpp/hello-cpp
phoenix-rtos-tests/initfini/main ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/initfini/main
phoenix-rtos-tests/initfini/main ‑ armv7a9-zynq7000-zedboard:phoenix-rtos-tests/initfini/main
phoenix-rtos-tests/ioctl/unit ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/ioctl/unit.ioctl.data_in
phoenix-rtos-tests/ioctl/unit ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/ioctl/unit.ioctl.data_in_big
phoenix-rtos-tests/ioctl/unit ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/ioctl/unit.ioctl.data_inout
phoenix-rtos-tests/ioctl/unit ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/ioctl/unit.ioctl.data_inout_big
phoenix-rtos-tests/ioctl/unit ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/ioctl/unit.ioctl.data_out
…
phoenix-rtos-tests/psh/ping_lan ‑ armv7m7-imxrt106x-evk:phoenix-rtos-tests/psh/ping_lan

♻️ This comment has been updated with latest results.

@maska989 maska989 marked this pull request as ready for review September 18, 2023 12:32
Copy link
Member

@mateusz-bloch mateusz-bloch left a comment

Choose a reason for hiding this comment

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

Overall, the test looks good.

Do we know if pinging domain names works, and is there an intention to support it?
What happen if we ping broadcast address?

psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
psh/test-ping.py Outdated Show resolved Hide resolved
@maska989 maska989 force-pushed the maska989/ping_test branch 9 times, most recently from 20ff96e to 4bb41a8 Compare September 27, 2023 12:53
@nalajcie
Copy link
Member

Generic remarks:

  • we agreed to set up networking by directly using ifconfig command (right now from busybox, psh applet in the future)
  • don't assume the networking doesn't work at the beginning of the test (we will successively add more networking tests, this might not be the first one to run)
  • make the test run as fast as possible (we don't want to waste too much time waiting for CI results in PRs), eventual long tests need to be a separate testcase running only in nightly workflows (but still not exceedingly long)
  • structure the code that basic ping test could be re-used multiple times as it's a great check if networking works (eg. we would like to assign static IP, check if networking works, assign IP from DHCP, check if ping works, enable special network firewall rules, check if incoming/outgoing packets to certain hosts are indeed blocked) - these are all networking tests which will use ping as a verification tool
  • no need to solve it in this PR, but take note that this is a hard task, probably would need architectural changes in trunner - how to assign unique static IP (and other properties in the future) for every runner instance individually in a generic way to be available/used in harnesses while testing
  • please don't reformat python files unnecessarily

@maska989 maska989 marked this pull request as draft September 28, 2023 06:16
@maska989
Copy link
Contributor Author

maska989 commented Sep 28, 2023

TWM for writing about generic remarks, all of this needs rethink about test structure and runner options.
About:

* please don't reformat python files unnecessarily

Rn I'm using this PR to research/configure Ethernet support on QEMU ia32 because CI if even run network.sh to set up still ping don't pass.
https://github.com/phoenix-rtos/phoenix-rtos-project/pull/852
That's why still this test isn't converted to use just ifconfig.
My fault was not converted this PR to draft, probably after full research I will delete this PR and create new one (or clear a little bit for focus strictly on ping test).

Again, thanks 4 all your help.

@nalajcie
Copy link
Member

Rn I'm using this PR to research/configure Ethernet support on QEMU ia32 because CI if even run network.sh to set up still ping don't pass. https://github.com/phoenix-rtos/phoenix-rtos-project/pull/852 That's why still this test isn't converted to use just ifconfig. My fault was not converted this PR to draft, probably after full research I will delete this PR and create new one (or clear a little bit for focus strictly on ping test).

IMHO using ifconfig directly would make experimenting clearer. From what I see:

  • you're using DHCP setup right now - so that won't work in qemu bridged mode straight away (no DHCP server in GH network would want to give you an address due to security reasons)
  • the dhcp could easily be used in user qemu set-up but this won't allow us to reach WAN (still, ping 10.0.2.2 works (default for qemu server, can be configured by params as described in help))
  • we probably should set-up bridge networking with NAT/private DHCP (should be possible in docker, not sure about tap interface tho) if we need access to WAN
  • all the above network-setup tests can be done locally (in docker - you can disconnect it from network)
  • if network setup would still fail in CI after the local testing succeeds - I would advice adding ssh tunnel to CI and experiment interactively in runner (eg: https://github.com/mxschmitt/action-tmate)
  • for PING tests we don't need access to WAN, we could simply use only LAN addresses (eg. the address of the host running test runner)
  • nevertheless, setup with WAN access might be beneficial in the future in other tests (eg. ntp client, wget, etc. -> we won't need to set up local instances of various servers on the test runner host ;))

@maska989 maska989 force-pushed the maska989/ping_test branch 5 times, most recently from 4d581c8 to 6535925 Compare October 10, 2023 08:31
@maska989 maska989 force-pushed the maska989/ping_test branch 2 times, most recently from 072f28a to 2e9f237 Compare October 26, 2023 07:15
psh/test-hw-ping-lan.py Outdated Show resolved Hide resolved
psh/test-hw-ping-lan.py Outdated Show resolved Hide resolved
@maska989 maska989 marked this pull request as ready for review November 16, 2023 12:56
@maska989
Copy link
Contributor Author

Right now this PR waiting for ifconfig and route implementation.

psh/test.yaml Outdated Show resolved Hide resolved
@maska989 maska989 force-pushed the maska989/ping_test branch 4 times, most recently from cc57492 to 7163e55 Compare December 7, 2023 08:25
psh/test-hw-ping-lan.py Outdated Show resolved Hide resolved
psh/test-hw-ping-lan.py Outdated Show resolved Hide resolved
@maska989 maska989 force-pushed the maska989/ping_test branch 2 times, most recently from 5b3ecaf to 8724481 Compare December 7, 2023 14:52
@maska989 maska989 marked this pull request as draft December 8, 2023 07:34
@maska989 maska989 force-pushed the maska989/ping_test branch 2 times, most recently from 44aeddc to b420c60 Compare December 21, 2023 12:46
Copy link
Member

@mateusz-bloch mateusz-bloch left a comment

Choose a reason for hiding this comment

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

Several morelike cosmetic improvements, you don't have to apply them if you don't want to

psh/test-hw-ping-lan.py Outdated Show resolved Hide resolved
psh/test-hw-ping-lan.py Outdated Show resolved Hide resolved
psh/test-hw-ping-wan.py Outdated Show resolved Hide resolved
psh/test-hw-ping-wan.py Outdated Show resolved Hide resolved
psh/tools/netset.py Outdated Show resolved Hide resolved
psh/tools/netset.py Outdated Show resolved Hide resolved
psh/tools/netset.py Outdated Show resolved Hide resolved
@maska989 maska989 force-pushed the maska989/ping_test branch 3 times, most recently from d75cf35 to 2dc6ef3 Compare February 19, 2024 11:22
port: Optional[str] = "/dev/ttyUSB0",
host_ip: Optional[str] = "10.0.0.1",
target_ip: Optional[str] = "10.0.0.2",
interface_idle_time: Optional[int] = "10",
Copy link
Member

Choose a reason for hiding this comment

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

Parameter is declared as an Optional[int] but has a default value of type str

Suggested change
interface_idle_time: Optional[int] = "10",
interface_idle_time: Optional[int] = 10,

Comment on lines +148 to +149
time.sleep(0.01)
asleep += 0.01
Copy link
Member

Choose a reason for hiding this comment

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

inefficient timeout ? Is it worth invoking ifconfig every 0.01 second?

Comment on lines +45 to +46
host_setup = inet + netmask
return host_setup
Copy link
Member

Choose a reason for hiding this comment

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

maybe, but do whatever you think is more readable

Suggested change
host_setup = inet + netmask
return host_setup
return inet + netmask

IP_LOOPBACK = "127.0.0.1"


def ping_output_regex(target, iteration, possible_fail: Optional[bool] = False):
Copy link
Member

Choose a reason for hiding this comment

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

Is Optional needed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants