[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #15236 [Tor]: Identify functions most in need of testing, and hardest to test
#15236: Identify functions most in need of testing, and hardest to test
------------------------+--------------------------------
Reporter: nickm | Owner:
Type: task | Status: new
Priority: normal | Milestone: Tor: 0.2.7.x-final
Component: Tor | Version:
Resolution: | Keywords: SponsorS
Actual Points: | Parent ID:
Points: |
------------------------+--------------------------------
Comment (by nickm):
I have a script that looks for functions with certain properties using
`git-blame`. It can count:
* Lines
* Number of distinct months of commits
* Number of distinct commits
* Number of distinct commits with the string "bug" in them
Get the branch `findvolatile` from my public repository and play around
with it. It's a bit addictive. Edit the 'badness' function. Sort the
results on different columns. Omit the "scariness" calculation if you
aren't using it; it's slow!
I pregenerated some git-blame output with `touch blame_all; for fn in
src/common/*.c src/or/*.c src/tools/*.c src/tools/*/*.c ; do echo $fn;;
git blame -wMC $fn >> blame_all; done`, and I've been piping it to lots of
variants of this.
So far, the different ways to calculate are pretty samey, and give similar
results. Big functions appear extra-high on the list. But there are ones
that are "bad for their size" that get ranked a little higher than others.
Top-10 longest functions (all lists by ascending badness):
{{{
circuit_expire_building
parse_port_config
run_scheduled_events
connection_ap_handshake_rewrite_and_attach
options_act
networkstatus_parse_vote_from_string
connection_dir_client_reached_eof
directory_handle_command_get
networkstatus_compute_consensus
options_validate
}}}
Top-10 most scary functions (commits plus "bug" in log messages):
{{{
networkstatus_compute_consensus
init_keys
connection_edge_process_relay_cell
connection_ap_handshake_rewrite_and_attach
router_rebuild_descriptor
directory_handle_command_get
connection_dir_client_reached_eof
run_scheduled_events
options_act
options_validate
}}}
Top 10 most modified functions (number of distinct commits):
{{{
circuit_expire_building
parse_port_config
run_scheduled_events
connection_ap_handshake_rewrite_and_attach
options_act
networkstatus_parse_vote_from_string
connection_dir_client_reached_eof
directory_handle_command_get
networkstatus_compute_consensus
options_validate
}}}
Top 10 most high-scoring functions (sqrt(scariness times distinct months)
divided by lines.):
{{{
router_dump_router_to_string
connection_dir_client_reached_eof
router_add_to_routerlist
init_keys
connection_exit_begin_conn
connection_handle_write_impl
router_rebuild_descriptor
options_validate
options_act
run_scheduled_events
}}}
And now for something completely different: as above, but somewhat de-
weighted for length:
{{{
consider_testing_reachability
connection_connect_sockaddr
connection_close_immediate
add_callback_log
tor_free_all
router_rebuild_descriptor
add_stream_log_impl
run_scheduled_events
connection_edge_destroy
directory_info_has_arrived
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/15236#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs