Merge branch 'tr/gcov'
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 20:47:01 +0000 (13:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 20:47:01 +0000 (13:47 -0700)
* 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

1  2 
Makefile
t/t4013-diff-various.sh
t/t4202-log.sh
diff --combined Makefile
index 0675c43e73813800d616c3971a450157da707269,c32881b00b8d125cbfd7690c9cb183160f9a8a54..1087884be691ed2e9a59dd6289b809496538bf8e
+++ 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 9c709022efb1b553ef53b3100d39e852117cbeda,0f359ca28e4baa085afec5dbedd0bedf86e7bfbe..9cd5a6e68563aede0e69270421b56d1904c34165
@@@ -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 6d43459dd1639e45b532f8b58b3e189a573a6fb0,93966f78f887d31afab2266fb9f01aee497bbf9c..b98619035c58d1b5c617c6e9998e7ae07ab3f27f
@@@ -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 <<EOF
+ * Second
+ * sixth
+ * fifth
+ * fourth
+ * third
+ * second
+ * initial
+ EOF
+ test_expect_success 'simple log --graph' '
+       git log --graph --pretty=tformat:%s >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 <author@example.com>
+ | |
+ | |     Merge branch 'side'
+ | |
+ | * commit side
+ | | Author: A U Thor <author@example.com>
+ | |
+ | |     side-2
+ | |
+ | * commit tags/side-1
+ | | Author: A U Thor <author@example.com>
+ | |
+ | |     side-1
+ | |
+ * | commit master~1
+ | | Author: A U Thor <author@example.com>
+ | |
+ | |     Second
+ | |
+ * | commit master~2
+ | | Author: A U Thor <author@example.com>
+ | |
+ | |     sixth
+ | |
+ * | commit master~3
+ | | Author: A U Thor <author@example.com>
+ | |
+ | |     fifth
+ | |
+ * | commit master~4
+ |/  Author: A U Thor <author@example.com>
+ |
+ |       fourth
+ |
+ * commit tags/side-1~1
+ | Author: A U Thor <author@example.com>
+ |
+ |     third
+ |
+ * commit tags/side-1~2
+ | Author: A U Thor <author@example.com>
+ |
+ |     second
+ |
+ * commit tags/side-1~3
+   Author: A U Thor <author@example.com>
+       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