#25947: Create unit test for dirserv_read_measured_bandwidths --------------------------+------------------------------------ Reporter: juga | Owner: juga Type: enhancement | Status: needs_revision Priority: Medium | Milestone: Tor: 0.3.4.x-final Component: Core Tor/Tor | Version: Severity: Normal | Resolution: Keywords: bwauth, test | Actual Points: Parent ID: #25925 | Points: Reviewer: asn | Sponsor: --------------------------+------------------------------------ Changes (by asn):
* status: needs_review => needs_revision Comment: Second round of review (first one was over IRC): - There is at least one more memleak in the unittests. Example: {{{ + tor_asprintf(&content, "%ld\n%s%s", timestamp, v110_header_lines, + sbws_relay_lines); + write_str_to_file(fname, content, 0); + log_debug(LD_DIRSERV, "Bandwidth list file with additional headers and " + "sbws RelayLine."); + tt_int_op(0, OP_EQ, dirserv_read_measured_bandwidths(fname, NULL)); + + done: + teardown_capture_of_logs(); +} }}} Please use ASAN or valgrind to ensure that all memleaks are fixed. Check out `doc/HACKING/HelpfulTools.md` on how to use valgrind. - Commit `2e8c0b9054` adds `header_ended` argument to `measured_bw_line_parse()` but does not document what it does in the function doc. Also the name `header_ended` is a bit weird, what does it mean? - It's also not entirely clear what `header_ended` is supposed to do in `dirserv_read_measured_bandwidths()`. Why do we change it to 1? Perhaps a comment would be helpful. - There is trailing whitespace around the new code. Please use `make check-spaces` to fix that. It must be clean before merging. - I think the changelog entries are too detailed and also too vague at the same time. Example of vagueness: {{{ + o Minor feature (unit tests): + - Test that incomplete lines only give warnings when the end of the header + has not been detected }}} Incomplete lines of what? There is no mention of bwauths in the changes entry. IMO, we should just add a single entry under `Minor feature (unit tests):` that says `Improve bandwidth measurement unittests` and that should be enough. Anyone who cares about the specific unittests, can just look at the commit themselves. -- Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25947#comment:14> Tor Bug Tracker & Wiki <https://trac.torproject.org/> The Tor Project: anonymity online
_______________________________________________ tor-bugs mailing list tor-bugs@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs