Re: Git Test Coverage Report (Monday, Oct 15)

2018-10-15 Thread Derrick Stolee

On 10/15/2018 12:24 PM, Derrick Stolee wrote:


Uncovered code in 'jch' (22f2f0f) and not in 'next' (152ad8e)
-

prio-queue.c
2d181390f3 94) return queue->array[queue->nr - 1].data;

(I have a fix to cover this in my private branch for this topic.)



revision.c
4943d28849 2931) return;
4943d28849 2934) return;
4943d28849 2937) c->object.flags |= UNINTERESTING;
4943d28849 2940) return;
4943d28849 2943) mark_parents_uninteresting(c);
4943d28849 2966) return;
4943d28849 2969) return;
4943d28849 2974) return;
4943d28849 3022) init_author_date_slab(>author_date);
4943d28849 3023) info->topo_queue.compare = 
compare_commits_by_author_date;

4943d28849 3024) info->topo_queue.cb_data = >author_date;
4943d28849 3025) break;
4943d28849 3038) continue;
4943d28849 3048) record_author_date(>author_date, c);
6c04ff3001 3086) if (!revs->ignore_missing_links)
6c04ff3001 3087) die("Failed to traverse parents of commit %s",
4943d28849 3088) oid_to_hex(>object.oid));
4943d28849 3096) continue;
Looks like a number of these lines are important to cover, but are not 
covered by tests that _also_ specify '--topo-order'. I bet I can cover 
more of these by overriding the sort logic to use the new algorithm if 
GIT_TEST_COMMIT_GRAPH is specified. Or, should I create yet another test 
variable to cover these cases?


(Note: I run these coverage reports with a variety of optional test 
variables.)



Uncovered code in 'next' (152ad8e) and not in 'master' (5a0cc8a)

builtin/rev-list.c
7c0fe330d5 builtin/rev-list.c 227) die("unexpected missing %s object 
'%s'",
7c0fe330d5 builtin/rev-list.c 228) type_name(obj->type), 
oid_to_hex(>oid));


commit-graph.c
5cef295f28   67) return 0;
20fd6d5799   79) return 0;
These are two ways to say the commit-graph should not be used, but are 
not covered by tests currently. One is if we say "is the repo shallow?" 
which happens to return when the repo has grafts (but we keep the check 
here in case the way shallows are implemented changes) and the other is 
if the repo is not initialized, but I fixed the test-helpers that had 
not initialized the repo yet.


Uncovered code in 'master' (5a0cc8a) and not in (fe8321ec05)
-
builtin/fsck.c
66ec0390e7 builtin/fsck.c 862) midx_argv[2] = "--object-dir";
66ec0390e7 builtin/fsck.c 863) midx_argv[3] = alt->path;
66ec0390e7 builtin/fsck.c 864) if (run_command(_verify))
66ec0390e7 builtin/fsck.c 865) errors_found |= ERROR_COMMIT_GRAPH;
These are underneath the "for all alternates" loop, and _should_ be 
covered with the coming GIT_TEST_MULTI_PACK_INDEX test variable.


Thanks,
-Stolee


Git Test Coverage Report (Monday, Oct 15)

2018-10-15 Thread Derrick Stolee
In an effort to ensure new code is reasonably covered by the test suite, 
we now have contrib/coverage-diff.sh to combine the gcov output from 
'make coverage-test ; make coverage-report' with the output from 'git 
diff A B' to discover _new_ lines of code that are not covered. This 
report ignores lines including "BUG(".


This report takes the output of these results after running on four 
branches:


        pu: 78bfaf7bc1efe6892fe4dbedf9ed80f9dd48146c

       jch: d67e018e0f57ebbb4fa0354a58a0a6d47e25a948

      next: 152ad8e3369ac77026886a2910e3a407c281df35

    master: 5a0cc8aca797dbd7d2be3b67458ff880ed45cddf

 maint: 04861070400d3ca9d487bd0d736ca818b9ffe371

I ran the test suite on each of these branches on an Ubuntu Linux VM, 
and I'm missing some dependencies (like apache, svn, and perforce) so 
not all tests are run.


I submit this output without comment. I'm taking a look especially at my 
own lines to see where coverage can be improved.


Thanks,

-Stolee

Uncovered code in 'pu' (12227c8) and not in 'jch' (22f2f0f)
---
builtin/blame.c
74e8221b52 builtin/blame.c    924) blame_date_width = sizeof("Thu Oct 19 
16:00");

74e8221b52 builtin/blame.c    925) break;

builtin/branch.c
ba8ba9df26 builtin/branch.c 452) die(_("could not resolve HEAD"));
ba8ba9df26 builtin/branch.c 458) die(_("HEAD (%s) points outside of 
refs/heads/"), refname);


builtin/grep.c
a8ace17bd4 builtin/grep.c  439) grep_read_unlock();

builtin/help.c
e6e76baaf4 builtin/help.c 429) if (!exclude_guides || alias[0] == '!') {
e6e76baaf4 builtin/help.c 430) printf_ln(_("'%s' is aliased to '%s'"), 
cmd, alias);

e6e76baaf4 builtin/help.c 431) free(alias);
e6e76baaf4 builtin/help.c 432) exit(0);
e6e76baaf4 builtin/help.c 441) fprintf_ln(stderr, _("'%s' is aliased to 
'%s'"), cmd, alias);

e6e76baaf4 builtin/help.c 442) count = split_cmdline(alias, );
e6e76baaf4 builtin/help.c 443) if (count < 0)
e6e76baaf4 builtin/help.c 444) die(_("bad alias.%s string: %s"), cmd,
e6e76baaf4 builtin/help.c 446) free(argv);
e6e76baaf4 builtin/help.c 448) return alias;

builtin/rebase--interactive.c
6424061be4 builtin/rebase--interactive.c   23) return 
error_errno(_("could not read '%s'."), todo_file);
6424061be4 builtin/rebase--interactive.c   28) return 
error_errno(_("could not write '%s'"), todo_file);
7ccfac40bc builtin/rebase--interactive.c   43) return 
error_errno(_("could not read '%s'."), todo_file);
7ccfac40bc builtin/rebase--interactive.c   46) 
todo_list_release(_list);
7ccfac40bc builtin/rebase--interactive.c   47) return error(_("unusable 
todo list: '%s'"), todo_file);
9787d17d40 builtin/rebase--interactive.c  294) ret = 
rearrange_squash_in_todo_file();


date.c
74e8221b52  113) die("Timestamp too large for this system: %"PRItime, time);
74e8221b52  216) if (tm->tm_mon == human_tm->tm_mon) {
74e8221b52  217) if (tm->tm_mday > human_tm->tm_mday) {
74e8221b52  219) } else if (tm->tm_mday == human_tm->tm_mday) {
74e8221b52  220) hide.date = hide.wday = 1;
74e8221b52  221) } else if (tm->tm_mday + 5 > human_tm->tm_mday) {
74e8221b52  223) hide.date = 1;
74e8221b52  231) gettimeofday(, NULL);
74e8221b52  232) show_date_relative(time, tz, , buf);
74e8221b52  233) return;
74e8221b52  246) hide.seconds = 1;
74e8221b52  247) hide.tz |= !hide.date;
74e8221b52  248) hide.wday = hide.time = !hide.year;
74e8221b52  262) strbuf_rtrim(buf);
74e8221b52  287) gettimeofday(, NULL);
74e8221b52  290) human_tz = local_time_tzoffset(now.tv_sec, _tm);
74e8221b52  886) static int auto_date_style(void)
74e8221b52  888) return (isatty(1) || pager_in_use()) ? DATE_HUMAN : 
DATE_NORMAL;

74e8221b52  909) return DATE_HUMAN;
74e8221b52  911) return auto_date_style();

git.c
a9a60b94cc 322) fprintf_ln(stderr, _("'%s' is aliased to '%s'"),

rebase-interactive.c
b74a37a5a7  26) warning(_("unrecognized setting %s for option "
6424061be4 107) return error_errno(_("could not write '%s''"), todo_file);
6424061be4 110) return error(_("could not copy '%s' to '%s'."), todo_file,
b74a37a5a7 174) goto leave_check;

sequencer.c
b5d6062402 4425) strbuf_insert(buf, todo_list->items[insert].offset_in_buf +
b5d6062402 4437) int sequencer_add_exec_commands(const char *commands)
06d8136126 ) return error_errno(_("could not read '%s'."), todo_file);
b5d6062402 4446) if (todo_list_parse_insn_buffer(todo_list.buf.buf, 
_list)) {

b5d6062402 4451) todo_list_add_exec_commands(_list, commands);
b5d6062402 4452) res = write_message(todo_list.buf.buf, 
todo_list.buf.len, todo_file, 0);

0cce4a2756 4453) todo_list_release(_list);
b5d6062402 4455) return res;
b74a37a5a7 4515) goto out;
b74a37a5a7 4520) goto out;
b8dac44d10 4660) todo_list_release(_todo);
009173ed7b 4665) todo_list_release(_todo);
009173ed7b 4666) return error_errno(_("could not write '%s'"), todo_file);
9787d17d40 4859) int rearrange_squash_in_todo_file(void)
9787d17d40 4861) const char *todo_file = rebase_path_todo();
9787d17d40 4862) struct todo_list todo_list