Page MenuHomeFreeBSD

test/libalias: Tests instantiation
ClosedPublic

Authored by donner on May 16 2021, 9:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 5:56 PM
Unknown Object (File)
Wed, Oct 30, 6:05 PM
Unknown Object (File)
Wed, Oct 30, 9:12 AM
Unknown Object (File)
Tue, Oct 29, 9:45 PM
Unknown Object (File)
Tue, Oct 29, 3:39 PM
Unknown Object (File)
Sun, Oct 27, 1:56 PM
Unknown Object (File)
Sun, Oct 27, 1:13 AM
Unknown Object (File)
Wed, Oct 23, 2:29 PM

Details

Summary

In order to modify libalias for performance, the existing functionality must not change.

This review is only a starter of the larger set of functional tests which needs to be upheld during the upcoming development. More test cases will come in further reviews.

I'll keep the review small enough to be readable by an external person and hence the commits small enough to not disturb the developer community.

Test Plan
$ make test
1_instance:1_singleinit  ->  passed  [0.003s]
1_instance:2_destroynull  ->  expected_failure: Code expects valid pointer.  [0.013s]
1_instance:3_multiinit  ->  passed  [0.005s]
1_instance:4_multiinstance  ->  passed  [0.038s]
4/4 passed (0 failed)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 39240
Build 36129: arc lint + arc unit

Event Timeline

Start as simple as possible and fail ...

[/usr/tests/sys/netinet/libalias]$ kyua list
aliasdb_test:__test_cases_list__

But calling directly works:

$ /usr/tests/sys/netinet/libalias/aliasdb_test -l
Content-Type: application/X-atf-tp; version="1"

ident: init
has.cleanup: true
desc: Create an instance

and

$ /usr/tests/sys/netinet/libalias/aliasdb_test init
aliasdb_test: WARNING: Running test cases outside of kyua(1) is unsupported
aliasdb_test: WARNING: No isolation nor timeout control is being applied; you may get unexpected failures; see atf-test-case(4)
(null)
(null)
(null)
(null)
(null)
(null)
passed

Ah, btw: Is there a possibilty to run it as a user without installing it?

  • Remove unnecessary static

Ah, kyua report shows:

aliasdb_test:__test_cases_list__  ->  broken: Unknown test case metadata property 'desc'  [0.001s]
  • Fix meta data. => Now it works.
  • Add test to recreate an instance multiple time.
  • Test to create many instances and remove them in random order.
  • Add a test for a known API violation.
  • Make the tests work directly on the intermediate builds.

I think you're also missing a makefile hookup somewhere. These tests may want to live in /usr/src/tests/sys/netinet/libalias instead, but I don't hold strong views on that.

sys/netinet/libalias/tests/Makefile
15

That probably wants ${.OBJDIR}

sys/netinet/libalias/tests/aliasdb_test.c
9

I wonder if it's worth printing the random seed somewhere, or even using a fixed seed. If this triggers a bug it may end up being nondeterministic (and thus difficult to debug).

  • Use OBJDIR
  • Make random reproducable.
  • Inspect kyua reports
donner marked an inline comment as done.
  • Replace preprocessor constants by compiler generated values.
  • Renumber the test cases and rename the file according to scope
donner retitled this revision from libalias: Create a test suite to libalias: Initial test suite.May 17 2021, 6:45 PM
donner edited the summary of this revision. (Show Details)
donner edited the test plan for this revision. (Show Details)
donner added a reviewer: kp.
In D30307#680794, @kp wrote:

I think you're also missing a makefile hookup somewhere. These tests may want to live in /usr/src/tests/sys/netinet/libalias instead, but I don't hold strong views on that.

libalias is primary sourced in sys/netinet/libalias. The userspace variant is symlinked into lib/libalias.
That's why I'd keep the tests at the real source.

Any objections?

Any objections?

No, my views on the subject are very weak. I would like to see this test hooked into the build system though, so it gets built and installed as part of build/install world.

  • Move location of test dir and update build procedure
donner retitled this revision from libalias: Initial test suite to test/libalias: Tests instantiation.May 18 2021, 2:55 PM
donner edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.May 18 2021, 7:32 PM
This revision was automatically updated to reflect the committed changes.