Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #11507

Closed (moved)
(moved)
Open
Created Apr 14, 2014 by Trac@tracbot

New tests for status.c

In order to increase test coverage for Tor, it would be advantageous to have some mechanism to decrease the friction involved in the mocking process a little bit. A number of macros are introduced for this purpose, and a new test suite is added that uses them to test status.c (as a bit of a proof-of-concept) that gives 100% coverage.

The idea is to think of each test being executed in its own sub-namespace. Normally, we would create these sub-namespaces by appending the module and test names to our mock functions; the attached patch introduces macros to make this simpler. These macros will also declare variables in the current test namespace that can be used to track (manually) how many times a given mock was called. Finally, macros are introduced to make the declaration of the struct testcase_t array simpler.

Some further refinements could be made (eg., having a nicer way to set up and tear down a test fixture), but this should prove a good starting point. The disadvantage of executing tests like this in their own namespace is some mocks will need to be duplicated if they are shared amongst different test cases, but it is more ideal for tests to not have dependencies on other test setups so that failures can be easily isolated.

Trac:
Username: _x3j11

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking