From: Junio C Hamano Date: Wed, 11 Mar 2009 20:47:01 +0000 (-0700) Subject: Merge branch 'tr/gcov' X-Git-Tag: v1.6.3-rc0~176 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e785dadc90df20e1038c053dc168a6458b1e672b?ds=inline;hp=-c Merge branch 'tr/gcov' * tr/gcov: Test git-patch-id Test rev-list --parents/--children Test log --decorate Test fsck a bit harder Test log --graph Test diff --dirstat functionality Test that diff can read from stdin Support coverage testing with GCC/gcov --- e785dadc90df20e1038c053dc168a6458b1e672b diff --combined Makefile index 0675c43e73,c32881b00b..1087884be6 --- a/Makefile +++ b/Makefile @@@ -1468,8 -1468,8 +1468,8 @@@ endi bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \ execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \ { $(RM) "$$execdir/git-add$X" && \ - ln git-add$X "$$execdir/git-add$X" 2>/dev/null || \ - cp git-add$X "$$execdir/git-add$X"; } && \ + ln "$$bindir/git$X" "$$execdir/git-add$X" 2>/dev/null || \ + cp "$$bindir/git$X" "$$execdir/git-add$X"; } && \ { for p in $(filter-out git-add$X,$(BUILT_INS)); do \ $(RM) "$$execdir/$$p" && \ ln "$$execdir/git-add$X" "$$execdir/$$p" 2>/dev/null || \ @@@ -1640,3 -1640,27 +1640,27 @@@ check-docs: check-builtins:: ./check-builtins.sh + ### Test suite coverage testing + # + .PHONY: coverage coverage-clean coverage-build coverage-report + + coverage: + $(MAKE) coverage-build + $(MAKE) coverage-report + + coverage-clean: + rm -f *.gcda *.gcno + + COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs + COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov + + coverage-build: coverage-clean + $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all + $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \ + -j1 test + + coverage-report: + gcov -b *.c + grep '^function.*called 0 ' *.c.gcov \ + | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \ + | tee coverage-untested-functions diff --combined t/t4013-diff-various.sh index 9c709022ef,0f359ca28e..9cd5a6e685 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@@ -74,10 -74,6 +74,10 @@@ test_expect_success setup for i in 1 2; do echo $i; done >>dir/sub && git update-index file0 dir/sub && + mkdir dir3 && + cp dir/sub dir3/sub && + test-chmtime +1 dir3/sub && + git config log.showroot false && git commit --amend && git show-branch @@@ -207,6 -203,10 +207,10 @@@ log --root -c --patch-with-stat --summa log --root --cc --patch-with-stat --summary master log -SF master log -SF -p master + log --decorate --all + + rev-list --parents HEAD + rev-list --children HEAD whatchanged master whatchanged -p master @@@ -266,8 -266,8 +270,9 @@@ diff --patch-with-raw -r initial..sid diff --name-status dir2 dir diff --no-index --name-status dir2 dir diff --no-index --name-status -- dir2 dir +diff --no-index dir dir3 diff master master^ side + diff --dirstat master~1 master~2 EOF test_done diff --combined t/t4202-log.sh index 6d43459dd1,93966f78f8..b98619035c --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@@ -37,46 -37,6 +37,46 @@@ test_expect_success setup ' +printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect +test_expect_success 'pretty' ' + + git log --pretty="format:%s" > actual && + test_cmp expect actual +' + +printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect +test_expect_success 'pretty (tformat)' ' + + git log --pretty="tformat:%s" > actual && + test_cmp expect actual +' + +test_expect_success 'pretty (shortcut)' ' + + git log --pretty="%s" > actual && + test_cmp expect actual +' + +test_expect_success 'format' ' + + git log --format="%s" > actual && + test_cmp expect actual +' + +cat > expect << EOF +804a787 sixth +394ef78 fifth +5d31159 fourth +2fbe8c0 third +f7dab8e second +3a2fdcb initial +EOF +test_expect_success 'oneline' ' + + git log --oneline > actual && + test_cmp expect actual +' + test_expect_success 'diff-filter=A' ' actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) && @@@ -174,5 -134,153 +174,153 @@@ test_expect_success 'log --grep -i' test_cmp expect actual ' + cat > expect <actual && + test_cmp expect actual + ' + + test_expect_success 'set up merge history' ' + git checkout -b side HEAD~4 && + test_commit side-1 1 1 && + test_commit side-2 2 2 && + git checkout master && + git merge side + ' + + cat > expect <<\EOF + * Merge branch 'side' + |\ + | * side-2 + | * side-1 + * | Second + * | sixth + * | fifth + * | fourth + |/ + * third + * second + * initial + EOF + + test_expect_success 'log --graph with merge' ' + git log --graph --date-order --pretty=tformat:%s | + sed "s/ *$//" >actual && + test_cmp expect actual + ' + + cat > expect <<\EOF + * commit master + |\ Merge: A B + | | Author: A U Thor + | | + | | Merge branch 'side' + | | + | * commit side + | | Author: A U Thor + | | + | | side-2 + | | + | * commit tags/side-1 + | | Author: A U Thor + | | + | | side-1 + | | + * | commit master~1 + | | Author: A U Thor + | | + | | Second + | | + * | commit master~2 + | | Author: A U Thor + | | + | | sixth + | | + * | commit master~3 + | | Author: A U Thor + | | + | | fifth + | | + * | commit master~4 + |/ Author: A U Thor + | + | fourth + | + * commit tags/side-1~1 + | Author: A U Thor + | + | third + | + * commit tags/side-1~2 + | Author: A U Thor + | + | second + | + * commit tags/side-1~3 + Author: A U Thor + + initial + EOF + + test_expect_success 'log --graph with full output' ' + git log --graph --date-order --pretty=short | + git name-rev --name-only --stdin | + sed "s/Merge:.*/Merge: A B/;s/ *$//" >actual && + test_cmp expect actual + ' + + test_expect_success 'set up more tangled history' ' + git checkout -b tangle HEAD~6 && + test_commit tangle-a tangle-a a && + git merge master~3 && + git merge side~1 && + git checkout master && + git merge tangle + ' + + cat > expect <<\EOF + * Merge branch 'tangle' + |\ + | * Merge branch 'side' (early part) into tangle + | |\ + | * \ Merge branch 'master' (early part) into tangle + | |\ \ + | * | | tangle-a + * | | | Merge branch 'side' + |\ \ \ \ + | * | | | side-2 + | | | |/ + | | |/| + | |/| | + | * | | side-1 + * | | | Second + * | | | sixth + | | |/ + | |/| + |/| | + * | | fifth + * | | fourth + |/ / + * | third + |/ + * second + * initial + EOF + + test_expect_success 'log --graph with merge' ' + git log --graph --date-order --pretty=tformat:%s | + sed "s/ *$//" >actual && + test_cmp expect actual + ' + test_done