[tor-bugs] #26008 [Core Tor/Tor]: Make workqueue cancel code always get covered by tests.

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed May 2 20:11:49 UTC 2018


#26008: Make workqueue cancel code always get covered by tests.
-------------------------+-------------------------------------------------
     Reporter:  nickm    |      Owner:  (none)
         Type:  defect   |     Status:  new
     Priority:  Medium   |  Milestone:  Tor: 0.3.5.x-final
    Component:  Core     |    Version:
  Tor/Tor                |   Keywords:  tor-ci, tor-tests-coverage, tor-
     Severity:  Normal   |  tests-unit
Actual Points:           |  Parent ID:  #25908
       Points:           |   Reviewer:
      Sponsor:           |
-------------------------+-------------------------------------------------
 After re-running the tests many times with the other #25908 children
 fixed, I found a remaining variance from the most usual test coverage.
 This case happened only once out of ~450 runs:
 {{{
 --- coverage-1525271181/workqueue.c.gcov.tmp    2018-05-02
 15:59:24.758433136 -0400
 +++ coverage-1525271827/workqueue.c.gcov.tmp    2018-05-02
 15:59:24.760433142 -0400
 @@ -198,14 +198,14 @@
          1:  tor_mutex_acquire(&ent->on_pool->lock);
          1:  workqueue_priority_t prio = ent->priority;
          1:  if (ent->pending) {
 -        1:    TOR_TAILQ_REMOVE(&ent->on_pool->work[prio], ent,
 next_work);
 -        1:    cancelled = 1;
 -        1:    result = ent->arg;
 +    #####:    TOR_TAILQ_REMOVE(&ent->on_pool->work[prio], ent,
 next_work);
 +    #####:    cancelled = 1;
 +    #####:    result = ent->arg;
          -:  }
          1:  tor_mutex_release(&ent->on_pool->lock);
          -:
          1:  if (cancelled) {
 -        1:    workqueue_entry_free(ent);
 +    #####:    workqueue_entry_free(ent);
          -:  }
          1:  return result;
          -:}
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/26008>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list