Skip to content

Cleanup and simplify unit tests#336

Closed
yadij wants to merge 20 commits intosquid-cache:masterfrom
yadij:cleanup-unit-tests
Closed

Cleanup and simplify unit tests#336
yadij wants to merge 20 commits intosquid-cache:masterfrom
yadij:cleanup-unit-tests

Conversation

@yadij
Copy link
Contributor

@yadij yadij commented Nov 27, 2018

Polish unit tests to reduce their dependency lists inline with
the updated test documentation requirements.

Some further cleanup of unit tests documentation based on
experience pruning existing unit tests.

  • Only the test logic files actually need to be distributed by
    a test. All files being tested are supposed to be distributed
    from elsewhere and the test should rely on that to prevent
    future issues like the base/RefCount.h bug mentioned below.

  • Starting to deprecate TESTSOURCES which is causing more
    trouble than benefit by pulling in too many needless
    dependencies. eg the globals.cc objects and symbols. Tools it
    used to provide are largely superseded by the stub mechanisms.

Add missing stub files necessary for pruning dependencies. Also
fix some bugs in existing stub files.

Fix base/RefCount.h distribution. This file was not included in
the base/libbase.la dependency list but indirectly being
distributed by the unit-test existence. Which in some builds
could cause it not to exist in generated minimal tarballs.

@yadij yadij force-pushed the cleanup-unit-tests branch from aaab83d to a3d36fb Compare December 27, 2018 04:42
@rousskov rousskov added the S-waiting-for-committer privileged action is expected (and usually required) label Jan 6, 2019
@yadij yadij force-pushed the cleanup-unit-tests branch from a3d36fb to 4a30553 Compare January 7, 2019 17:20
yadij added 20 commits January 14, 2019 22:35
It does not actually need anything in TESTSOURCES and
libbase is not built until after libmem so having a
test dependency did not make sense.
This test does not need anything from TESTSOURCES. Removing that
also removes the need for stubs.
This test does not need anything from TESTSOURCES. Removing that
also removes the need for stubs.

Also, since this is a template file we do not even need libbase
linked to test its functionality.
This test does not need anything from TESTSOURCES. Removing that
also removes the need for several stubs.

TODO:
 - Make LookupTable able to be used with other types than SBuf.
   eg. std::string would simplify the tests further and avoid
   SBuf bugs from impacting this unit test.
* as a template it does not need libbase to be linked.
  This also removes the need for several stub files.

* fix RefCount.h header not distributed properly by base/Makefile.
This was exposed by use of nodist_ in the unit test.
* add stub files for HttpHeader.cc and http/libhttp.la
Symbols defined in store/libstore.la should be defined
in a library specific stub rather than spread through
other stub files related to store classes and files.

stub_store.cc is for objects in the src/store.cc file.
Some removal policy symbols are still incorrectly stub'ed
there. For now just extracting the libstore.la symbols.

Fixes the mis-naming of stub_SwapDir for Store::Disk
symbols. SwapDir is a typedef alias not a class or
filename.
@yadij yadij force-pushed the cleanup-unit-tests branch from 4a30553 to 2146d95 Compare January 14, 2019 09:35
@yadij
Copy link
Contributor Author

yadij commented Jan 17, 2019

Removing the WIP, this can be applied without completing all test pruning. Most of the remaining pruning is blocked by storeAppend*() API dependency - for which PR #143 was the optimal fix.

@rousskov
Copy link
Contributor

Removing the WIP

FYI: The WIP prefix is still in this PR title.

@yadij yadij changed the title WIP: Cleanup and simplify unit tests Cleanup and simplify unit tests Jan 17, 2019
@yadij
Copy link
Contributor Author

yadij commented Jan 23, 2019

@rousskov Do you wish to review any of this? or shall I clear Anubis to proceed?

Copy link
Contributor

@kinkie kinkie left a comment

Choose a reason for hiding this comment

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

As testing works and documentation is update, LGTM

@rousskov
Copy link
Contributor

Do you wish to review any of this?

No, I do not. I would not have added an S-waiting-for-committer label if I wanted to review this PR.

@yadij yadij added M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels and removed S-waiting-for-committer privileged action is expected (and usually required) labels Jan 25, 2019
squid-anubis pushed a commit that referenced this pull request Jan 25, 2019
Polish unit tests to reduce their dependency lists inline with
the updated test documentation requirements.

Some further cleanup of unit tests documentation based on
experience pruning existing unit tests.

 * Only the test logic files actually need to be distributed by
   a test. All files being tested are supposed to be distributed
   from elsewhere and the test should rely on that to prevent
   future issues like the base/RefCount.h bug mentioned below.

 * Starting to deprecate TESTSOURCES which is causing more
   trouble than benefit by pulling in too many needless
   dependencies. eg the globals.cc objects and symbols. Tools it
   used to provide are largely superseded by the stub mechanisms.

Add missing stub files necessary for pruning dependencies. Also
fix some bugs in existing stub files.

Fix base/RefCount.h distribution. This file was not included in
the base/libbase.la dependency list but indirectly being
distributed by the unit-test existence. Which in some builds
could cause it not to exist in generated minimal tarballs.
@squid-anubis squid-anubis added M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels M-merged https://github.com/measurement-factory/anubis#pull-request-labels and removed M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels labels Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-merged https://github.com/measurement-factory/anubis#pull-request-labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants