Page MenuHomeFreeBSD

routing: Add tests for metric
ClosedPublic

Authored by pouria on May 15 2026, 2:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jun 15, 3:29 AM
Unknown Object (File)
Sun, Jun 14, 4:27 AM
Unknown Object (File)
Mon, Jun 8, 6:03 PM
Unknown Object (File)
Mon, Jun 8, 8:07 AM
Unknown Object (File)
Thu, Jun 4, 4:11 PM
Unknown Object (File)
Thu, Jun 4, 4:11 PM
Unknown Object (File)
Thu, Jun 4, 5:21 AM
Unknown Object (File)
Wed, Jun 3, 3:41 PM
Subscribers

Details

Summary

Add tests to make sure:

  • Default metric is enforced.
  • Lowest metric wins.
  • Deleting routes by specifying gateway/metric works.

Depends on D57011

Test Plan
# kyua test -k /usr/tests/Kyuafile sys/net/routing/test_routing
sys/net/routing/test_routing:add_default_metric  ->  passed  [0.084s]
sys/net/routing/test_routing:add_lowest_metric  ->  passed  [0.111s]
sys/net/routing/test_routing:delete_route_with_metric  ->  passed  [0.174s]

Results file id is usr_tests.20260515-140531-295066
Results saved to /root/.kyua/store/results.usr_tests.20260515-140531-295066.db

3/3 passed (0 broken, 0 failed, 0 skipped)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

All of these tests create a single jail and operate on it. But we could instead use execenv=jail and get kyua to create the VNET jail for us. Then:

  • the tests would be simpler,
  • the tests can be run in parallel.
tests/sys/net/routing/test_routing.sh
2

I was told not to add this line, the makefiles will do that automatically.

37

This needs to be set in all of the test cases.

55

You only use the prefix variable here, so it'd be clearer to just define laddr="3fff::1" and use that here.

79

maybe? Or go further and validate the error message.

106

Same comment about prefix.

121
124

This is verifying the weight too, right?

136
pouria marked 7 inline comments as done.

Remove mkjail for each test and add execenv=jail to Makefile.
Address @markj comments.

This revision is now accepted and ready to land.May 19 2026, 1:45 PM
This revision was landed with ongoing or failed builds.Wed, May 20, 8:59 PM
This revision was automatically updated to reflect the committed changes.

It seems the main goal here was not about parallelism, so maybe it's not so important, but I just wanted to mention that the newly added test cases are still marked as exclusive as the Makefile makes it so for all of them:

# cat /usr/tests/sys/net/routing/Kyuafile
-- Automatically generated by bsd.test.mk.

syntax(2)

test_suite("FreeBSD")

atf_test_program{name="test_routing", is_exclusive=true, execenv="jail", execenv_jail_params="vnet"}
atf_test_program{name="test_routing_l3.py", is_exclusive=true, required_programs="pytest"}
atf_test_program{name="test_rtsock_l3", is_exclusive=true}
atf_test_program{name="test_rtsock_lladdr", is_exclusive=true}
atf_test_program{name="test_rtsock_multipath.py", is_exclusive=true, required_programs="pytest"}
atf_test_program{name="test_rtsock_ops", is_exclusive=true}

It seems the main goal here was not about parallelism, so maybe it's not so important, but I just wanted to mention that the newly added test cases are still marked as exclusive as the Makefile makes it so for all of them:

# cat /usr/tests/sys/net/routing/Kyuafile
-- Automatically generated by bsd.test.mk.

syntax(2)

test_suite("FreeBSD")

atf_test_program{name="test_routing", is_exclusive=true, execenv="jail", execenv_jail_params="vnet"}
atf_test_program{name="test_routing_l3.py", is_exclusive=true, required_programs="pytest"}
atf_test_program{name="test_rtsock_l3", is_exclusive=true}
atf_test_program{name="test_rtsock_lladdr", is_exclusive=true}
atf_test_program{name="test_rtsock_multipath.py", is_exclusive=true, required_programs="pytest"}
atf_test_program{name="test_rtsock_ops", is_exclusive=true}

Good catch, I suspect that the is_exclusive annotation can be removed. I will try this.