* [PATCH 1/3] Copy test framework from Git
2010-02-08 15:14 ` Michal Sojka
@ 2010-02-08 15:16 ` Michal Sojka
2010-02-08 15:16 ` [PATCH 2/3] Update test framework for use with notmuch Michal Sojka
` (2 subsequent siblings)
3 siblings, 0 replies; 36+ messages in thread
From: Michal Sojka @ 2010-02-08 15:16 UTC (permalink / raw)
To: notmuch
Git uses a simple and yet powerfull test framework, written in shell.
The framework is easy to use for both users and developers so I thing
it would help if it is used in notmuch as well.
This is a copy of Git's test framework from commit
b8bba419250711a69e09e7648e5c991f4847a127.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
test/Makefile | 46 +++
test/README | 297 +++++++++++++++++
test/aggregate-results.sh | 34 ++
test/t0000-basic.sh | 368 +++++++++++++++++++++
test/test-lib.sh | 787 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 1532 insertions(+), 0 deletions(-)
create mode 100644 test/Makefile
create mode 100644 test/README
create mode 100755 test/aggregate-results.sh
create mode 100755 test/t0000-basic.sh
create mode 100644 test/test-lib.sh
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..bd09390
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,46 @@
+# Run tests
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+-include ../config.mak
+
+#GIT_TEST_OPTS=--verbose --debug
+SHELL_PATH ?= $(SHELL)
+TAR ?= $(TAR)
+RM ?= rm -f
+
+# Shell quote;
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
+T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
+TSVN = $(wildcard t91[0-9][0-9]-*.sh)
+
+all: pre-clean
+ $(MAKE) aggregate-results-and-cleanup
+
+$(T):
+ @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
+
+pre-clean:
+ $(RM) -r test-results
+
+clean:
+ $(RM) -r 'trash directory'.* test-results
+
+aggregate-results-and-cleanup: $(T)
+ $(MAKE) aggregate-results
+ $(MAKE) clean
+
+aggregate-results:
+ '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-*
+
+# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
+full-svn-test:
+ $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
+ $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
+
+valgrind:
+ GIT_TEST_OPTS=--valgrind $(MAKE)
+
+.PHONY: pre-clean $(T) aggregate-results clean valgrind
diff --git a/test/README b/test/README
new file mode 100644
index 0000000..dcd3ebb
--- /dev/null
+++ b/test/README
@@ -0,0 +1,297 @@
+Core GIT Tests
+==============
+
+This directory holds many test scripts for core GIT tools. The
+first part of this short document describes how to run the tests
+and read their output.
+
+When fixing the tools or adding enhancements, you are strongly
+encouraged to add tests in this directory to cover what you are
+trying to fix or enhance. The later part of this short document
+describes how your test scripts should be organized.
+
+
+Running Tests
+-------------
+
+The easiest way to run tests is to say "make". This runs all
+the tests.
+
+ *** t0000-basic.sh ***
+ * ok 1: .git/objects should be empty after git-init in an empty repo.
+ * ok 2: .git/objects should have 256 subdirectories.
+ * ok 3: git-update-index without --add should fail adding.
+ ...
+ * ok 23: no diff after checkout and git-update-index --refresh.
+ * passed all 23 test(s)
+ *** t0100-environment-names.sh ***
+ * ok 1: using old names should issue warnings.
+ * ok 2: using old names but having new names should not issue warnings.
+ ...
+
+Or you can run each test individually from command line, like
+this:
+
+ $ sh ./t3001-ls-files-killed.sh
+ * ok 1: git-update-index --add to add various paths.
+ * ok 2: git-ls-files -k to show killed files.
+ * ok 3: validate git-ls-files -k output.
+ * passed all 3 test(s)
+
+You can pass --verbose (or -v), --debug (or -d), and --immediate
+(or -i) command line argument to the test, or by setting GIT_TEST_OPTS
+appropriately before running "make".
+
+--verbose::
+ This makes the test more verbose. Specifically, the
+ command being run and their output if any are also
+ output.
+
+--debug::
+ This may help the person who is developing a new test.
+ It causes the command defined with test_debug to run.
+
+--immediate::
+ This causes the test to immediately exit upon the first
+ failed test.
+
+--long-tests::
+ This causes additional long-running tests to be run (where
+ available), for more exhaustive testing.
+
+--valgrind::
+ Execute all Git binaries with valgrind and exit with status
+ 126 on errors (just like regular tests, this will only stop
+ the test script when running under -i). Valgrind errors
+ go to stderr, so you might want to pass the -v option, too.
+
+ Since it makes no sense to run the tests with --valgrind and
+ not see any output, this option implies --verbose. For
+ convenience, it also implies --tee.
+
+--tee::
+ In addition to printing the test output to the terminal,
+ write it to files named 't/test-results/$TEST_NAME.out'.
+ As the names depend on the tests' file names, it is safe to
+ run the tests with this option in parallel.
+
+--with-dashes::
+ By default tests are run without dashed forms of
+ commands (like git-commit) in the PATH (it only uses
+ wrappers from ../bin-wrappers). Use this option to include
+ the build directory (..) in the PATH, which contains all
+ the dashed forms of commands. This option is currently
+ implied by other options like --valgrind and
+ GIT_TEST_INSTALLED.
+
+You can also set the GIT_TEST_INSTALLED environment variable to
+the bindir of an existing git installation to test that installation.
+You still need to have built this git sandbox, from which various
+test-* support programs, templates, and perl libraries are used.
+If your installed git is incomplete, it will silently test parts of
+your built version instead.
+
+When using GIT_TEST_INSTALLED, you can also set GIT_TEST_EXEC_PATH to
+override the location of the dashed-form subcommands (what
+GIT_EXEC_PATH would be used for during normal operation).
+GIT_TEST_EXEC_PATH defaults to `$GIT_TEST_INSTALLED/git --exec-path`.
+
+
+Skipping Tests
+--------------
+
+In some environments, certain tests have no way of succeeding
+due to platform limitation, such as lack of 'unzip' program, or
+filesystem that do not allow arbitrary sequence of non-NUL bytes
+as pathnames.
+
+You should be able to say something like
+
+ $ GIT_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh
+
+and even:
+
+ $ GIT_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make
+
+to omit such tests. The value of the environment variable is a
+SP separated list of patterns that tells which tests to skip,
+and either can match the "t[0-9]{4}" part to skip the whole
+test, or t[0-9]{4} followed by ".$number" to say which
+particular test to skip.
+
+Note that some tests in the existing test suite rely on previous
+test item, so you cannot arbitrarily disable one and expect the
+remainder of test to check what the test originally was intended
+to check.
+
+
+Naming Tests
+------------
+
+The test files are named as:
+
+ tNNNN-commandname-details.sh
+
+where N is a decimal digit.
+
+First digit tells the family:
+
+ 0 - the absolute basics and global stuff
+ 1 - the basic commands concerning database
+ 2 - the basic commands concerning the working tree
+ 3 - the other basic commands (e.g. ls-files)
+ 4 - the diff commands
+ 5 - the pull and exporting commands
+ 6 - the revision tree commands (even e.g. merge-base)
+ 7 - the porcelainish commands concerning the working tree
+ 8 - the porcelainish commands concerning forensics
+ 9 - the git tools
+
+Second digit tells the particular command we are testing.
+
+Third digit (optionally) tells the particular switch or group of switches
+we are testing.
+
+If you create files under t/ directory (i.e. here) that is not
+the top-level test script, never name the file to match the above
+pattern. The Makefile here considers all such files as the
+top-level test script and tries to run all of them. A care is
+especially needed if you are creating a common test library
+file, similar to test-lib.sh, because such a library file may
+not be suitable for standalone execution.
+
+
+Writing Tests
+-------------
+
+The test script is written as a shell script. It should start
+with the standard "#!/bin/sh" with copyright notices, and an
+assignment to variable 'test_description', like this:
+
+ #!/bin/sh
+ #
+ # Copyright (c) 2005 Junio C Hamano
+ #
+
+ test_description='xxx test (option --frotz)
+
+ This test registers the following structure in the cache
+ and tries to run git-ls-files with option --frotz.'
+
+
+Source 'test-lib.sh'
+--------------------
+
+After assigning test_description, the test script should source
+test-lib.sh like this:
+
+ . ./test-lib.sh
+
+This test harness library does the following things:
+
+ - If the script is invoked with command line argument --help
+ (or -h), it shows the test_description and exits.
+
+ - Creates an empty test directory with an empty .git/objects
+ database and chdir(2) into it. This directory is 't/trash directory'
+ if you must know, but I do not think you care.
+
+ - Defines standard test helper functions for your scripts to
+ use. These functions are designed to make all scripts behave
+ consistently when command line arguments --verbose (or -v),
+ --debug (or -d), and --immediate (or -i) is given.
+
+
+End with test_done
+------------------
+
+Your script will be a sequence of tests, using helper functions
+from the test harness library. At the end of the script, call
+'test_done'.
+
+
+Test harness library
+--------------------
+
+There are a handful helper functions defined in the test harness
+library for your script to use.
+
+ - test_expect_success <message> <script>
+
+ This takes two strings as parameter, and evaluates the
+ <script>. If it yields success, test is considered
+ successful. <message> should state what it is testing.
+
+ Example:
+
+ test_expect_success \
+ 'git-write-tree should be able to write an empty tree.' \
+ 'tree=$(git-write-tree)'
+
+ - test_expect_failure <message> <script>
+
+ This is NOT the opposite of test_expect_success, but is used
+ to mark a test that demonstrates a known breakage. Unlike
+ the usual test_expect_success tests, which say "ok" on
+ success and "FAIL" on failure, this will say "FIXED" on
+ success and "still broken" on failure. Failures from these
+ tests won't cause -i (immediate) to stop.
+
+ - test_debug <script>
+
+ This takes a single argument, <script>, and evaluates it only
+ when the test script is started with --debug command line
+ argument. This is primarily meant for use during the
+ development of a new test script.
+
+ - test_done
+
+ Your test script must have test_done at the end. Its purpose
+ is to summarize successes and failures in the test script and
+ exit with an appropriate error code.
+
+ - test_tick
+
+ Make commit and tag names consistent by setting the author and
+ committer times to defined stated. Subsequent calls will
+ advance the times by a fixed amount.
+
+ - test_commit <message> [<filename> [<contents>]]
+
+ Creates a commit with the given message, committing the given
+ file with the given contents (default for both is to reuse the
+ message string), and adds a tag (again reusing the message
+ string as name). Calls test_tick to make the SHA-1s
+ reproducible.
+
+ - test_merge <message> <commit-or-tag>
+
+ Merges the given rev using the given message. Like test_commit,
+ creates a tag and calls test_tick before committing.
+
+Tips for Writing Tests
+----------------------
+
+As with any programming projects, existing programs are the best
+source of the information. However, do _not_ emulate
+t0000-basic.sh when writing your tests. The test is special in
+that it tries to validate the very core of GIT. For example, it
+knows that there will be 256 subdirectories under .git/objects/,
+and it knows that the object ID of an empty tree is a certain
+40-byte string. This is deliberately done so in t0000-basic.sh
+because the things the very basic core test tries to achieve is
+to serve as a basis for people who are changing the GIT internal
+drastically. For these people, after making certain changes,
+not seeing failures from the basic test _is_ a failure. And
+such drastic changes to the core GIT that even changes these
+otherwise supposedly stable object IDs should be accompanied by
+an update to t0000-basic.sh.
+
+However, other tests that simply rely on basic parts of the core
+GIT working properly should not have that level of intimate
+knowledge of the core GIT internals. If all the test scripts
+hardcoded the object IDs like t0000-basic.sh does, that defeats
+the purpose of t0000-basic.sh, which is to isolate that level of
+validation in one place. Your test also ends up needing
+updating when such a change to the internal happens, so do _not_
+do it and leave the low level of validation to t0000-basic.sh.
diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh
new file mode 100755
index 0000000..d5bab75
--- /dev/null
+++ b/test/aggregate-results.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+fixed=0
+success=0
+failed=0
+broken=0
+total=0
+
+for file
+do
+ while read type value
+ do
+ case $type in
+ '')
+ continue ;;
+ fixed)
+ fixed=$(($fixed + $value)) ;;
+ success)
+ success=$(($success + $value)) ;;
+ failed)
+ failed=$(($failed + $value)) ;;
+ broken)
+ broken=$(($broken + $value)) ;;
+ total)
+ total=$(($total + $value)) ;;
+ esac
+ done <"$file"
+done
+
+printf "%-8s%d\n" fixed $fixed
+printf "%-8s%d\n" success $success
+printf "%-8s%d\n" failed $failed
+printf "%-8s%d\n" broken $broken
+printf "%-8s%d\n" total $total
diff --git a/test/t0000-basic.sh b/test/t0000-basic.sh
new file mode 100755
index 0000000..f4ca4fc
--- /dev/null
+++ b/test/t0000-basic.sh
@@ -0,0 +1,368 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='Test the very basics part #1.
+
+The rest of the test suite does not check the basic operation of git
+plumbing commands to work very carefully. Their job is to concentrate
+on tricky features that caused bugs in the past to detect regression.
+
+This test runs very basic features, like registering things in cache,
+writing tree, etc.
+
+Note that this test *deliberately* hard-codes many expected object
+IDs. When object ID computation changes, like in the previous case of
+swapping compression and hashing order, the person who is making the
+modification *should* take notice and update the test vectors here.
+'
+
+################################################################
+# It appears that people try to run tests without building...
+
+../git >/dev/null
+if test $? != 1
+then
+ echo >&2 'You do not seem to have built git yet.'
+ exit 1
+fi
+
+. ./test-lib.sh
+
+################################################################
+# git init has been done in an empty repository.
+# make sure it is empty.
+
+find .git/objects -type f -print >should-be-empty
+test_expect_success \
+ '.git/objects should be empty after git init in an empty repo.' \
+ 'cmp -s /dev/null should-be-empty'
+
+# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
+# 3 is counting "objects" itself
+find .git/objects -type d -print >full-of-directories
+test_expect_success \
+ '.git/objects should have 3 subdirectories.' \
+ 'test $(wc -l < full-of-directories) = 3'
+
+################################################################
+# Test harness
+test_expect_success 'success is reported like this' '
+ :
+'
+test_expect_failure 'pretend we have a known breakage' '
+ false
+'
+test_expect_failure 'pretend we have fixed a known breakage' '
+ :
+'
+test_set_prereq HAVEIT
+haveit=no
+test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '
+ test_have_prereq HAVEIT &&
+ haveit=yes
+'
+donthaveit=yes
+test_expect_success DONTHAVEIT 'unmet prerequisite causes test to be skipped' '
+ donthaveit=no
+'
+if test $haveit$donthaveit != yesyes
+then
+ say "bug in test framework: prerequisite tags do not work reliably"
+ exit 1
+fi
+
+################################################################
+# Basics of the basics
+
+# updating a new file without --add should fail.
+test_expect_success 'git update-index without --add should fail adding.' '
+ test_must_fail git update-index should-be-empty
+'
+
+# and with --add it should succeed, even if it is empty (it used to fail).
+test_expect_success \
+ 'git update-index with --add should succeed.' \
+ 'git update-index --add should-be-empty'
+
+test_expect_success \
+ 'writing tree out with git write-tree' \
+ 'tree=$(git write-tree)'
+
+# we know the shape and contents of the tree and know the object ID for it.
+test_expect_success \
+ 'validate object ID of a known tree.' \
+ 'test "$tree" = 7bb943559a305bdd6bdee2cef6e5df2413c3d30a'
+
+# Removing paths.
+rm -f should-be-empty full-of-directories
+test_expect_success 'git update-index without --remove should fail removing.' '
+ test_must_fail git update-index should-be-empty
+'
+
+test_expect_success \
+ 'git update-index with --remove should be able to remove.' \
+ 'git update-index --remove should-be-empty'
+
+# Empty tree can be written with recent write-tree.
+test_expect_success \
+ 'git write-tree should be able to write an empty tree.' \
+ 'tree=$(git write-tree)'
+
+test_expect_success \
+ 'validate object ID of a known tree.' \
+ 'test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904'
+
+# Various types of objects
+# Some filesystems do not support symblic links; on such systems
+# some expected values are different
+mkdir path2 path3 path3/subp3
+paths='path0 path2/file2 path3/file3 path3/subp3/file3'
+for p in $paths
+do
+ echo "hello $p" >$p
+done
+if test_have_prereq SYMLINKS
+then
+ for p in $paths
+ do
+ ln -s "hello $p" ${p}sym
+ done
+ expectfilter=cat
+ expectedtree=087704a96baf1c2d1c869a8b084481e121c88b5b
+ expectedptree1=21ae8269cacbe57ae09138dcc3a2887f904d02b3
+ expectedptree2=3c5e5399f3a333eddecce7a9b9465b63f65f51e2
+else
+ expectfilter='grep -v sym'
+ expectedtree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46
+ expectedptree1=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325
+ expectedptree2=ce580448f0148b985a513b693fdf7d802cacb44f
+fi
+
+test_expect_success \
+ 'adding various types of objects with git update-index --add.' \
+ 'find path* ! -type d -print | xargs git update-index --add'
+
+# Show them and see that matches what we expect.
+test_expect_success \
+ 'showing stage with git ls-files --stage' \
+ 'git ls-files --stage >current'
+
+$expectfilter >expected <<\EOF
+100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
+120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
+100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
+120000 d8ce161addc5173867a3c3c730924388daedbc38 0 path2/file2sym
+100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0 path3/file3
+120000 8599103969b43aff7e430efea79ca4636466794f 0 path3/file3sym
+100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3
+120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym
+EOF
+test_expect_success \
+ 'validate git ls-files output for a known tree.' \
+ 'test_cmp expected current'
+
+test_expect_success \
+ 'writing tree out with git write-tree.' \
+ 'tree=$(git write-tree)'
+test_expect_success \
+ 'validate object ID for a known tree.' \
+ 'test "$tree" = "$expectedtree"'
+
+test_expect_success \
+ 'showing tree with git ls-tree' \
+ 'git ls-tree $tree >current'
+cat >expected <<\EOF
+100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
+120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
+040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
+040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
+EOF
+test_expect_success SYMLINKS \
+ 'git ls-tree output for a known tree.' \
+ 'test_cmp expected current'
+
+# This changed in ls-tree pathspec change -- recursive does
+# not show tree nodes anymore.
+test_expect_success \
+ 'showing tree with git ls-tree -r' \
+ 'git ls-tree -r $tree >current'
+$expectfilter >expected <<\EOF
+100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
+120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
+100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
+120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
+100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
+120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
+100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
+120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
+EOF
+test_expect_success \
+ 'git ls-tree -r output for a known tree.' \
+ 'test_cmp expected current'
+
+# But with -r -t we can have both.
+test_expect_success \
+ 'showing tree with git ls-tree -r -t' \
+ 'git ls-tree -r -t $tree >current'
+cat >expected <<\EOF
+100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
+120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
+040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
+100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
+120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
+040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
+100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
+120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
+040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2 path3/subp3
+100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
+120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
+EOF
+test_expect_success SYMLINKS \
+ 'git ls-tree -r output for a known tree.' \
+ 'test_cmp expected current'
+
+test_expect_success \
+ 'writing partial tree out with git write-tree --prefix.' \
+ 'ptree=$(git write-tree --prefix=path3)'
+test_expect_success \
+ 'validate object ID for a known tree.' \
+ 'test "$ptree" = "$expectedptree1"'
+
+test_expect_success \
+ 'writing partial tree out with git write-tree --prefix.' \
+ 'ptree=$(git write-tree --prefix=path3/subp3)'
+test_expect_success \
+ 'validate object ID for a known tree.' \
+ 'test "$ptree" = "$expectedptree2"'
+
+cat >badobjects <<EOF
+100644 blob 1000000000000000000000000000000000000000 dir/file1
+100644 blob 2000000000000000000000000000000000000000 dir/file2
+100644 blob 3000000000000000000000000000000000000000 dir/file3
+100644 blob 4000000000000000000000000000000000000000 dir/file4
+100644 blob 5000000000000000000000000000000000000000 dir/file5
+EOF
+
+rm .git/index
+test_expect_success \
+ 'put invalid objects into the index.' \
+ 'git update-index --index-info < badobjects'
+
+test_expect_success 'writing this tree without --missing-ok.' '
+ test_must_fail git write-tree
+'
+
+test_expect_success \
+ 'writing this tree with --missing-ok.' \
+ 'git write-tree --missing-ok'
+
+
+################################################################
+rm .git/index
+test_expect_success \
+ 'git read-tree followed by write-tree should be idempotent.' \
+ 'git read-tree $tree &&
+ test -f .git/index &&
+ newtree=$(git write-tree) &&
+ test "$newtree" = "$tree"'
+
+$expectfilter >expected <<\EOF
+:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
+:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
+:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
+:120000 120000 d8ce161addc5173867a3c3c730924388daedbc38 0000000000000000000000000000000000000000 M path2/file2sym
+:100644 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0000000000000000000000000000000000000000 M path3/file3
+:120000 120000 8599103969b43aff7e430efea79ca4636466794f 0000000000000000000000000000000000000000 M path3/file3sym
+:100644 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0000000000000000000000000000000000000000 M path3/subp3/file3
+:120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M path3/subp3/file3sym
+EOF
+test_expect_success \
+ 'validate git diff-files output for a know cache/work tree state.' \
+ 'git diff-files >current && diff >/dev/null -b current expected'
+
+test_expect_success \
+ 'git update-index --refresh should succeed.' \
+ 'git update-index --refresh'
+
+test_expect_success \
+ 'no diff after checkout and git update-index --refresh.' \
+ 'git diff-files >current && cmp -s current /dev/null'
+
+################################################################
+P=$expectedtree
+test_expect_success \
+ 'git commit-tree records the correct tree in a commit.' \
+ 'commit0=$(echo NO | git commit-tree $P) &&
+ tree=$(git show --pretty=raw $commit0 |
+ sed -n -e "s/^tree //p" -e "/^author /q") &&
+ test "z$tree" = "z$P"'
+
+test_expect_success \
+ 'git commit-tree records the correct parent in a commit.' \
+ 'commit1=$(echo NO | git commit-tree $P -p $commit0) &&
+ parent=$(git show --pretty=raw $commit1 |
+ sed -n -e "s/^parent //p" -e "/^author /q") &&
+ test "z$commit0" = "z$parent"'
+
+test_expect_success \
+ 'git commit-tree omits duplicated parent in a commit.' \
+ 'commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&
+ parent=$(git show --pretty=raw $commit2 |
+ sed -n -e "s/^parent //p" -e "/^author /q" |
+ sort -u) &&
+ test "z$commit0" = "z$parent" &&
+ numparent=$(git show --pretty=raw $commit2 |
+ sed -n -e "s/^parent //p" -e "/^author /q" |
+ wc -l) &&
+ test $numparent = 1'
+
+test_expect_success 'update-index D/F conflict' '
+ mv path0 tmp &&
+ mv path2 path0 &&
+ mv tmp path2 &&
+ git update-index --add --replace path2 path0/file2 &&
+ numpath0=$(git ls-files path0 | wc -l) &&
+ test $numpath0 = 1
+'
+
+test_expect_success SYMLINKS 'absolute path works as expected' '
+ mkdir first &&
+ ln -s ../.git first/.git &&
+ mkdir second &&
+ ln -s ../first second/other &&
+ mkdir third &&
+ dir="$(cd .git; pwd -P)" &&
+ dir2=third/../second/other/.git &&
+ test "$dir" = "$(test-path-utils make_absolute_path $dir2)" &&
+ file="$dir"/index &&
+ test "$file" = "$(test-path-utils make_absolute_path $dir2/index)" &&
+ basename=blub &&
+ test "$dir/$basename" = "$(cd .git && test-path-utils make_absolute_path "$basename")" &&
+ ln -s ../first/file .git/syml &&
+ sym="$(cd first; pwd -P)"/file &&
+ test "$sym" = "$(test-path-utils make_absolute_path "$dir2/syml")"
+'
+
+test_expect_success 'very long name in the index handled sanely' '
+
+ a=a && # 1
+ a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
+ a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
+ a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
+ a=${a}q &&
+
+ >path4 &&
+ git update-index --add path4 &&
+ (
+ git ls-files -s path4 |
+ sed -e "s/ .*/ /" |
+ tr -d "\012"
+ echo "$a"
+ ) | git update-index --index-info &&
+ len=$(git ls-files "a*" | wc -c) &&
+ test $len = 4098
+'
+
+test_done
diff --git a/test/test-lib.sh b/test/test-lib.sh
new file mode 100644
index 0000000..afd3053
--- /dev/null
+++ b/test/test-lib.sh
@@ -0,0 +1,787 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+# if --tee was passed, write the output not only to the terminal, but
+# additionally to the file test-results/$BASENAME.out, too.
+case "$GIT_TEST_TEE_STARTED, $* " in
+done,*)
+ # do not redirect again
+ ;;
+*' --tee '*|*' --va'*)
+ mkdir -p test-results
+ BASE=test-results/$(basename "$0" .sh)
+ (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1;
+ echo $? > $BASE.exit) | tee $BASE.out
+ test "$(cat $BASE.exit)" = 0
+ exit
+ ;;
+esac
+
+# Keep the original TERM for say_color
+ORIGINAL_TERM=$TERM
+
+# For repeatability, reset the environment to known value.
+LANG=C
+LC_ALL=C
+PAGER=cat
+TZ=UTC
+TERM=dumb
+export LANG LC_ALL PAGER TERM TZ
+EDITOR=:
+unset VISUAL
+unset GIT_EDITOR
+unset AUTHOR_DATE
+unset AUTHOR_EMAIL
+unset AUTHOR_NAME
+unset COMMIT_AUTHOR_EMAIL
+unset COMMIT_AUTHOR_NAME
+unset EMAIL
+unset GIT_ALTERNATE_OBJECT_DIRECTORIES
+unset GIT_AUTHOR_DATE
+GIT_AUTHOR_EMAIL=author@example.com
+GIT_AUTHOR_NAME='A U Thor'
+unset GIT_COMMITTER_DATE
+GIT_COMMITTER_EMAIL=committer@example.com
+GIT_COMMITTER_NAME='C O Mitter'
+unset GIT_DIFF_OPTS
+unset GIT_DIR
+unset GIT_WORK_TREE
+unset GIT_EXTERNAL_DIFF
+unset GIT_INDEX_FILE
+unset GIT_OBJECT_DIRECTORY
+unset GIT_CEILING_DIRECTORIES
+unset SHA1_FILE_DIRECTORIES
+unset SHA1_FILE_DIRECTORY
+GIT_MERGE_VERBOSITY=5
+export GIT_MERGE_VERBOSITY
+export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
+export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
+export EDITOR
+GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
+
+# Protect ourselves from common misconfiguration to export
+# CDPATH into the environment
+unset CDPATH
+
+case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in
+ 1|2|true)
+ echo "* warning: Some tests will not work if GIT_TRACE" \
+ "is set as to trace on STDERR ! *"
+ echo "* warning: Please set GIT_TRACE to something" \
+ "other than 1, 2 or true ! *"
+ ;;
+esac
+
+# Convenience
+#
+# A regexp to match 5 and 40 hexdigits
+_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
+
+# Each test should start with something like this, after copyright notices:
+#
+# test_description='Description of this test...
+# This test checks if command xyzzy does the right thing...
+# '
+# . ./test-lib.sh
+[ "x$ORIGINAL_TERM" != "xdumb" ] && (
+ TERM=$ORIGINAL_TERM &&
+ export TERM &&
+ [ -t 1 ] &&
+ tput bold >/dev/null 2>&1 &&
+ tput setaf 1 >/dev/null 2>&1 &&
+ tput sgr0 >/dev/null 2>&1
+ ) &&
+ color=t
+
+while test "$#" -ne 0
+do
+ case "$1" in
+ -d|--d|--de|--deb|--debu|--debug)
+ debug=t; shift ;;
+ -i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate)
+ immediate=t; shift ;;
+ -l|--l|--lo|--lon|--long|--long-|--long-t|--long-te|--long-tes|--long-test|--long-tests)
+ GIT_TEST_LONG=t; export GIT_TEST_LONG; shift ;;
+ -h|--h|--he|--hel|--help)
+ help=t; shift ;;
+ -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
+ verbose=t; shift ;;
+ -q|--q|--qu|--qui|--quie|--quiet)
+ quiet=t; shift ;;
+ --with-dashes)
+ with_dashes=t; shift ;;
+ --no-color)
+ color=; shift ;;
+ --no-python)
+ # noop now...
+ shift ;;
+ --va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
+ valgrind=t; verbose=t; shift ;;
+ --tee)
+ shift ;; # was handled already
+ --root=*)
+ root=$(expr "z$1" : 'z[^=]*=\(.*\)')
+ shift ;;
+ *)
+ echo "error: unknown test option '$1'" >&2; exit 1 ;;
+ esac
+done
+
+if test -n "$color"; then
+ say_color () {
+ (
+ TERM=$ORIGINAL_TERM
+ export TERM
+ case "$1" in
+ error) tput bold; tput setaf 1;; # bold red
+ skip) tput bold; tput setaf 2;; # bold green
+ pass) tput setaf 2;; # green
+ info) tput setaf 3;; # brown
+ *) test -n "$quiet" && return;;
+ esac
+ shift
+ printf "* %s" "$*"
+ tput sgr0
+ echo
+ )
+ }
+else
+ say_color() {
+ test -z "$1" && test -n "$quiet" && return
+ shift
+ echo "* $*"
+ }
+fi
+
+error () {
+ say_color error "error: $*"
+ GIT_EXIT_OK=t
+ exit 1
+}
+
+say () {
+ say_color info "$*"
+}
+
+test "${test_description}" != "" ||
+error "Test script did not set test_description."
+
+if test "$help" = "t"
+then
+ echo "$test_description"
+ exit 0
+fi
+
+exec 5>&1
+if test "$verbose" = "t"
+then
+ exec 4>&2 3>&1
+else
+ exec 4>/dev/null 3>/dev/null
+fi
+
+test_failure=0
+test_count=0
+test_fixed=0
+test_broken=0
+test_success=0
+
+die () {
+ code=$?
+ if test -n "$GIT_EXIT_OK"
+ then
+ exit $code
+ else
+ echo >&5 "FATAL: Unexpected exit with code $code"
+ exit 1
+ fi
+}
+
+GIT_EXIT_OK=
+trap 'die' EXIT
+
+# The semantics of the editor variables are that of invoking
+# sh -c "$EDITOR \"$@\"" files ...
+#
+# If our trash directory contains shell metacharacters, they will be
+# interpreted if we just set $EDITOR directly, so do a little dance with
+# environment variables to work around this.
+#
+# In particular, quoting isn't enough, as the path may contain the same quote
+# that we're using.
+test_set_editor () {
+ FAKE_EDITOR="$1"
+ export FAKE_EDITOR
+ EDITOR='"$FAKE_EDITOR"'
+ export EDITOR
+}
+
+test_decode_color () {
+ sed -e 's/.\[1m/<WHITE>/g' \
+ -e 's/.\[31m/<RED>/g' \
+ -e 's/.\[32m/<GREEN>/g' \
+ -e 's/.\[33m/<YELLOW>/g' \
+ -e 's/.\[34m/<BLUE>/g' \
+ -e 's/.\[35m/<MAGENTA>/g' \
+ -e 's/.\[36m/<CYAN>/g' \
+ -e 's/.\[m/<RESET>/g'
+}
+
+q_to_nul () {
+ perl -pe 'y/Q/\000/'
+}
+
+q_to_cr () {
+ tr Q '\015'
+}
+
+append_cr () {
+ sed -e 's/$/Q/' | tr Q '\015'
+}
+
+remove_cr () {
+ tr '\015' Q | sed -e 's/Q$//'
+}
+
+test_tick () {
+ if test -z "${test_tick+set}"
+ then
+ test_tick=1112911993
+ else
+ test_tick=$(($test_tick + 60))
+ fi
+ GIT_COMMITTER_DATE="$test_tick -0700"
+ GIT_AUTHOR_DATE="$test_tick -0700"
+ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+}
+
+# Call test_commit with the arguments "<message> [<file> [<contents>]]"
+#
+# This will commit a file with the given contents and the given commit
+# message. It will also add a tag with <message> as name.
+#
+# Both <file> and <contents> default to <message>.
+
+test_commit () {
+ file=${2:-"$1.t"}
+ echo "${3-$1}" > "$file" &&
+ git add "$file" &&
+ test_tick &&
+ git commit -m "$1" &&
+ git tag "$1"
+}
+
+# Call test_merge with the arguments "<message> <commit>", where <commit>
+# can be a tag pointing to the commit-to-merge.
+
+test_merge () {
+ test_tick &&
+ git merge -m "$1" "$2" &&
+ git tag "$1"
+}
+
+# This function helps systems where core.filemode=false is set.
+# Use it instead of plain 'chmod +x' to set or unset the executable bit
+# of a file in the working directory and add it to the index.
+
+test_chmod () {
+ chmod "$@" &&
+ git update-index --add "--chmod=$@"
+}
+
+# Use test_set_prereq to tell that a particular prerequisite is available.
+# The prerequisite can later be checked for in two ways:
+#
+# - Explicitly using test_have_prereq.
+#
+# - Implicitly by specifying the prerequisite tag in the calls to
+# test_expect_{success,failure,code}.
+#
+# The single parameter is the prerequisite tag (a simple word, in all
+# capital letters by convention).
+
+test_set_prereq () {
+ satisfied="$satisfied$1 "
+}
+satisfied=" "
+
+test_have_prereq () {
+ case $satisfied in
+ *" $1 "*)
+ : yes, have it ;;
+ *)
+ ! : nope ;;
+ esac
+}
+
+# You are not expected to call test_ok_ and test_failure_ directly, use
+# the text_expect_* functions instead.
+
+test_ok_ () {
+ test_success=$(($test_success + 1))
+ say_color "" " ok $test_count: $@"
+}
+
+test_failure_ () {
+ test_failure=$(($test_failure + 1))
+ say_color error "FAIL $test_count: $1"
+ shift
+ echo "$@" | sed -e 's/^/ /'
+ test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
+}
+
+test_known_broken_ok_ () {
+ test_fixed=$(($test_fixed+1))
+ say_color "" " FIXED $test_count: $@"
+}
+
+test_known_broken_failure_ () {
+ test_broken=$(($test_broken+1))
+ say_color skip " still broken $test_count: $@"
+}
+
+test_debug () {
+ test "$debug" = "" || eval "$1"
+}
+
+test_run_ () {
+ eval >&3 2>&4 "$1"
+ eval_ret="$?"
+ return 0
+}
+
+test_skip () {
+ test_count=$(($test_count+1))
+ to_skip=
+ for skp in $GIT_SKIP_TESTS
+ do
+ case $this_test.$test_count in
+ $skp)
+ to_skip=t
+ esac
+ done
+ if test -z "$to_skip" && test -n "$prereq" &&
+ ! test_have_prereq "$prereq"
+ then
+ to_skip=t
+ fi
+ case "$to_skip" in
+ t)
+ say_color skip >&3 "skipping test: $@"
+ say_color skip "skip $test_count: $1"
+ : true
+ ;;
+ *)
+ false
+ ;;
+ esac
+}
+
+test_expect_failure () {
+ test "$#" = 3 && { prereq=$1; shift; } || prereq=
+ test "$#" = 2 ||
+ error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
+ if ! test_skip "$@"
+ then
+ say >&3 "checking known breakage: $2"
+ test_run_ "$2"
+ if [ "$?" = 0 -a "$eval_ret" = 0 ]
+ then
+ test_known_broken_ok_ "$1"
+ else
+ test_known_broken_failure_ "$1"
+ fi
+ fi
+ echo >&3 ""
+}
+
+test_expect_success () {
+ test "$#" = 3 && { prereq=$1; shift; } || prereq=
+ test "$#" = 2 ||
+ error "bug in the test script: not 2 or 3 parameters to test-expect-success"
+ if ! test_skip "$@"
+ then
+ say >&3 "expecting success: $2"
+ test_run_ "$2"
+ if [ "$?" = 0 -a "$eval_ret" = 0 ]
+ then
+ test_ok_ "$1"
+ else
+ test_failure_ "$@"
+ fi
+ fi
+ echo >&3 ""
+}
+
+test_expect_code () {
+ test "$#" = 4 && { prereq=$1; shift; } || prereq=
+ test "$#" = 3 ||
+ error "bug in the test script: not 3 or 4 parameters to test-expect-code"
+ if ! test_skip "$@"
+ then
+ say >&3 "expecting exit code $1: $3"
+ test_run_ "$3"
+ if [ "$?" = 0 -a "$eval_ret" = "$1" ]
+ then
+ test_ok_ "$2"
+ else
+ test_failure_ "$@"
+ fi
+ fi
+ echo >&3 ""
+}
+
+# test_external runs external test scripts that provide continuous
+# test output about their progress, and succeeds/fails on
+# zero/non-zero exit code. It outputs the test output on stdout even
+# in non-verbose mode, and announces the external script with "* run
+# <n>: ..." before running it. When providing relative paths, keep in
+# mind that all scripts run in "trash directory".
+# Usage: test_external description command arguments...
+# Example: test_external 'Perl API' perl ../path/to/test.pl
+test_external () {
+ test "$#" = 4 && { prereq=$1; shift; } || prereq=
+ test "$#" = 3 ||
+ error >&5 "bug in the test script: not 3 or 4 parameters to test_external"
+ descr="$1"
+ shift
+ if ! test_skip "$descr" "$@"
+ then
+ # Announce the script to reduce confusion about the
+ # test output that follows.
+ say_color "" " run $test_count: $descr ($*)"
+ # Run command; redirect its stderr to &4 as in
+ # test_run_, but keep its stdout on our stdout even in
+ # non-verbose mode.
+ "$@" 2>&4
+ if [ "$?" = 0 ]
+ then
+ test_ok_ "$descr"
+ else
+ test_failure_ "$descr" "$@"
+ fi
+ fi
+}
+
+# Like test_external, but in addition tests that the command generated
+# no output on stderr.
+test_external_without_stderr () {
+ # The temporary file has no (and must have no) security
+ # implications.
+ tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
+ stderr="$tmp/git-external-stderr.$$.tmp"
+ test_external "$@" 4> "$stderr"
+ [ -f "$stderr" ] || error "Internal error: $stderr disappeared."
+ descr="no stderr: $1"
+ shift
+ say >&3 "expecting no stderr from previous command"
+ if [ ! -s "$stderr" ]; then
+ rm "$stderr"
+ test_ok_ "$descr"
+ else
+ if [ "$verbose" = t ]; then
+ output=`echo; echo Stderr is:; cat "$stderr"`
+ else
+ output=
+ fi
+ # rm first in case test_failure exits.
+ rm "$stderr"
+ test_failure_ "$descr" "$@" "$output"
+ fi
+}
+
+# This is not among top-level (test_expect_success | test_expect_failure)
+# but is a prefix that can be used in the test script, like:
+#
+# test_expect_success 'complain and die' '
+# do something &&
+# do something else &&
+# test_must_fail git checkout ../outerspace
+# '
+#
+# Writing this as "! git checkout ../outerspace" is wrong, because
+# the failure could be due to a segv. We want a controlled failure.
+
+test_must_fail () {
+ "$@"
+ test $? -gt 0 -a $? -le 129 -o $? -gt 192
+}
+
+# test_cmp is a helper function to compare actual and expected output.
+# You can use it like:
+#
+# test_expect_success 'foo works' '
+# echo expected >expected &&
+# foo >actual &&
+# test_cmp expected actual
+# '
+#
+# This could be written as either "cmp" or "diff -u", but:
+# - cmp's output is not nearly as easy to read as diff -u
+# - not all diff versions understand "-u"
+
+test_cmp() {
+ $GIT_TEST_CMP "$@"
+}
+
+# Most tests can use the created repository, but some may need to create more.
+# Usage: test_create_repo <directory>
+test_create_repo () {
+ test "$#" = 1 ||
+ error "bug in the test script: not 1 parameter to test-create-repo"
+ owd=`pwd`
+ repo="$1"
+ mkdir -p "$repo"
+ cd "$repo" || error "Cannot setup test environment"
+ "$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
+ error "cannot run git init -- have you built things yet?"
+ mv .git/hooks .git/hooks-disabled
+ cd "$owd"
+}
+
+test_done () {
+ GIT_EXIT_OK=t
+ test_results_dir="$TEST_DIRECTORY/test-results"
+ mkdir -p "$test_results_dir"
+ test_results_path="$test_results_dir/${0%.sh}-$$"
+
+ echo "total $test_count" >> $test_results_path
+ echo "success $test_success" >> $test_results_path
+ echo "fixed $test_fixed" >> $test_results_path
+ echo "broken $test_broken" >> $test_results_path
+ echo "failed $test_failure" >> $test_results_path
+ echo "" >> $test_results_path
+
+ if test "$test_fixed" != 0
+ then
+ say_color pass "fixed $test_fixed known breakage(s)"
+ fi
+ if test "$test_broken" != 0
+ then
+ say_color error "still have $test_broken known breakage(s)"
+ msg="remaining $(($test_count-$test_broken)) test(s)"
+ else
+ msg="$test_count test(s)"
+ fi
+ case "$test_failure" in
+ 0)
+ say_color pass "passed all $msg"
+
+ test -d "$remove_trash" &&
+ cd "$(dirname "$remove_trash")" &&
+ rm -rf "$(basename "$remove_trash")"
+
+ exit 0 ;;
+
+ *)
+ say_color error "failed $test_failure among $msg"
+ exit 1 ;;
+
+ esac
+}
+
+# Test the binaries we have just built. The tests are kept in
+# t/ subdirectory and are run in 'trash directory' subdirectory.
+TEST_DIRECTORY=$(pwd)
+if test -n "$valgrind"
+then
+ make_symlink () {
+ test -h "$2" &&
+ test "$1" = "$(readlink "$2")" || {
+ # be super paranoid
+ if mkdir "$2".lock
+ then
+ rm -f "$2" &&
+ ln -s "$1" "$2" &&
+ rm -r "$2".lock
+ else
+ while test -d "$2".lock
+ do
+ say "Waiting for lock on $2."
+ sleep 1
+ done
+ fi
+ }
+ }
+
+ make_valgrind_symlink () {
+ # handle only executables
+ test -x "$1" || return
+
+ base=$(basename "$1")
+ symlink_target=$TEST_DIRECTORY/../$base
+ # do not override scripts
+ if test -x "$symlink_target" &&
+ test ! -d "$symlink_target" &&
+ test "#!" != "$(head -c 2 < "$symlink_target")"
+ then
+ symlink_target=../valgrind.sh
+ fi
+ case "$base" in
+ *.sh|*.perl)
+ symlink_target=../unprocessed-script
+ esac
+ # create the link, or replace it if it is out of date
+ make_symlink "$symlink_target" "$GIT_VALGRIND/bin/$base" || exit
+ }
+
+ # override all git executables in TEST_DIRECTORY/..
+ GIT_VALGRIND=$TEST_DIRECTORY/valgrind
+ mkdir -p "$GIT_VALGRIND"/bin
+ for file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*
+ do
+ make_valgrind_symlink $file
+ done
+ OLDIFS=$IFS
+ IFS=:
+ for path in $PATH
+ do
+ ls "$path"/git-* 2> /dev/null |
+ while read file
+ do
+ make_valgrind_symlink "$file"
+ done
+ done
+ IFS=$OLDIFS
+ PATH=$GIT_VALGRIND/bin:$PATH
+ GIT_EXEC_PATH=$GIT_VALGRIND/bin
+ export GIT_VALGRIND
+elif test -n "$GIT_TEST_INSTALLED" ; then
+ GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
+ error "Cannot run git from $GIT_TEST_INSTALLED."
+ PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
+ GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
+else # normal case, use ../bin-wrappers only unless $with_dashes:
+ git_bin_dir="$TEST_DIRECTORY/../bin-wrappers"
+ if ! test -x "$git_bin_dir/git" ; then
+ if test -z "$with_dashes" ; then
+ say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
+ fi
+ with_dashes=t
+ fi
+ PATH="$git_bin_dir:$PATH"
+ GIT_EXEC_PATH=$TEST_DIRECTORY/..
+ if test -n "$with_dashes" ; then
+ PATH="$TEST_DIRECTORY/..:$PATH"
+ fi
+fi
+GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
+unset GIT_CONFIG
+GIT_CONFIG_NOSYSTEM=1
+GIT_CONFIG_NOGLOBAL=1
+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
+
+. ../GIT-BUILD-OPTIONS
+
+GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
+export GITPERLLIB
+test -d ../templates/blt || {
+ error "You haven't built things yet, have you?"
+}
+
+if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
+then
+ GITPYTHONLIB="$(pwd)/../git_remote_helpers/build/lib"
+ export GITPYTHONLIB
+ test -d ../git_remote_helpers/build || {
+ error "You haven't built git_remote_helpers yet, have you?"
+ }
+fi
+
+if ! test -x ../test-chmtime; then
+ echo >&2 'You need to build test-chmtime:'
+ echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
+ exit 1
+fi
+
+# Test repository
+test="trash directory.$(basename "$0" .sh)"
+test -n "$root" && test="$root/$test"
+case "$test" in
+/*) TRASH_DIRECTORY="$test" ;;
+ *) TRASH_DIRECTORY="$TEST_DIRECTORY/$test" ;;
+esac
+test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
+rm -fr "$test" || {
+ GIT_EXIT_OK=t
+ echo >&5 "FATAL: Cannot prepare test area"
+ exit 1
+}
+
+test_create_repo "$test"
+# Use -P to resolve symlinks in our working directory so that the cwd
+# in subprocesses like git equals our $PWD (for pathname comparisons).
+cd -P "$test" || exit 1
+
+this_test=${0##*/}
+this_test=${this_test%%-*}
+for skp in $GIT_SKIP_TESTS
+do
+ to_skip=
+ for skp in $GIT_SKIP_TESTS
+ do
+ case "$this_test" in
+ $skp)
+ to_skip=t
+ esac
+ done
+ case "$to_skip" in
+ t)
+ say_color skip >&3 "skipping test $this_test altogether"
+ say_color skip "skip all tests in $this_test"
+ test_done
+ esac
+done
+
+# Provide an implementation of the 'yes' utility
+yes () {
+ if test $# = 0
+ then
+ y=y
+ else
+ y="$*"
+ fi
+
+ while echo "$y"
+ do
+ :
+ done
+}
+
+# Fix some commands on Windows
+case $(uname -s) in
+*MINGW*)
+ # Windows has its own (incompatible) sort and find
+ sort () {
+ /usr/bin/sort "$@"
+ }
+ find () {
+ /usr/bin/find "$@"
+ }
+ sum () {
+ md5sum "$@"
+ }
+ # git sees Windows-style pwd
+ pwd () {
+ builtin pwd -W
+ }
+ # no POSIX permissions
+ # backslashes in pathspec are converted to '/'
+ # exec does not inherit the PID
+ ;;
+*)
+ test_set_prereq POSIXPERM
+ test_set_prereq BSLASHPSPEC
+ test_set_prereq EXECKEEPSPID
+ ;;
+esac
+
+test -z "$NO_PERL" && test_set_prereq PERL
+test -z "$NO_PYTHON" && test_set_prereq PYTHON
+
+# test whether the filesystem supports symbolic links
+ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
+rm -f y
--
1.6.6
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 2/3] Update test framework for use with notmuch
2010-02-08 15:14 ` Michal Sojka
2010-02-08 15:16 ` [PATCH 1/3] Copy test framework from Git Michal Sojka
@ 2010-02-08 15:16 ` Michal Sojka
2010-02-08 15:16 ` [PATCH 3/3] Convert the actual tests to the new framework Michal Sojka
2010-02-11 21:42 ` A functional (but rudimentary) test suite for notmuch Carl Worth
3 siblings, 0 replies; 36+ messages in thread
From: Michal Sojka @ 2010-02-08 15:16 UTC (permalink / raw)
To: notmuch
This removes Git specific things from the test-lib.sh and adds helper
functions for notmuch taken from Carl's notmuch-test script. README is
also slightly modified to reflect the current state.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
test/Makefile | 1 +
test/README | 12 +-
test/t0000-basic.sh | 332 +++------------------------------------------------
test/test-lib.sh | 320 +++++++++++++++++++++++++++----------------------
4 files changed, 204 insertions(+), 461 deletions(-)
mode change 100644 => 100755 test/test-lib.sh
diff --git a/test/Makefile b/test/Makefile
index bd09390..e07c7fd 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -6,6 +6,7 @@
-include ../config.mak
#GIT_TEST_OPTS=--verbose --debug
+SHELL=/bin/bash
SHELL_PATH ?= $(SHELL)
TAR ?= $(TAR)
RM ?= rm -f
diff --git a/test/README b/test/README
index dcd3ebb..0f5bddb 100644
--- a/test/README
+++ b/test/README
@@ -165,10 +165,10 @@ Writing Tests
-------------
The test script is written as a shell script. It should start
-with the standard "#!/bin/sh" with copyright notices, and an
+with the standard "#!/bin/bash" with copyright notices, and an
assignment to variable 'test_description', like this:
- #!/bin/sh
+ #!/bin/bash
#
# Copyright (c) 2005 Junio C Hamano
#
@@ -192,9 +192,11 @@ This test harness library does the following things:
- If the script is invoked with command line argument --help
(or -h), it shows the test_description and exits.
- - Creates an empty test directory with an empty .git/objects
- database and chdir(2) into it. This directory is 't/trash directory'
- if you must know, but I do not think you care.
+ - Creates a test directory with default notmuch-config and empty mail
+ store. This directory is 't/trash directory.<test-basename>' (note
+ the space) if you must know, but I do not think you care. The path
+ to notmuch-config is exported in NOTMUCH_CONFIG environment
+ variable and mail store path is stored in MAIL_DIR variabl.
- Defines standard test helper functions for your scripts to
use. These functions are designed to make all scripts behave
diff --git a/test/t0000-basic.sh b/test/t0000-basic.sh
index f4ca4fc..cc2ca21 100755
--- a/test/t0000-basic.sh
+++ b/test/t0000-basic.sh
@@ -5,46 +5,39 @@
test_description='Test the very basics part #1.
-The rest of the test suite does not check the basic operation of git
-plumbing commands to work very carefully. Their job is to concentrate
-on tricky features that caused bugs in the past to detect regression.
-
-This test runs very basic features, like registering things in cache,
-writing tree, etc.
-
-Note that this test *deliberately* hard-codes many expected object
-IDs. When object ID computation changes, like in the previous case of
-swapping compression and hashing order, the person who is making the
-modification *should* take notice and update the test vectors here.
+Tests the test framework itself.
'
-
################################################################
# It appears that people try to run tests without building...
-../git >/dev/null
-if test $? != 1
+if ! test -x ../notmuch
then
- echo >&2 'You do not seem to have built git yet.'
+ echo >&2 'You do not seem to have built notmuch yet.'
exit 1
fi
. ./test-lib.sh
################################################################
-# git init has been done in an empty repository.
-# make sure it is empty.
+# Test mail store prepared in test-lib.sh
+
+test_expect_success \
+ 'test that mail store was created' \
+ 'test -d "${MAIL_DIR}"'
+
-find .git/objects -type f -print >should-be-empty
+find "${MAIL_DIR}" -type f -print >should-be-empty
test_expect_success \
- '.git/objects should be empty after git init in an empty repo.' \
+ 'mail store should be empty' \
'cmp -s /dev/null should-be-empty'
-# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
-# 3 is counting "objects" itself
-find .git/objects -type d -print >full-of-directories
test_expect_success \
- '.git/objects should have 3 subdirectories.' \
- 'test $(wc -l < full-of-directories) = 3'
+ 'NOTMUCH_CONFIG is set and points to an existing file' \
+ 'test -f "${NOTMUCH_CONFIG}"'
+
+test_expect_success \
+ 'PATH is set to this repository' \
+ 'test "`echo $PATH|cut -f1 -d:`" = "`dirname ${TEST_DIRECTORY}`"'
################################################################
# Test harness
@@ -73,296 +66,5 @@ then
exit 1
fi
-################################################################
-# Basics of the basics
-
-# updating a new file without --add should fail.
-test_expect_success 'git update-index without --add should fail adding.' '
- test_must_fail git update-index should-be-empty
-'
-
-# and with --add it should succeed, even if it is empty (it used to fail).
-test_expect_success \
- 'git update-index with --add should succeed.' \
- 'git update-index --add should-be-empty'
-
-test_expect_success \
- 'writing tree out with git write-tree' \
- 'tree=$(git write-tree)'
-
-# we know the shape and contents of the tree and know the object ID for it.
-test_expect_success \
- 'validate object ID of a known tree.' \
- 'test "$tree" = 7bb943559a305bdd6bdee2cef6e5df2413c3d30a'
-
-# Removing paths.
-rm -f should-be-empty full-of-directories
-test_expect_success 'git update-index without --remove should fail removing.' '
- test_must_fail git update-index should-be-empty
-'
-
-test_expect_success \
- 'git update-index with --remove should be able to remove.' \
- 'git update-index --remove should-be-empty'
-
-# Empty tree can be written with recent write-tree.
-test_expect_success \
- 'git write-tree should be able to write an empty tree.' \
- 'tree=$(git write-tree)'
-
-test_expect_success \
- 'validate object ID of a known tree.' \
- 'test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904'
-
-# Various types of objects
-# Some filesystems do not support symblic links; on such systems
-# some expected values are different
-mkdir path2 path3 path3/subp3
-paths='path0 path2/file2 path3/file3 path3/subp3/file3'
-for p in $paths
-do
- echo "hello $p" >$p
-done
-if test_have_prereq SYMLINKS
-then
- for p in $paths
- do
- ln -s "hello $p" ${p}sym
- done
- expectfilter=cat
- expectedtree=087704a96baf1c2d1c869a8b084481e121c88b5b
- expectedptree1=21ae8269cacbe57ae09138dcc3a2887f904d02b3
- expectedptree2=3c5e5399f3a333eddecce7a9b9465b63f65f51e2
-else
- expectfilter='grep -v sym'
- expectedtree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46
- expectedptree1=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325
- expectedptree2=ce580448f0148b985a513b693fdf7d802cacb44f
-fi
-
-test_expect_success \
- 'adding various types of objects with git update-index --add.' \
- 'find path* ! -type d -print | xargs git update-index --add'
-
-# Show them and see that matches what we expect.
-test_expect_success \
- 'showing stage with git ls-files --stage' \
- 'git ls-files --stage >current'
-
-$expectfilter >expected <<\EOF
-100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
-120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
-100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
-120000 d8ce161addc5173867a3c3c730924388daedbc38 0 path2/file2sym
-100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0 path3/file3
-120000 8599103969b43aff7e430efea79ca4636466794f 0 path3/file3sym
-100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3
-120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym
-EOF
-test_expect_success \
- 'validate git ls-files output for a known tree.' \
- 'test_cmp expected current'
-
-test_expect_success \
- 'writing tree out with git write-tree.' \
- 'tree=$(git write-tree)'
-test_expect_success \
- 'validate object ID for a known tree.' \
- 'test "$tree" = "$expectedtree"'
-
-test_expect_success \
- 'showing tree with git ls-tree' \
- 'git ls-tree $tree >current'
-cat >expected <<\EOF
-100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
-120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
-040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
-040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
-EOF
-test_expect_success SYMLINKS \
- 'git ls-tree output for a known tree.' \
- 'test_cmp expected current'
-
-# This changed in ls-tree pathspec change -- recursive does
-# not show tree nodes anymore.
-test_expect_success \
- 'showing tree with git ls-tree -r' \
- 'git ls-tree -r $tree >current'
-$expectfilter >expected <<\EOF
-100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
-120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
-100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
-120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
-100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
-120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
-100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
-120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
-EOF
-test_expect_success \
- 'git ls-tree -r output for a known tree.' \
- 'test_cmp expected current'
-
-# But with -r -t we can have both.
-test_expect_success \
- 'showing tree with git ls-tree -r -t' \
- 'git ls-tree -r -t $tree >current'
-cat >expected <<\EOF
-100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
-120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
-040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
-100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
-120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
-040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
-100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
-120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
-040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2 path3/subp3
-100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
-120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
-EOF
-test_expect_success SYMLINKS \
- 'git ls-tree -r output for a known tree.' \
- 'test_cmp expected current'
-
-test_expect_success \
- 'writing partial tree out with git write-tree --prefix.' \
- 'ptree=$(git write-tree --prefix=path3)'
-test_expect_success \
- 'validate object ID for a known tree.' \
- 'test "$ptree" = "$expectedptree1"'
-
-test_expect_success \
- 'writing partial tree out with git write-tree --prefix.' \
- 'ptree=$(git write-tree --prefix=path3/subp3)'
-test_expect_success \
- 'validate object ID for a known tree.' \
- 'test "$ptree" = "$expectedptree2"'
-
-cat >badobjects <<EOF
-100644 blob 1000000000000000000000000000000000000000 dir/file1
-100644 blob 2000000000000000000000000000000000000000 dir/file2
-100644 blob 3000000000000000000000000000000000000000 dir/file3
-100644 blob 4000000000000000000000000000000000000000 dir/file4
-100644 blob 5000000000000000000000000000000000000000 dir/file5
-EOF
-
-rm .git/index
-test_expect_success \
- 'put invalid objects into the index.' \
- 'git update-index --index-info < badobjects'
-
-test_expect_success 'writing this tree without --missing-ok.' '
- test_must_fail git write-tree
-'
-
-test_expect_success \
- 'writing this tree with --missing-ok.' \
- 'git write-tree --missing-ok'
-
-
-################################################################
-rm .git/index
-test_expect_success \
- 'git read-tree followed by write-tree should be idempotent.' \
- 'git read-tree $tree &&
- test -f .git/index &&
- newtree=$(git write-tree) &&
- test "$newtree" = "$tree"'
-
-$expectfilter >expected <<\EOF
-:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
-:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
-:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
-:120000 120000 d8ce161addc5173867a3c3c730924388daedbc38 0000000000000000000000000000000000000000 M path2/file2sym
-:100644 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0000000000000000000000000000000000000000 M path3/file3
-:120000 120000 8599103969b43aff7e430efea79ca4636466794f 0000000000000000000000000000000000000000 M path3/file3sym
-:100644 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0000000000000000000000000000000000000000 M path3/subp3/file3
-:120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M path3/subp3/file3sym
-EOF
-test_expect_success \
- 'validate git diff-files output for a know cache/work tree state.' \
- 'git diff-files >current && diff >/dev/null -b current expected'
-
-test_expect_success \
- 'git update-index --refresh should succeed.' \
- 'git update-index --refresh'
-
-test_expect_success \
- 'no diff after checkout and git update-index --refresh.' \
- 'git diff-files >current && cmp -s current /dev/null'
-
-################################################################
-P=$expectedtree
-test_expect_success \
- 'git commit-tree records the correct tree in a commit.' \
- 'commit0=$(echo NO | git commit-tree $P) &&
- tree=$(git show --pretty=raw $commit0 |
- sed -n -e "s/^tree //p" -e "/^author /q") &&
- test "z$tree" = "z$P"'
-
-test_expect_success \
- 'git commit-tree records the correct parent in a commit.' \
- 'commit1=$(echo NO | git commit-tree $P -p $commit0) &&
- parent=$(git show --pretty=raw $commit1 |
- sed -n -e "s/^parent //p" -e "/^author /q") &&
- test "z$commit0" = "z$parent"'
-
-test_expect_success \
- 'git commit-tree omits duplicated parent in a commit.' \
- 'commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&
- parent=$(git show --pretty=raw $commit2 |
- sed -n -e "s/^parent //p" -e "/^author /q" |
- sort -u) &&
- test "z$commit0" = "z$parent" &&
- numparent=$(git show --pretty=raw $commit2 |
- sed -n -e "s/^parent //p" -e "/^author /q" |
- wc -l) &&
- test $numparent = 1'
-
-test_expect_success 'update-index D/F conflict' '
- mv path0 tmp &&
- mv path2 path0 &&
- mv tmp path2 &&
- git update-index --add --replace path2 path0/file2 &&
- numpath0=$(git ls-files path0 | wc -l) &&
- test $numpath0 = 1
-'
-
-test_expect_success SYMLINKS 'absolute path works as expected' '
- mkdir first &&
- ln -s ../.git first/.git &&
- mkdir second &&
- ln -s ../first second/other &&
- mkdir third &&
- dir="$(cd .git; pwd -P)" &&
- dir2=third/../second/other/.git &&
- test "$dir" = "$(test-path-utils make_absolute_path $dir2)" &&
- file="$dir"/index &&
- test "$file" = "$(test-path-utils make_absolute_path $dir2/index)" &&
- basename=blub &&
- test "$dir/$basename" = "$(cd .git && test-path-utils make_absolute_path "$basename")" &&
- ln -s ../first/file .git/syml &&
- sym="$(cd first; pwd -P)"/file &&
- test "$sym" = "$(test-path-utils make_absolute_path "$dir2/syml")"
-'
-
-test_expect_success 'very long name in the index handled sanely' '
-
- a=a && # 1
- a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
- a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
- a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
- a=${a}q &&
-
- >path4 &&
- git update-index --add path4 &&
- (
- git ls-files -s path4 |
- sed -e "s/ .*/ /" |
- tr -d "\012"
- echo "$a"
- ) | git update-index --index-info &&
- len=$(git ls-files "a*" | wc -c) &&
- test $len = 4098
-'
test_done
diff --git a/test/test-lib.sh b/test/test-lib.sh
old mode 100644
new mode 100755
index afd3053..9a0f71b
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2005 Junio C Hamano
#
@@ -29,36 +29,6 @@ PAGER=cat
TZ=UTC
TERM=dumb
export LANG LC_ALL PAGER TERM TZ
-EDITOR=:
-unset VISUAL
-unset GIT_EDITOR
-unset AUTHOR_DATE
-unset AUTHOR_EMAIL
-unset AUTHOR_NAME
-unset COMMIT_AUTHOR_EMAIL
-unset COMMIT_AUTHOR_NAME
-unset EMAIL
-unset GIT_ALTERNATE_OBJECT_DIRECTORIES
-unset GIT_AUTHOR_DATE
-GIT_AUTHOR_EMAIL=author@example.com
-GIT_AUTHOR_NAME='A U Thor'
-unset GIT_COMMITTER_DATE
-GIT_COMMITTER_EMAIL=committer@example.com
-GIT_COMMITTER_NAME='C O Mitter'
-unset GIT_DIFF_OPTS
-unset GIT_DIR
-unset GIT_WORK_TREE
-unset GIT_EXTERNAL_DIFF
-unset GIT_INDEX_FILE
-unset GIT_OBJECT_DIRECTORY
-unset GIT_CEILING_DIRECTORIES
-unset SHA1_FILE_DIRECTORIES
-unset SHA1_FILE_DIRECTORY
-GIT_MERGE_VERBOSITY=5
-export GIT_MERGE_VERBOSITY
-export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
-export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
-export EDITOR
GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}
# Protect ourselves from common misconfiguration to export
@@ -80,6 +50,9 @@ esac
_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
+_x04='[0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+_x32="$_x04$_x04$_x04$_x04$_x04$_x04$_x04$_x04"
+
# Each test should start with something like this, after copyright notices:
#
# test_description='Description of this test...
@@ -203,22 +176,6 @@ die () {
GIT_EXIT_OK=
trap 'die' EXIT
-# The semantics of the editor variables are that of invoking
-# sh -c "$EDITOR \"$@\"" files ...
-#
-# If our trash directory contains shell metacharacters, they will be
-# interpreted if we just set $EDITOR directly, so do a little dance with
-# environment variables to work around this.
-#
-# In particular, quoting isn't enough, as the path may contain the same quote
-# that we're using.
-test_set_editor () {
- FAKE_EDITOR="$1"
- export FAKE_EDITOR
- EDITOR='"$FAKE_EDITOR"'
- export EDITOR
-}
-
test_decode_color () {
sed -e 's/.\[1m/<WHITE>/g' \
-e 's/.\[31m/<RED>/g' \
@@ -246,51 +203,150 @@ remove_cr () {
tr '\015' Q | sed -e 's/Q$//'
}
-test_tick () {
- if test -z "${test_tick+set}"
- then
- test_tick=1112911993
- else
- test_tick=$(($test_tick + 60))
- fi
- GIT_COMMITTER_DATE="$test_tick -0700"
- GIT_AUTHOR_DATE="$test_tick -0700"
- export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+increment_mtime_amount=0
+increment_mtime ()
+{
+ dir="$1"
+
+ increment_mtime_amount=$((increment_mtime_amount + 1))
+ touch -d "+${increment_mtime_amount} seconds" "$dir"
}
-# Call test_commit with the arguments "<message> [<file> [<contents>]]"
+# Generate a new message in the mail directory, with a unique message
+# ID and subject. The message is not added to the index.
+#
+# After this function returns, the filename of the generated message
+# is available as $gen_msg_filename and the message ID is available as
+# $gen_msg_id .
+#
+# This function supports named parameters with the bash syntax for
+# assigning a value to an associative array ([name]=value). The
+# supported parameters are:
#
-# This will commit a file with the given contents and the given commit
-# message. It will also add a tag with <message> as name.
+# [dir]=directory/of/choice
#
-# Both <file> and <contents> default to <message>.
+# Generate the message in directory 'directory/of/choice' within
+# the mail store. The directory will be created if necessary.
+#
+# [body]=text
+#
+# Text to use as the body of the email message
+#
+# '[from]="Some User <user@example.com>"'
+# '[to]="Some User <user@example.com>"'
+# '[subject]="Subject of email message"'
+# '[date]="RFC 822 Date"'
+#
+# Values for email headers. If not provided, default values will
+# be generated instead.
+#
+# '[cc]="Some User <user@example.com>"'
+# [reply-to]=some-address
+# [in-reply-to]=<message-id>
+#
+# Additional values for email headers. If these are not provided
+# then the relevant headers will simply not appear in the
+# message.
+gen_msg_cnt=0
+gen_msg_filename=""
+gen_msg_id=""
+generate_message ()
+{
+ # This is our (bash-specific) magic for doing named parameters
+ local -A template="($@)"
+ local additional_headers
+
+ gen_msg_cnt=$((gen_msg_cnt + 1))
+ gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
+ gen_msg_id="${gen_msg_name}@notmuch-test-suite"
+
+ if [ -z "${template[dir]}" ]; then
+ gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
+ else
+ gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"
+ mkdir -p "$(dirname "$gen_msg_filename")"
+ fi
+
+ if [ -z "${template[body]}" ]; then
+ template[body]="This is just a test message at ${gen_msg_filename}"
+ fi
+
+ if [ -z "${template[from]}" ]; then
+ template[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"
+ fi
+
+ if [ -z "${template[to]}" ]; then
+ template[to]="Notmuch Test Suite <test_suite@notmuchmail.org>"
+ fi
+
+ if [ -z "${template[subject]}" ]; then
+ template[subject]="Test message ${gen_msg_filename}"
+ fi
+
+ if [ -z "${template[date]}" ]; then
+ template[date]="Tue, 05 Jan 2010 15:43:57 -0800"
+ fi
+
+ additional_headers=""
+ if [ ! -z "${template[reply-to]}" ]; then
+ additional_headers="Reply-To: ${template[reply-to]}
+${additional_headers}"
+ fi
+
+ if [ ! -z "${template[in-reply-to]}" ]; then
+ additional_headers="In-Reply-To: ${template[in-reply-to]}
+${additional_headers}"
+ fi
+
+ if [ ! -z "${template[cc]}" ]; then
+ additional_headers="Cc: ${template[cc]}
+${additional_headers}"
+ fi
+
+cat <<EOF >"$gen_msg_filename" &&
+From: ${template[from]}
+To: ${template[to]}
+Message-Id: <${gen_msg_id}>
+Subject: ${template[subject]}
+Date: ${template[date]}
+${additional_headers}
+${template[body]}
+EOF
+
+ # Ensure that the mtime of the containing directory is updated
+ increment_mtime "$(dirname "${gen_msg_filename}")"
+}
+
+# Generate a new message and add it to the index.
+#
+# All of the arguments and return values supported by generate_message
+# are alos supported here, so see that function for details.
+add_message ()
+{
+ generate_message "$@" &&
-test_commit () {
- file=${2:-"$1.t"}
- echo "${3-$1}" > "$file" &&
- git add "$file" &&
- test_tick &&
- git commit -m "$1" &&
- git tag "$1"
+ notmuch new > /dev/null
}
-# Call test_merge with the arguments "<message> <commit>", where <commit>
-# can be a tag pointing to the commit-to-merge.
+NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'
+NOTMUCH_THREAD_ID_SQUELCH='s/thread:................................/thread:XXX/'
+execute_expecting ()
+{
+ args=$1
+ expected=$2
-test_merge () {
- test_tick &&
- git merge -m "$1" "$2" &&
- git tag "$1"
+ output=$(notmuch $args | grep -v -E -e "$NOTMUCH_IGNORED_OUTPUT_REGEXP" | sed -e "$NOTMUCH_THREAD_ID_SQUELCH" || true) &&
+ if [ "$output" = "$expected" ]; then
+ echo " PASS"
+ else
+ echo " FAIL"
+ echo " Expected output: $expected"
+ echo " Actual output: $output"
+ false
+ fi
}
-# This function helps systems where core.filemode=false is set.
-# Use it instead of plain 'chmod +x' to set or unset the executable bit
-# of a file in the working directory and add it to the index.
-test_chmod () {
- chmod "$@" &&
- git update-index --add "--chmod=$@"
-}
# Use test_set_prereq to tell that a particular prerequisite is available.
# The prerequisite can later be checked for in two ways:
@@ -527,21 +583,6 @@ test_cmp() {
$GIT_TEST_CMP "$@"
}
-# Most tests can use the created repository, but some may need to create more.
-# Usage: test_create_repo <directory>
-test_create_repo () {
- test "$#" = 1 ||
- error "bug in the test script: not 1 parameter to test-create-repo"
- owd=`pwd`
- repo="$1"
- mkdir -p "$repo"
- cd "$repo" || error "Cannot setup test environment"
- "$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
- error "cannot run git init -- have you built things yet?"
- mv .git/hooks .git/hooks-disabled
- cd "$owd"
-}
-
test_done () {
GIT_EXIT_OK=t
test_results_dir="$TEST_DIRECTORY/test-results"
@@ -583,9 +624,27 @@ test_done () {
esac
}
+find_notmuch_path ()
+{
+ dir="$1"
+
+ while [ -n "$dir" ]; do
+ bin="$dir/notmuch"
+ if [ -x "$bin" ]; then
+ echo "$dir"
+ return
+ fi
+ dir="$(dirname "$dir")"
+ if [ "$dir" = "/" ]; then
+ break
+ fi
+ done
+}
+
# Test the binaries we have just built. The tests are kept in
-# t/ subdirectory and are run in 'trash directory' subdirectory.
+# test/ subdirectory and are run in 'trash directory' subdirectory.
TEST_DIRECTORY=$(pwd)
+# FIXME: Only the normal case bellow is updated to notmuch
if test -n "$valgrind"
then
make_symlink () {
@@ -654,48 +713,11 @@ elif test -n "$GIT_TEST_INSTALLED" ; then
error "Cannot run git from $GIT_TEST_INSTALLED."
PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
-else # normal case, use ../bin-wrappers only unless $with_dashes:
- git_bin_dir="$TEST_DIRECTORY/../bin-wrappers"
- if ! test -x "$git_bin_dir/git" ; then
- if test -z "$with_dashes" ; then
- say "$git_bin_dir/git is not executable; using GIT_EXEC_PATH"
- fi
- with_dashes=t
- fi
- PATH="$git_bin_dir:$PATH"
- GIT_EXEC_PATH=$TEST_DIRECTORY/..
- if test -n "$with_dashes" ; then
- PATH="$TEST_DIRECTORY/..:$PATH"
- fi
-fi
-GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
-unset GIT_CONFIG
-GIT_CONFIG_NOSYSTEM=1
-GIT_CONFIG_NOGLOBAL=1
-export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
-
-. ../GIT-BUILD-OPTIONS
-
-GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
-export GITPERLLIB
-test -d ../templates/blt || {
- error "You haven't built things yet, have you?"
-}
-
-if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
-then
- GITPYTHONLIB="$(pwd)/../git_remote_helpers/build/lib"
- export GITPYTHONLIB
- test -d ../git_remote_helpers/build || {
- error "You haven't built git_remote_helpers yet, have you?"
- }
-fi
-
-if ! test -x ../test-chmtime; then
- echo >&2 'You need to build test-chmtime:'
- echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
- exit 1
+else # normal case
+ notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
+ test -n "$notmuch_path" && PATH="$notmuch_path:$PATH"
fi
+export PATH
# Test repository
test="trash directory.$(basename "$0" .sh)"
@@ -711,10 +733,26 @@ rm -fr "$test" || {
exit 1
}
-test_create_repo "$test"
+MAIL_DIR="${TRASH_DIRECTORY}/mail"
+export NOTMUCH_CONFIG="${TRASH_DIRECTORY}/notmuch-config"
+
+mkdir -p "${test}"
+mkdir "$MAIL_DIR"
+
+cat <<EOF >"${NOTMUCH_CONFIG}"
+[database]
+path=${MAIL_DIR}
+
+[user]
+name=Notmuch Test Suite
+primary_email=test_suite@notmuchmail.org
+other_email=test_suite_other@notmuchmail.org
+EOF
+
+
# Use -P to resolve symlinks in our working directory so that the cwd
# in subprocesses like git equals our $PWD (for pathname comparisons).
-cd -P "$test" || exit 1
+cd -P "$test" || error "Cannot setup test environment"
this_test=${0##*/}
this_test=${this_test%%-*}
--
1.6.6
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH 3/3] Convert the actual tests to the new framework
2010-02-08 15:14 ` Michal Sojka
2010-02-08 15:16 ` [PATCH 1/3] Copy test framework from Git Michal Sojka
2010-02-08 15:16 ` [PATCH 2/3] Update test framework for use with notmuch Michal Sojka
@ 2010-02-08 15:16 ` Michal Sojka
2010-02-11 21:42 ` A functional (but rudimentary) test suite for notmuch Carl Worth
3 siblings, 0 replies; 36+ messages in thread
From: Michal Sojka @ 2010-02-08 15:16 UTC (permalink / raw)
To: notmuch
The changes are:
- The notmuch-test was split into several files (t000?-*.sh).
- Removed helper functions which were moved to test-lib.sh
- Replaced every printf with test_expect_success.
- Replaced $NOTMUCH with notmuch (test-lib.sh sets $PATH appropriately)
- Test commands chained with && (test-lib.sh doesn't use "set -e" in
order to complete the test suite even if something fails)
- Many variables such as ${MAIL_DIR} were properly quoted as they
contain spaces.
- Changed quoting patterns in add_message and generate_message (single
quotes are already used by the test framework).
- ${TEST_DIR} replaced by ./
QUICK HOWTO:
To run the whole test suite
make
To run only a single test
./t0001-new.sh
To stop on the first error
./t0001-new.sh -i
then mail store and database can be inspected in
"trash directory.t0001-new"
To see the output of tests
./t0001-new.sh -v
To not remove trash directory at the end:
./t0001-new.sh -d
To run all tests verbosely:
make make GIT_TEST_OPTS="-v"
TODO: Convert GIT_* variables in test-lib.sh to NOTMUCH_*
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
test/notmuch-test | 542 ------------------------------------------
test/t0000-basic.sh | 2 +-
test/t0001-new.sh | 135 +++++++++++
test/t0002-search.sh | 62 +++++
test/t0003-reply.sh | 114 +++++++++
test/t0004-uuencoded-data.sh | 35 +++
test/t0005-dump-restore.sh | 44 ++++
7 files changed, 391 insertions(+), 543 deletions(-)
delete mode 100755 test/notmuch-test
create mode 100755 test/t0001-new.sh
create mode 100755 test/t0002-search.sh
create mode 100755 test/t0003-reply.sh
create mode 100755 test/t0004-uuencoded-data.sh
create mode 100755 test/t0005-dump-restore.sh
diff --git a/test/notmuch-test b/test/notmuch-test
deleted file mode 100755
index 2e5eb24..0000000
--- a/test/notmuch-test
+++ /dev/null
@@ -1,542 +0,0 @@
-#!/bin/bash
-set -e
-
-find_notmuch_binary ()
-{
- dir=$1
-
- while [ -n "$dir" ]; do
- bin=$dir/notmuch
- if [ -x $bin ]; then
- echo $bin
- return
- fi
- dir=$(dirname $dir)
- if [ "$dir" = "/" ]; then
- break
- fi
- done
-
- echo notmuch
-}
-
-increment_mtime_amount=0
-increment_mtime ()
-{
- dir=$1
-
- increment_mtime_amount=$((increment_mtime_amount + 1))
- touch -d "+${increment_mtime_amount} seconds" $dir
-}
-
-# Generate a new message in the mail directory, with a unique message
-# ID and subject. The message is not added to the index.
-#
-# After this function returns, the filename of the generated message
-# is available as $gen_msg_filename and the message ID is available as
-# $gen_msg_id .
-#
-# This function supports named parameters with the bash syntax for
-# assigning a value to an associative array ([name]=value). The
-# supported parameters are:
-#
-# [dir]=directory/of/choice
-#
-# Generate the message in directory 'directory/of/choice' within
-# the mail store. The directory will be created if necessary.
-#
-# [body]=text
-#
-# Text to use as the body of the email message
-#
-# '[from]="Some User <user@example.com>"'
-# '[to]="Some User <user@example.com>"'
-# '[subject]="Subject of email message"'
-# '[date]="RFC 822 Date"'
-#
-# Values for email headers. If not provided, default values will
-# be generated instead.
-#
-# '[cc]="Some User <user@example.com>"'
-# [reply-to]=some-address
-# [in-reply-to]=<message-id>
-#
-# Additional values for email headers. If these are not provided
-# then the relevant headers will simply not appear in the
-# message.
-gen_msg_cnt=0
-gen_msg_filename=""
-gen_msg_id=""
-generate_message ()
-{
- # This is our (bash-specific) magic for doing named parameters
- local -A template="($@)"
- local additional_headers
-
- gen_msg_cnt=$((gen_msg_cnt + 1))
- gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
- gen_msg_id="${gen_msg_name}@notmuch-test-suite"
-
- if [ -z "${template[dir]}" ]; then
- gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
- else
- gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"
- mkdir -p $(dirname $gen_msg_filename)
- fi
-
- if [ -z "${template[body]}" ]; then
- template[body]="This is just a test message at ${gen_msg_filename}"
- fi
-
- if [ -z "${template[from]}" ]; then
- template[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"
- fi
-
- if [ -z "${template[to]}" ]; then
- template[to]="Notmuch Test Suite <test_suite@notmuchmail.org>"
- fi
-
- if [ -z "${template[subject]}" ]; then
- template[subject]="Test message ${gen_msg_filename}"
- fi
-
- if [ -z "${template[date]}" ]; then
- template[date]="Tue, 05 Jan 2010 15:43:57 -0800"
- fi
-
- additional_headers=""
- if [ ! -z "${template[reply-to]}" ]; then
- additional_headers="Reply-To: ${template[reply-to]}
-${additional_headers}"
- fi
-
- if [ ! -z "${template[in-reply-to]}" ]; then
- additional_headers="In-Reply-To: ${template[in-reply-to]}
-${additional_headers}"
- fi
-
- if [ ! -z "${template[cc]}" ]; then
- additional_headers="Cc: ${template[cc]}
-${additional_headers}"
- fi
-
-cat <<EOF >$gen_msg_filename
-From: ${template[from]}
-To: ${template[to]}
-Message-Id: <${gen_msg_id}>
-Subject: ${template[subject]}
-Date: ${template[date]}
-${additional_headers}
-${template[body]}
-EOF
-
- # Ensure that the mtime of the containing directory is updated
- increment_mtime $(dirname ${gen_msg_filename})
-}
-
-# Generate a new message and add it to the index.
-#
-# All of the arguments and return values supported by generate_message
-# are alos supported here, so see that function for details.
-add_message ()
-{
- generate_message "$@"
-
- $NOTMUCH new > /dev/null
-}
-
-NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'
-NOTMUCH_THREAD_ID_SQUELCH='s/thread:................................/thread:XXX/'
-execute_expecting ()
-{
- args=$1
- expected=$2
-
- output=$($NOTMUCH $args | grep -v -E -e "$NOTMUCH_IGNORED_OUTPUT_REGEXP" | sed -e "$NOTMUCH_THREAD_ID_SQUELCH" || true)
- if [ "$output" = "$expected" ]; then
- echo " PASS"
- else
- echo " FAIL"
- echo " Expected output: $expected"
- echo " Actual output: $output"
- fi
-}
-
-TEST_DIR=$(pwd)/test.$$
-MAIL_DIR=${TEST_DIR}/mail
-export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
-NOTMUCH=$(find_notmuch_binary $(pwd))
-
-rm -rf ${TEST_DIR}
-mkdir ${TEST_DIR}
-cd ${TEST_DIR}
-
-mkdir ${MAIL_DIR}
-
-cat <<EOF > ${NOTMUCH_CONFIG}
-[database]
-path=${MAIL_DIR}
-
-[user]
-name=Notmuch Test Suite
-primary_email=test_suite@notmuchmail.org
-other_email=test_suite_other@notmuchmail.org
-EOF
-
-printf "Testing \"notmuch new\" in several variations:\n"
-printf " No new messages...\t\t"
-execute_expecting new "No new mail."
-
-printf " Single new message...\t\t"
-generate_message
-execute_expecting new "Added 1 new message to the database."
-
-printf " Multiple new messages...\t"
-generate_message
-generate_message
-execute_expecting new "Added 2 new messages to the database."
-
-printf " No new messages (non-empty DB)... "
-execute_expecting new "No new mail."
-
-printf " New directories...\t\t"
-rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
-mkdir ${MAIL_DIR}/def
-mkdir ${MAIL_DIR}/ghi
-generate_message [dir]=def
-
-execute_expecting new "Added 1 new message to the database."
-
-printf " Alternate inode order...\t"
-
-rm -rf ${MAIL_DIR}/.notmuch
-mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc
-rm ${MAIL_DIR}/def/*
-generate_message [dir]=abc
-
-execute_expecting new "Added 1 new message to the database."
-
-printf " Message moved in...\t\t"
-rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
-generate_message
-tmp_msg_filename=tmp/$gen_msg_filename
-mkdir -p $(dirname $tmp_msg_filename)
-mv $gen_msg_filename $tmp_msg_filename
-increment_mtime ${MAIL_DIR}
-$NOTMUCH new > /dev/null
-mv $tmp_msg_filename $gen_msg_filename
-increment_mtime ${MAIL_DIR}
-execute_expecting new "Added 1 new message to the database."
-
-printf " Renamed message...\t\t"
-
-generate_message
-$NOTMUCH new > /dev/null
-mv $gen_msg_filename ${gen_msg_filename}-renamed
-increment_mtime ${MAIL_DIR}
-execute_expecting new "No new mail. Detected 1 file rename."
-
-printf " Deleted message...\t\t"
-
-rm ${gen_msg_filename}-renamed
-increment_mtime ${MAIL_DIR}
-execute_expecting new "No new mail. Removed 1 message."
-
-printf " Renamed directory...\t\t"
-
-generate_message [dir]=dir
-generate_message [dir]=dir
-generate_message [dir]=dir
-
-$NOTMUCH new > /dev/null
-
-mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
-increment_mtime ${MAIL_DIR}
-
-execute_expecting new "No new mail. Detected 3 file renames."
-
-printf " Deleted directory...\t\t"
-
-rm -rf ${MAIL_DIR}/dir-renamed
-increment_mtime ${MAIL_DIR}
-
-execute_expecting new "No new mail. Removed 3 messages."
-
-printf " New directory (at end of list)... "
-
-generate_message [dir]=zzz
-generate_message [dir]=zzz
-generate_message [dir]=zzz
-
-execute_expecting new "Added 3 new messages to the database."
-
-printf " Deleted directory (end of list)... "
-
-rm -rf ${MAIL_DIR}/zzz
-increment_mtime ${MAIL_DIR}
-
-execute_expecting new "No new mail. Removed 3 messages."
-
-printf " New symlink to directory...\t"
-
-rm -rf ${MAIL_DIR}/.notmuch
-mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir
-
-mkdir ${MAIL_DIR}
-ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink
-
-execute_expecting new "Added 1 new message to the database."
-
-printf " New symlink to a file...\t"
-generate_message
-external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
-mkdir -p $(dirname $external_msg_filename)
-mv $gen_msg_filename $external_msg_filename
-ln -s $external_msg_filename $gen_msg_filename
-increment_mtime ${MAIL_DIR}
-execute_expecting new "Added 1 new message to the database."
-
-printf " New two-level directory...\t"
-
-generate_message [dir]=two/levels
-generate_message [dir]=two/levels
-generate_message [dir]=two/levels
-
-execute_expecting new "Added 3 new messages to the database."
-
-printf " Deleted two-level directory... "
-
-rm -rf ${MAIL_DIR}/two
-increment_mtime ${MAIL_DIR}
-
-execute_expecting new "No new mail. Removed 3 messages."
-
-printf "\nTesting \"notmuch search\" in several variations:\n"
-
-printf " Search body...\t\t\t"
-add_message '[subject]="body search"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [body]=bodysearchtest
-execute_expecting "search bodysearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)"
-
-printf " Search by from:...\t\t"
-add_message '[subject]="search by from"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom
-execute_expecting "search from:searchbyfrom" "thread:XXX 2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)"
-
-printf " Search by to:...\t\t"
-add_message '[subject]="search by to"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [to]=searchbyto
-execute_expecting "search to:searchbyto" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)"
-
-printf " Search by subject:...\t\t"
-add_message [subject]=subjectsearchtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
-execute_expecting "search subject:subjectsearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)"
-
-printf " Search by id:...\t\t"
-add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
-execute_expecting "search id:${gen_msg_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
-
-printf " Search by tag:...\t\t"
-add_message '[subject]="search by tag"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
-$NOTMUCH tag +searchbytag id:${gen_msg_id}
-execute_expecting "search tag:searchbytag" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)"
-
-printf " Search by thread:...\t\t"
-add_message '[subject]="search by thread"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
-thread_id=$($NOTMUCH search id:${gen_msg_id} | sed -e 's/thread:\([a-f0-9]*\).*/\1/')
-execute_expecting "search thread:${thread_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)"
-
-printf " Search body (phrase)...\t"
-add_message '[subject]="body search (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="body search (phrase)"'
-execute_expecting "search 'body search (phrase)'" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)"
-
-printf " Search by from: (address)...\t"
-add_message '[subject]="search by from (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom@example.com
-execute_expecting "search from:searchbyfrom@example.com" "thread:XXX 2000-01-01 [1/1] searchbyfrom@example.com; search by from (address) (inbox unread)"
-
-printf " Search by from: (name)...\t"
-add_message '[subject]="search by from (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[from]="Search By From Name <test@example.com>"'
-execute_expecting "search from:'Search By From Name'" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
-
-printf " Search by to: (address)...\t"
-add_message '[subject]="search by to (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [to]=searchbyto@example.com
-execute_expecting "search to:searchbyto@example.com" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (inbox unread)"
-
-printf " Search by to: (name)...\t"
-add_message '[subject]="search by to (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[to]="Search By To Name <test@example.com>"'
-execute_expecting "search to:'Search By To Name'" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
-
-printf " Search by subject: (phrase)...\t"
-add_message '[subject]="subject search test (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
-execute_expecting "search subject:'subject search test (phrase)'" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)"
-
-printf "\nTesting \"notmuch reply\" in several variations:\n"
-
-printf " Basic reply...\t\t\t"
-add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
- '[body]="basic reply test"'
-
-execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
-Subject: Re: notmuch-reply-test
-To: Sender <sender@example.com>
-Bcc: test_suite@notmuchmail.org
-In-Reply-To: <${gen_msg_id}>
-References: <${gen_msg_id}>
-
-On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
-> basic reply test"
-
-printf " Multiple recipients...\t\t"
-add_message '[from]="Sender <sender@example.com>"' \
- '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
- '[body]="Multiple recipients"'
-
-execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
-Subject: Re: notmuch-reply-test
-To: Sender <sender@example.com>, Someone Else <someone@example.com>
-Bcc: test_suite@notmuchmail.org
-In-Reply-To: <${gen_msg_id}>
-References: <${gen_msg_id}>
-
-On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
-> Multiple recipients"
-
-printf " Reply with CC...\t\t"
-add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite@notmuchmail.org \
- '[cc]="Other Parties <cc@example.com>"' \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
- '[body]="reply with CC"'
-
-execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
-Subject: Re: notmuch-reply-test
-To: Sender <sender@example.com>
-Cc: Other Parties <cc@example.com>
-Bcc: test_suite@notmuchmail.org
-In-Reply-To: <${gen_msg_id}>
-References: <${gen_msg_id}>
-
-On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
-> reply with CC"
-
-printf " Reply from alternate address..."
-add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite_other@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
- '[body]="reply from alternate address"'
-
-execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
-Subject: Re: notmuch-reply-test
-To: Sender <sender@example.com>
-Bcc: test_suite@notmuchmail.org
-In-Reply-To: <${gen_msg_id}>
-References: <${gen_msg_id}>
-
-On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
-> reply from alternate address"
-
-printf " Support for Reply-To...\t"
-add_message '[from]="Sender <sender@example.com>"' \
- [to]=test_suite@notmuchmail.org \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
- '[body]="support for reply-to"' \
- '[reply-to]="Sender <elsewhere@example.com>"'
-
-execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
-Subject: Re: notmuch-reply-test
-To: Sender <elsewhere@example.com>
-Bcc: test_suite@notmuchmail.org
-In-Reply-To: <${gen_msg_id}>
-References: <${gen_msg_id}>
-
-On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
-> support for reply-to"
-
-printf " Un-munging Reply-To...\t\t"
-add_message '[from]="Sender <sender@example.com>"' \
- '[to]="Some List <list@example.com>"' \
- [subject]=notmuch-reply-test \
- '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
- '[body]="Un-munging Reply-To"' \
- '[reply-to]="Evil Munging List <list@example.com>"'
-
-execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
-Subject: Re: notmuch-reply-test
-To: Sender <sender@example.com>, Some List <list@example.com>
-Bcc: test_suite@notmuchmail.org
-In-Reply-To: <${gen_msg_id}>
-References: <${gen_msg_id}>
-
-On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
-> Un-munging Reply-To"
-
-printf "\nTesting handling of uuencoded data:\n"
-
-add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
-'[body]="This message is used to ensure that notmuch correctly handles a
-message containing a block of uuencoded data. First, we have a marker
-this content beforeuudata . Then we beging the uunencoded data itself:
-
-begin 644 bogus-uuencoded-data
-M0123456789012345678901234567890123456789012345678901234567890
-MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.
-MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA
-MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE
-MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY
-MSEARCH RESULT.
-\`
-end
-
-Finally, we have our afteruudata marker as well."'
-
-printf " Ensure content before uu data is indexed..."
-execute_expecting "search beforeuudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
-printf " Ensure uu data is not indexed...\t"
-execute_expecting "search DURINGUUDATA" ""
-printf " Ensure content after uu data is indexed..."
-execute_expecting "search afteruudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
-
-printf "\nTesting \"notmuch dump\" and \"notmuch restore\":\n"
-
-printf " Dumping all tags...\t\t"
-$NOTMUCH dump dump.expected
-echo " PASS"
-
-printf " Clearing all tags...\t\t"
-sed -e 's/(\([^(]*\))$/()/' < dump.expected > clear.expected
-$NOTMUCH restore clear.expected
-$NOTMUCH dump clear.actual
-if diff clear.expected clear.actual > /dev/null; then
- echo " PASS"
-else
- echo " FAIL"
- echo " Expected output: See file clear.expected"
- echo " Actual output: See file clear.actual"
-fi
-
-printf " Restoring original tags...\t"
-$NOTMUCH restore dump.expected
-$NOTMUCH dump dump.actual
-if diff dump.expected dump.actual > /dev/null; then
- echo " PASS"
-else
- echo " FAIL"
- echo " Expected output: See file dump.expected"
- echo " Actual output: See file dump.actual"
-fi
-
-printf " Restore with nothing to do...\t"
-$NOTMUCH restore dump.expected
-echo " PASS"
-
-cat <<EOF
-Notmuch test suite complete.
-
-Intermediate state can be examined in:
- ${TEST_DIR}
-EOF
diff --git a/test/t0000-basic.sh b/test/t0000-basic.sh
index cc2ca21..be4932a 100755
--- a/test/t0000-basic.sh
+++ b/test/t0000-basic.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2005 Junio C Hamano
#
diff --git a/test/t0001-new.sh b/test/t0001-new.sh
new file mode 100755
index 0000000..1fc030d
--- /dev/null
+++ b/test/t0001-new.sh
@@ -0,0 +1,135 @@
+#!/bin/bash
+
+test_description="Test \"notmuch new\" in several variations"
+
+. ./test-lib.sh
+
+test_expect_success "No new messages" '
+execute_expecting new "No new mail."
+'
+test_expect_success "Single new message" '
+generate_message &&
+execute_expecting new "Added 1 new message to the database."
+'
+test_expect_success "Multiple new messages" '
+generate_message &&
+generate_message &&
+execute_expecting new "Added 2 new messages to the database."
+'
+test_expect_success "No new messages (non-empty DB)" '
+execute_expecting new "No new mail."
+'
+test_expect_success "New directories" '
+rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&
+mkdir "${MAIL_DIR}/def" &&
+mkdir "${MAIL_DIR}/ghi" &&
+generate_message [dir]=def
+
+execute_expecting new "Added 1 new message to the database."
+'
+test_expect_success "Alternate inode order" '
+
+rm -rf "${MAIL_DIR}/.notmuch" &&
+mv "${MAIL_DIR}/ghi" "${MAIL_DIR}/abc" &&
+rm "${MAIL_DIR}/def/"* &&
+generate_message [dir]=abc &&
+
+execute_expecting new "Added 1 new message to the database."
+'
+test_expect_success "Message moved in" '
+rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&
+generate_message &&
+tmp_msg_filename="tmp/$gen_msg_name" &&
+mkdir -p "$(dirname "$tmp_msg_filename")" &&
+mv "$gen_msg_filename" "$tmp_msg_filename" &&
+increment_mtime "${MAIL_DIR}" &&
+notmuch new > /dev/null &&
+mv "$tmp_msg_filename" "$gen_msg_filename" &&
+increment_mtime "${MAIL_DIR}" &&
+execute_expecting new "Added 1 new message to the database."
+'
+test_expect_success "Renamed message" '
+
+generate_message &&
+notmuch new > /dev/null &&
+mv "$gen_msg_filename" "${gen_msg_filename}-renamed" &&
+increment_mtime "${MAIL_DIR}" &&
+execute_expecting new "No new mail. Detected 1 file rename."
+'
+test_expect_success "Deleted message" '
+
+rm "${gen_msg_filename}-renamed" &&
+increment_mtime "${MAIL_DIR}" &&
+execute_expecting new "No new mail. Removed 1 message."
+'
+test_expect_success "Renamed directory" '
+
+generate_message [dir]=dir &&
+generate_message [dir]=dir &&
+generate_message [dir]=dir &&
+
+notmuch new > /dev/null &&
+
+mv "${MAIL_DIR}/dir" "${MAIL_DIR}/dir-renamed" &&
+increment_mtime "${MAIL_DIR}" &&
+
+execute_expecting new "No new mail. Detected 3 file renames."
+'
+test_expect_success "Deleted directory" '
+
+rm -rf "${MAIL_DIR}/dir-renamed" &&
+increment_mtime "${MAIL_DIR}" &&
+
+execute_expecting new "No new mail. Removed 3 messages."
+'
+test_expect_success "New directory (at end of list)" '
+
+generate_message [dir]=zzz &&
+generate_message [dir]=zzz &&
+generate_message [dir]=zzz &&
+
+execute_expecting new "Added 3 new messages to the database."
+'
+test_expect_success "Deleted directory (end of list)" '
+
+rm -rf "${MAIL_DIR}/zzz" &&
+increment_mtime "${MAIL_DIR}" &&
+
+execute_expecting new "No new mail. Removed 3 messages."
+'
+test_expect_success "New symlink to directory" '
+
+rm -rf "${MAIL_DIR}/.notmuch" &&
+mv "${MAIL_DIR}" "actual_maildir" &&
+
+mkdir "${MAIL_DIR}" &&
+ln -s "$PWD/actual_maildir" "${MAIL_DIR}/symlink" &&
+
+execute_expecting new "Added 1 new message to the database."
+'
+test_expect_success "New symlink to a file" '
+generate_message &&
+external_msg_filename="$PWD/external/$(basename "$gen_msg_filename")" &&
+mkdir -p "$(dirname "$external_msg_filename")" &&
+mv "$gen_msg_filename" "$external_msg_filename" &&
+ln -s "$external_msg_filename" "$gen_msg_filename" &&
+increment_mtime "${MAIL_DIR}" &&
+execute_expecting new "Added 1 new message to the database."
+'
+test_expect_success "New two-level directory" '
+
+generate_message [dir]=two/levels &&
+generate_message [dir]=two/levels &&
+generate_message [dir]=two/levels &&
+
+execute_expecting new "Added 3 new messages to the database."
+'
+test_expect_success "Deleted two-level directory" '
+
+rm -rf "${MAIL_DIR}/two" &&
+increment_mtime "${MAIL_DIR}" &&
+
+execute_expecting new "No new mail. Removed 3 messages."
+'
+
+test_done
diff --git a/test/t0002-search.sh b/test/t0002-search.sh
new file mode 100755
index 0000000..c8c24a0
--- /dev/null
+++ b/test/t0002-search.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+test_description="Testing \"notmuch search\" in several variations"
+
+. ./test-lib.sh
+
+test_expect_success "Search body" '
+add_message [subject]="\"body search\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [body]=bodysearchtest &&
+execute_expecting "search bodysearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)"
+'
+test_expect_success "Search by from:" '
+add_message [subject]="\"search by from\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [from]=searchbyfrom &&
+execute_expecting "search from:searchbyfrom" "thread:XXX 2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)"
+'
+test_expect_success "Search by to:" '
+add_message [subject]="\"search by to\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [to]=searchbyto &&
+execute_expecting "search to:searchbyto" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)"
+'
+test_expect_success "Search by subject:" '
+add_message [subject]=subjectsearchtest [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+execute_expecting "search subject:subjectsearchtest" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)"
+'
+test_expect_success "Search by id:" '
+add_message [subject]="\"search by id\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+execute_expecting "search id:${gen_msg_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
+'
+test_expect_success "Search by tag:" '
+add_message [subject]="\"search by tag\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+notmuch tag +searchbytag id:${gen_msg_id} &&
+execute_expecting "search tag:searchbytag" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)"
+'
+test_expect_success "Search by thread:" '
+add_message [subject]="\"search by thread\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+thread_id=$(notmuch search id:${gen_msg_id} | sed -e "s/thread:\([a-f0-9]*\).*/\1/") &&
+execute_expecting "search thread:${thread_id}" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)"
+'
+test_expect_success "Search body (phrase)" '
+add_message [subject]="\"body search (phrase)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [body]="\"body search (phrase)\"" &&
+execute_expecting "search \"body search (phrase)\"" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)"
+'
+test_expect_success "Search by from: (address)" '
+add_message [subject]="\"search by from (address)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [from]=searchbyfrom@example.com &&
+execute_expecting "search from:searchbyfrom@example.com" "thread:XXX 2000-01-01 [1/1] searchbyfrom@example.com; search by from (address) (inbox unread)"
+'
+test_expect_success "Search by from: (name)" '
+add_message [subject]="\"search by from (name)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [from]="\"Search By From Name <test@example.com>\"" &&
+execute_expecting "search from:\"Search By From Name\"" "thread:XXX 2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
+'
+test_expect_success "Search by to: (address)" '
+add_message [subject]="\"search by to (address)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [to]=searchbyto@example.com &&
+execute_expecting "search to:searchbyto@example.com" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (inbox unread)"
+'
+test_expect_success "Search by to: (name)" '
+add_message [subject]="\"search by to (name)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [to]="\"Search By To Name <test@example.com>\"" &&
+execute_expecting "search to:\"Search By To Name\"" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
+'
+test_expect_success "Search by subject: (phrase)" '
+add_message [subject]="\"subject search test (phrase)\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" &&
+execute_expecting "search subject:\"subject search test (phrase)\"" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)"
+'
+
+test_done
diff --git a/test/t0003-reply.sh b/test/t0003-reply.sh
new file mode 100755
index 0000000..a94c300
--- /dev/null
+++ b/test/t0003-reply.sh
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+test_description="Testing \"notmuch reply\" in several variations"
+
+. ./test-lib.sh
+
+test_expect_success "Basic reply" '
+add_message [from]="\"Sender <sender@example.com>\"" \
+ [to]=test_suite@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
+ [body]="\"basic reply test\"" &&
+
+execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+Bcc: test_suite@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> basic reply test"
+'
+test_expect_success "Multiple recipients" '
+add_message [from]="\"Sender <sender@example.com>\"" \
+ [to]="\"test_suite@notmuchmail.org, Someone Else <someone@example.com>\"" \
+ [subject]=notmuch-reply-test \
+ [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
+ [body]="\"Multiple recipients\"" &&
+
+execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, Someone Else <someone@example.com>
+Bcc: test_suite@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> Multiple recipients"
+'
+test_expect_success "Reply with CC" '
+add_message [from]="\"Sender <sender@example.com>\"" \
+ [to]=test_suite@notmuchmail.org \
+ [cc]="\"Other Parties <cc@example.com>\"" \
+ [subject]=notmuch-reply-test \
+ [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
+ [body]="\"reply with CC\"" &&
+
+execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+Cc: Other Parties <cc@example.com>
+Bcc: test_suite@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> reply with CC"
+'
+test_expect_success "Reply from alternate address" '
+add_message [from]="\"Sender <sender@example.com>\"" \
+ [to]=test_suite_other@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
+ [body]="\"reply from alternate address\"" &&
+
+execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+Bcc: test_suite@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> reply from alternate address"
+'
+test_expect_success "Support for Reply-To" '
+add_message [from]="\"Sender <sender@example.com>\"" \
+ [to]=test_suite@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
+ [body]="\"support for reply-to\"" \
+ [reply-to]="\"Sender <elsewhere@example.com>\"" &&
+
+execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <elsewhere@example.com>
+Bcc: test_suite@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> support for reply-to"
+'
+test_expect_success "Un-munging Reply-To" '
+add_message [from]="\"Sender <sender@example.com>\"" \
+ [to]="\"Some List <list@example.com>\"" \
+ [subject]=notmuch-reply-test \
+ [date]="\"Tue, 05 Jan 2010 15:43:56 -0800\"" \
+ [body]="\"Un-munging Reply-To\"" \
+ [reply-to]="\"Evil Munging List <list@example.com>\"" &&
+
+execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, Some List <list@example.com>
+Bcc: test_suite@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> Un-munging Reply-To"
+'
+
+test_done
diff --git a/test/t0004-uuencoded-data.sh b/test/t0004-uuencoded-data.sh
new file mode 100755
index 0000000..a461f4a
--- /dev/null
+++ b/test/t0004-uuencoded-data.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+test_description="Testing handling of uuencoded data"
+
+. ./test-lib.sh
+
+test_expect_success 'Generate message' '
+add_message [subject]=uuencodetest [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" \
+[body]="\"This message is used to ensure that notmuch correctly handles a
+message containing a block of uuencoded data. First, we have a marker
+this content beforeuudata . Then we beging the uunencoded data itself:
+
+begin 644 bogus-uuencoded-data
+M0123456789012345678901234567890123456789012345678901234567890
+MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.
+MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA
+MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE
+MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY
+MSEARCH RESULT.
+\\\`
+end
+
+Finally, we have our afteruudata marker as well.\""
+'
+test_expect_success "Ensure content before uu data is indexed" '
+execute_expecting "search beforeuudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
+'
+test_expect_success "Ensure uu data is not indexed" '
+execute_expecting "search DURINGUUDATA" ""
+'
+test_expect_success "Ensure content after uu data is indexed" '
+execute_expecting "search afteruudata" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
+'
+
+test_done
diff --git a/test/t0005-dump-restore.sh b/test/t0005-dump-restore.sh
new file mode 100755
index 0000000..49df8ec
--- /dev/null
+++ b/test/t0005-dump-restore.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+test_description="Testing \"notmuch dump\" and \"notmuch restore\""
+
+. ./test-lib.sh
+
+test_expect_success "Generate some message" '
+generate_message &&
+notmuch new
+'
+
+test_expect_success "Dumping all tags" '
+notmuch dump dump.expected
+'
+test_expect_success "Clearing all tags" '
+sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
+notmuch restore clear.expected &&
+notmuch dump clear.actual &&
+if diff clear.expected clear.actual > /dev/null; then
+ echo " PASS"
+else
+ echo " FAIL"
+ echo " Expected output: See file clear.expected"
+ echo " Actual output: See file clear.actual"
+ false
+fi
+'
+test_expect_success "Restoring original tags" '
+notmuch restore dump.expected &&
+notmuch dump dump.actual &&
+if diff dump.expected dump.actual > /dev/null; then
+ echo " PASS"
+else
+ echo " FAIL"
+ echo " Expected output: See file dump.expected"
+ echo " Actual output: See file dump.actual"
+ false
+fi
+'
+test_expect_success "Restore with nothing to do" '
+notmuch restore dump.expected
+'
+
+test_done
--
1.6.6
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: A functional (but rudimentary) test suite for notmuch
2010-02-08 15:14 ` Michal Sojka
` (2 preceding siblings ...)
2010-02-08 15:16 ` [PATCH 3/3] Convert the actual tests to the new framework Michal Sojka
@ 2010-02-11 21:42 ` Carl Worth
2010-02-12 14:47 ` Michal Sojka
3 siblings, 1 reply; 36+ messages in thread
From: Carl Worth @ 2010-02-11 21:42 UTC (permalink / raw)
To: Michal Sojka, notmuch
[-- Attachment #1: Type: text/plain, Size: 2581 bytes --]
Hi Michal,
I found myself today *really* needing to add a test that exercises some
code in our emacs client. (Eric found that a message that includes a ":"
in the From: address breaks things due to a buggy regexp.) And I
wanted to see if I could merge your conversion of the test suite before
I added a feature as big as that. See below for my feedback.
-Carl
On Mon, 8 Feb 2010 16:14:24 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> I converted the actual version of notmuch-test to git test framework.
> The result is in the followup patches.
Interesting. My only real concern at this point is that some of the new files
have a copyright header identifying Junio as the copyright holder, but
no license information. Meanwhile, the implicit license of git (GPLv2
only) is incompatible with that of notmuch (GPLv3+).
So if you'd like to ask Junio for permission to re-use the files under
the GPLv3+ then we could see what he says.
In the meantime, you've done some nice modularization work here which we
should be able to take right away, (and I can write tiny implementations
of the functions we need so that we can just drop in git's test-lib.sh
if we get permission).
So we won't yet have any of the fancy features of the framework,
(expected failures, reports of fixed tests, pre-requisites for tests),
but we're not *using* any of those features yet so it shouldn't matter.
> The conversion was not as straightforward as I expected mainly because
> of problems with quoting. There are several sources of quotation problems
> one being Carl's hashed array parameters. I thing it would be
> sufficient to use plain variables for passing additional parameters.
> Instead of:
> add_message [from]="\"Sender <sender@example.com>\"" \
> [to]=test_suite@notmuchmail.org \
...
> I'd do:
> msg_from="Sender <sender@example.com>"
> msg_to=test_suite@notmuchmail.org
> add_message
Yeah. I almost wrote it that way, but named parameters (even if faked)
seemed so much nicer. I'll agree that the quoting was quite nasty
though.
> A possible additional improvement is elimination of
> execute_expecting(). Combination of action (running notmuch) and
> testing of a result in a single function makes it hard to distinguish
> whether the problem is in the action or in the output.
A fair point. It also caused problems when I wanted to do tests that
didn't directly test the output of notmuch, (such as a test that uses
diff to compare a result against the contents in a file).
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: A functional (but rudimentary) test suite for notmuch
2010-02-11 21:42 ` A functional (but rudimentary) test suite for notmuch Carl Worth
@ 2010-02-12 14:47 ` Michal Sojka
2010-02-12 16:33 ` Carl Worth
0 siblings, 1 reply; 36+ messages in thread
From: Michal Sojka @ 2010-02-12 14:47 UTC (permalink / raw)
To: Carl Worth, notmuch
On Thu, 11 Feb 2010 13:42:08 -0800, Carl Worth <cworth@cworth.org> wrote:
> Interesting. My only real concern at this point is that some of the new files
> have a copyright header identifying Junio as the copyright holder, but
> no license information. Meanwhile, the implicit license of git (GPLv2
> only) is incompatible with that of notmuch (GPLv3+).
I'm not lawyer, but I'd say it should be no problem to use GPLv2 test
suite to test your GPLv3 application. You are not linking them
together.
On the other hand, if you want the tests cases to be GPLv3 then you are
probably right. Is this the case?
Michal
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: A functional (but rudimentary) test suite for notmuch
2010-02-12 14:47 ` Michal Sojka
@ 2010-02-12 16:33 ` Carl Worth
2010-02-15 8:39 ` Using test-lib.sh under GPLv3? Michal Sojka
0 siblings, 1 reply; 36+ messages in thread
From: Carl Worth @ 2010-02-12 16:33 UTC (permalink / raw)
To: Michal Sojka, notmuch
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
On Fri, 12 Feb 2010 15:47:56 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> I'm not lawyer, but I'd say it should be no problem to use GPLv2 test
> suite to test your GPLv3 application. You are not linking them
> together.
Right. We could do that. But we'd have to be careful to document things
carefully to keep track of things, (which the current patches at least,
don't do).
> On the other hand, if you want the tests cases to be GPLv3 then you are
> probably right. Is this the case?
I think things are a lot simpler if we keep everything in the repository
under a single license. So I'd prefer that.
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Using test-lib.sh under GPLv3?
2010-02-12 16:33 ` Carl Worth
@ 2010-02-15 8:39 ` Michal Sojka
2010-02-16 10:27 ` Jakub Narebski
2010-02-16 20:54 ` Junio C Hamano
0 siblings, 2 replies; 36+ messages in thread
From: Michal Sojka @ 2010-02-15 8:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: notmuch, git
Dear Junio,
I like the simple and powerful test suite used by Git and I would like
to use something like that in Notmuch project (http://notmuchmail.org/).
Notmuch is licenced under GPLv3 and we think that things will be simpler
if everything in the repository is licenced the same. You are mentioned
as a copyright holder in test-lib.sh and t0000-basic.sh so I'd like to
ask you: Would you mind using parts of these files under GPLv3?
You can see the patches for how I'd like to use these files at
http://notmuchmail.org/pipermail/notmuch/2010/thread.html#1431
Thanks,
Michal
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-15 8:39 ` Using test-lib.sh under GPLv3? Michal Sojka
@ 2010-02-16 10:27 ` Jakub Narebski
2010-02-16 13:06 ` Michal Sojka
2010-02-16 20:54 ` Junio C Hamano
1 sibling, 1 reply; 36+ messages in thread
From: Jakub Narebski @ 2010-02-16 10:27 UTC (permalink / raw)
To: Michal Sojka; +Cc: notmuch, git, Junio C Hamano
Michal Sojka <sojkam1@fel.cvut.cz> writes:
> I like the simple and powerful test suite used by Git and I would like
> to use something like that in Notmuch project (http://notmuchmail.org/).
> Notmuch is licenced under GPLv3 and we think that things will be simpler
> if everything in the repository is licenced the same. You are mentioned
> as a copyright holder in test-lib.sh and t0000-basic.sh so I'd like to
> ask you: Would you mind using parts of these files under GPLv3?
Have you thought about using TAP (Test Anything Protocol) format for
your testsuite? Its page (http://testanything.org) has a TAP-producing
bash library: http://testanything.org/wiki/index.php/Tap-functions
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-16 10:27 ` Jakub Narebski
@ 2010-02-16 13:06 ` Michal Sojka
2010-02-16 22:07 ` Avery Pennarun
2010-02-17 0:26 ` Jakub Narebski
0 siblings, 2 replies; 36+ messages in thread
From: Michal Sojka @ 2010-02-16 13:06 UTC (permalink / raw)
To: Jakub Narebski; +Cc: notmuch, git, Junio C Hamano
On Tue, 16 Feb 2010 02:27:37 -0800 (PST), Jakub Narebski <jnareb@gmail.com> wrote:
> Michal Sojka <sojkam1@fel.cvut.cz> writes:
>
> > I like the simple and powerful test suite used by Git and I would like
> > to use something like that in Notmuch project (http://notmuchmail.org/).
> > [...]
>
> Have you thought about using TAP (Test Anything Protocol) format for
> your testsuite? Its page (http://testanything.org) has a TAP-producing
> bash library: http://testanything.org/wiki/index.php/Tap-functions
Yes, somebody has mentiond TAP on notmuch list. From a quick look at TAP
shell library it seems to me a bit more complex then git's library and
it also requires bash.
If we need to use some TAP-based tools, we could easily change the
output of git's library to conform to TAP. Right?
Michal
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-16 13:06 ` Michal Sojka
@ 2010-02-16 22:07 ` Avery Pennarun
2010-02-17 0:26 ` Jakub Narebski
1 sibling, 0 replies; 36+ messages in thread
From: Avery Pennarun @ 2010-02-16 22:07 UTC (permalink / raw)
To: Michal Sojka; +Cc: notmuch, git, Junio C Hamano, Jakub Narebski
On Tue, Feb 16, 2010 at 8:06 AM, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> On Tue, 16 Feb 2010 02:27:37 -0800 (PST), Jakub Narebski <jnareb@gmail.com> wrote:
>> Michal Sojka <sojkam1@fel.cvut.cz> writes:
>>
>> > I like the simple and powerful test suite used by Git and I would like
>> > to use something like that in Notmuch project (http://notmuchmail.org/).
>> > [...]
>>
>> Have you thought about using TAP (Test Anything Protocol) format for
>> your testsuite? Its page (http://testanything.org) has a TAP-producing
>> bash library: http://testanything.org/wiki/index.php/Tap-functions
>
> Yes, somebody has mentiond TAP on notmuch list. From a quick look at TAP
> shell library it seems to me a bit more complex then git's library and
> it also requires bash.
>
> If we need to use some TAP-based tools, we could easily change the
> output of git's library to conform to TAP. Right?
Another TAP-like option is wvtest:
http://github.com/apenwarr/wvtest
It's LGPLv2.
Have fun,
Avery
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-16 13:06 ` Michal Sojka
2010-02-16 22:07 ` Avery Pennarun
@ 2010-02-17 0:26 ` Jakub Narebski
1 sibling, 0 replies; 36+ messages in thread
From: Jakub Narebski @ 2010-02-17 0:26 UTC (permalink / raw)
To: Michal Sojka; +Cc: notmuch, git, Junio C Hamano
Dnia wtorek 16. lutego 2010 14:06, Michal Sojka napisał:
> On Tue, 16 Feb 2010 02:27:37 -0800 (PST), Jakub Narebski <jnareb@gmail.com> wrote:
> > Michal Sojka <sojkam1@fel.cvut.cz> writes:
> >
> > > I like the simple and powerful test suite used by Git and I would like
> > > to use something like that in Notmuch project (http://notmuchmail.org/).
> > > [...]
> >
> > Have you thought about using TAP (Test Anything Protocol) format for
> > your testsuite? Its page (http://testanything.org) has a TAP-producing
> > bash library: http://testanything.org/wiki/index.php/Tap-functions
>
> Yes, somebody has mentiond TAP on notmuch list. From a quick look at TAP
> shell library it seems to me a bit more complex then git's library and
> it also requires bash.
>
> If we need to use some TAP-based tools, we could easily change the
> output of git's library to conform to TAP. Right?
Or better yet improve git test suite, so when passed --tap parameter
it would produce TAP output, instead of its own report format. And
send patches here.
--
Jakub Narebski
Poland
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-15 8:39 ` Using test-lib.sh under GPLv3? Michal Sojka
2010-02-16 10:27 ` Jakub Narebski
@ 2010-02-16 20:54 ` Junio C Hamano
2010-02-19 8:19 ` Michal Sojka
1 sibling, 1 reply; 36+ messages in thread
From: Junio C Hamano @ 2010-02-16 20:54 UTC (permalink / raw)
To: Michal Sojka; +Cc: notmuch, git
Michal Sojka <sojkam1@fel.cvut.cz> writes:
> ... You are mentioned
> as a copyright holder in test-lib.sh and t0000-basic.sh so I'd like to
> ask you: Would you mind using parts of these files under GPLv3?
I don't mind for the parts I wrote, which is the basic infrastructure
(output redirection, skipping certain tests, expecting failure, etc).
My blessing would be enough to relicense it if you are are going to take
the file from some old version like 04ece59 (GIT_SKIP_TESTS: allow users
to omit tests that are known to break, 2006-12-28) and base your work on
it, but otherwise it would not be nearly sufficient.
Other people worked on polishing it over time and they all hold copyright
on their parts. Notable parts that are not mine and that are not git
specific are:
- color output support is mostly by Pierre Habouzit <madcoder@debian.org>
- valgrind support: Johannes Schindelin <johannes.schindelin@gmx.de>
- conditional test: Johannes Sixt <j6t@kdbg.org>
- summarizing the results: Sverre Rabbelier <srabbelier@gmail.com>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-16 20:54 ` Junio C Hamano
@ 2010-02-19 8:19 ` Michal Sojka
2010-02-19 8:44 ` Sverre Rabbelier
` (2 more replies)
0 siblings, 3 replies; 36+ messages in thread
From: Michal Sojka @ 2010-02-19 8:19 UTC (permalink / raw)
To: Pierre Habouzit, Johannes Schindelin, Johannes Sixt,
Sverre Rabbelier
Cc: notmuch, git
Dear Pierre, Johannes (2x) and Sverre,
as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
project. Do you mind if I use your work in that file under GPLv3?
Thanks
Michal
On Mon, 15 Feb 2010 09:39:28 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> Dear Junio,
>
> I like the simple and powerful test suite used by Git and I would like
> to use something like that in Notmuch project (http://notmuchmail.org/).
> Notmuch is licenced under GPLv3 and we think that things will be simpler
> if everything in the repository is licenced the same. You are mentioned
> as a copyright holder in test-lib.sh and t0000-basic.sh so I'd like to
> ask you: Would you mind using parts of these files under GPLv3?
>
> You can see the patches for how I'd like to use these files at
> http://notmuchmail.org/pipermail/notmuch/2010/thread.html#1431
On Tue, 16 Feb 2010 12:54:19 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> I don't mind for the parts I wrote, which is the basic infrastructure
> (output redirection, skipping certain tests, expecting failure, etc).
> My blessing would be enough to relicense it if you are are going to take
> the file from some old version like 04ece59 (GIT_SKIP_TESTS: allow users
> to omit tests that are known to break, 2006-12-28) and base your work on
> it, but otherwise it would not be nearly sufficient.
>
> Other people worked on polishing it over time and they all hold copyright
> on their parts. Notable parts that are not mine and that are not git
> specific are:
>
> - color output support is mostly by Pierre Habouzit <madcoder@debian.org>
> - valgrind support: Johannes Schindelin <johannes.schindelin@gmx.de>
> - conditional test: Johannes Sixt <j6t@kdbg.org>
> - summarizing the results: Sverre Rabbelier <srabbelier@gmail.com>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-19 8:19 ` Michal Sojka
@ 2010-02-19 8:44 ` Sverre Rabbelier
2010-02-19 10:39 ` Johannes Schindelin
2010-02-19 17:36 ` Using test-lib.sh under GPLv3? Johannes Sixt
2 siblings, 0 replies; 36+ messages in thread
From: Sverre Rabbelier @ 2010-02-19 8:44 UTC (permalink / raw)
To: Michal Sojka
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, notmuch, git
Heya,
On Fri, Feb 19, 2010 at 09:19, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
> project. Do you mind if I use your work in that file under GPLv3?
I don't mind, go right ahead :).
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-19 8:19 ` Michal Sojka
2010-02-19 8:44 ` Sverre Rabbelier
@ 2010-02-19 10:39 ` Johannes Schindelin
2010-02-19 17:15 ` Pierre Habouzit
2010-02-19 19:01 ` Carl Worth
2010-02-19 17:36 ` Using test-lib.sh under GPLv3? Johannes Sixt
2 siblings, 2 replies; 36+ messages in thread
From: Johannes Schindelin @ 2010-02-19 10:39 UTC (permalink / raw)
To: Michal Sojka
Cc: Johannes Sixt, Pierre Habouzit, Sverre Rabbelier, notmuch, git
Hi,
On Fri, 19 Feb 2010, Michal Sojka wrote:
> as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
> project. Do you mind if I use your work in that file under GPLv3?
I do not mind, but I would like to ask that you contribute the
improvements back under GPLv2.
Thanks,
Johannes
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-19 10:39 ` Johannes Schindelin
@ 2010-02-19 17:15 ` Pierre Habouzit
2010-02-19 19:01 ` Carl Worth
1 sibling, 0 replies; 36+ messages in thread
From: Pierre Habouzit @ 2010-02-19 17:15 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Johannes Sixt, Sverre Rabbelier, notmuch, git
On Fri, Feb 19, 2010 at 11:39:04AM +0100, Johannes Schindelin wrote:
> Hi,
>
> On Fri, 19 Feb 2010, Michal Sojka wrote:
>
> > as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
> > project. Do you mind if I use your work in that file under GPLv3?
>
> I do not mind, but I would like to ask that you contribute the
> improvements back under GPLv2.
Same for me.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-19 10:39 ` Johannes Schindelin
2010-02-19 17:15 ` Pierre Habouzit
@ 2010-02-19 19:01 ` Carl Worth
2010-02-19 21:04 ` Johannes Schindelin
1 sibling, 1 reply; 36+ messages in thread
From: Carl Worth @ 2010-02-19 19:01 UTC (permalink / raw)
To: Johannes Schindelin, Michal Sojka
Cc: Johannes Sixt, notmuch, Pierre Habouzit, git, Sverre Rabbelier
[-- Attachment #1: Type: text/plain, Size: 978 bytes --]
On Fri, 19 Feb 2010 11:39:04 +0100 (CET), Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Fri, 19 Feb 2010, Michal Sojka wrote:
>
> > as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
> > project. Do you mind if I use your work in that file under GPLv3?
>
> I do not mind, but I would like to ask that you contribute the
> improvements back under GPLv2.
Thanks everyone for your agreement.
And yes, we'll contribute back any improvements under GPLv2.
I think the most clear step forward would be for test-lib.sh to be
updated in the git repository with an explicit licensing blurb
reflecting this agreement. The most convenient would be something using
the standard language of "either version 2 of the License, or (at your
option) any later version".
Then, any generic improvements we make within notmuch, (such as a --tap
option or whatever), I'll be sure to pass on to the git community.
Thanks again,
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-19 19:01 ` Carl Worth
@ 2010-02-19 21:04 ` Johannes Schindelin
2010-02-20 19:55 ` [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+ Carl Worth
0 siblings, 1 reply; 36+ messages in thread
From: Johannes Schindelin @ 2010-02-19 21:04 UTC (permalink / raw)
To: Carl Worth; +Cc: Johannes Sixt, Pierre Habouzit, Sverre Rabbelier, notmuch, git
Hi,
On Fri, 19 Feb 2010, Carl Worth wrote:
> On Fri, 19 Feb 2010 11:39:04 +0100 (CET), Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > On Fri, 19 Feb 2010, Michal Sojka wrote:
> >
> > > as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
> > > project. Do you mind if I use your work in that file under GPLv3?
> >
> > I do not mind, but I would like to ask that you contribute the
> > improvements back under GPLv2.
>
> Thanks everyone for your agreement.
>
> And yes, we'll contribute back any improvements under GPLv2.
>
> I think the most clear step forward would be for test-lib.sh to be
> updated in the git repository with an explicit licensing blurb
> reflecting this agreement.
Sure. If you make an appropriate patch, I'll ACK it.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-19 21:04 ` Johannes Schindelin
@ 2010-02-20 19:55 ` Carl Worth
2010-02-20 21:28 ` Junio C Hamano
` (3 more replies)
0 siblings, 4 replies; 36+ messages in thread
From: Carl Worth @ 2010-02-20 19:55 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Johannes Sixt, Pierre Habouzit, Sverre Rabbelier, notmuch, git
[-- Attachment #1: Type: text/plain, Size: 2194 bytes --]
This file has had no explicit license information noted in it, but
has clearly been created and modified according to the terms of GPLv2
as with the rest of the git code base.
The purpose of relicensing is to allow other GPLv3+ projects (in
particular, the notmuch project: http://notmuchmail.org) to use this
same test-suite structure (and to contribute changes back as well).
The request for relicensing was presented to the git community in:
Message-ID: <871vgmki4f.fsf@steelpick.localdomain>
and explicitly agreed to by Junio C Hamano, Sverre Rabbelier, Johannes
Schindelin, Pierre Habouzit, and Johannes Sixt.
---
On Fri, 19 Feb 2010 22:04:37 +0100 (CET), Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Fri, 19 Feb 2010, Carl Worth wrote:
>
> > I think the most clear step forward would be for test-lib.sh to be
> > updated in the git repository with an explicit licensing blurb
> > reflecting this agreement.
>
> Sure. If you make an appropriate patch, I'll ACK it.
Thanks Johannes,
Hopefully this does the trick. Otherwise, please let me know.
-Carl
t/test-lib.sh | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index afd3053..004470f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -2,6 +2,18 @@
#
# Copyright (c) 2005 Junio C Hamano
#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/ .
# if --tee was passed, write the output not only to the terminal, but
# additionally to the file test-results/$BASENAME.out, too.
--
1.6.5.7
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-20 19:55 ` [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+ Carl Worth
@ 2010-02-20 21:28 ` Junio C Hamano
2010-02-22 19:26 ` Carl Worth
2010-02-20 21:49 ` Tay Ray Chuan
` (2 subsequent siblings)
3 siblings, 1 reply; 36+ messages in thread
From: Junio C Hamano @ 2010-02-20 21:28 UTC (permalink / raw)
To: Carl Worth
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git, notmuch,
Sverre Rabbelier
Carl Worth <cworth@cworth.org> writes:
> This file has had no explicit license information noted in it, but
> has clearly been created and modified according to the terms of GPLv2
> as with the rest of the git code base.
>
> The purpose of relicensing is to allow other GPLv3+ projects (in
> particular, the notmuch project: http://notmuchmail.org) to use this
> same test-suite structure (and to contribute changes back as well).
Please drop the parentheses around the last phrase (but not the last
phrase itself).
> The request for relicensing was presented to the git community in:
>
> Message-ID: <871vgmki4f.fsf@steelpick.localdomain>
Message-ID alone is not a good way to help people locate the request.
Please at least mention what mailing list the message was sent to; better
yet, do so like this:
http://thread.gmane.org/gmane.mail.notmuch.general/1389/focus=140156
so that people can see the consent from the primary author (that is where
the focus is), the original request (that can be seen by looking at its
immediate parent), and messages with consent from other contributors, all
in one place.
> and explicitly agreed to by Junio C Hamano, Sverre Rabbelier, Johannes
> Schindelin, Pierre Habouzit, and Johannes Sixt.
> ---
And a sign-off ;-).
Thanks.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-20 21:28 ` Junio C Hamano
@ 2010-02-22 19:26 ` Carl Worth
2010-02-23 3:42 ` Junio C Hamano
0 siblings, 1 reply; 36+ messages in thread
From: Carl Worth @ 2010-02-22 19:26 UTC (permalink / raw)
To: Junio C Hamano
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git, notmuch,
Sverre Rabbelier
[-- Attachment #1: Type: text/plain, Size: 3379 bytes --]
From 8693995fde71e8b028318e1e83bdbb6ae759335a Mon Sep 17 00:00:00 2001
From: Carl Worth <cworth@cworth.org>
Date: Sat, 20 Feb 2010 11:41:24 -0800
Subject: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
This file has had no explicit license information noted in it, but
has clearly been created and modified according to the terms of GPLv2
as with the rest of the git code base.
The purpose of relicensing is to allow other GPLv3+ projects (in
particular, the notmuch project: http://notmuchmail.org) to use this
same test-suite structure and to contribute changes back as well.
The relicensing was agreed to by Junio C Hamano here:
http://thread.gmane.org/gmane.mail.notmuch.general/1389/focus=140156
and in follow-up messages by Sverre Rabbelier, Johannes Schindelin,
Pierre Habouzit, and Johannes Sixt.
Signed-off-by: Carl Worth <cworth@cworth.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
> Message-ID alone is not a good way to help people locate the request.
> Please at least mention what mailing list the message was sent to; better
> yet, do so like this:
Done as requested.
But while we're on the subject, let me at least make a case for
communication by way of Message-ID. The URL above is good for as long as
gmane continues to live, but that may not be as long as the git project
(and its mailing-list archives) are interesting.
Meanwhile, a message ID lives forever and can be used in multiple
contexts. For example, gmane does already support message-ID-based URLs:
http://mid.gmane.org/7vaav3bnr5.fsf@alter.siamese.dyndns.org
That interface happens to only display the single message, (requiring
clicking on the subject to see the thread), but one can imagine gmane
getting a similar interface to display the thread directly from the
message ID.
Meanwhile, people using systems like notmuch can also use the message ID
directly to view the thread, with something like:
notmuch show id:7vaav3bnr5.fsf@alter.siamese.dyndns.org
So I'm very much in favor of using message IDs more regularly, (and just
expecting that users and their tools will be more accepting of them).
But for now, you've hopefully got your commit message the way you want
it. :-)
t/test-lib.sh | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index afd3053..004470f 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -2,6 +2,18 @@
#
# Copyright (c) 2005 Junio C Hamano
#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/ .
# if --tee was passed, write the output not only to the terminal, but
# additionally to the file test-results/$BASENAME.out, too.
--
1.6.5.7
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-22 19:26 ` Carl Worth
@ 2010-02-23 3:42 ` Junio C Hamano
2010-02-23 3:51 ` Tay Ray Chuan
` (2 more replies)
0 siblings, 3 replies; 36+ messages in thread
From: Junio C Hamano @ 2010-02-23 3:42 UTC (permalink / raw)
To: Carl Worth
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git,
Junio C Hamano, notmuch, Sverre Rabbelier
Carl Worth <cworth@cworth.org> writes:
> From 8693995fde71e8b028318e1e83bdbb6ae759335a Mon Sep 17 00:00:00 2001
> From: Carl Worth <cworth@cworth.org>
> Date: Sat, 20 Feb 2010 11:41:24 -0800
> Subject: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
Please drop the above the next time.
> The relicensing was agreed to by Junio C Hamano here:
>
> http://thread.gmane.org/gmane.mail.notmuch.general/1389/focus=140156
>
> and in follow-up messages by Sverre Rabbelier, Johannes Schindelin,
> Pierre Habouzit, and Johannes Sixt.
FWIW, I only said "_at least_ you need consent from them", and it was not
meant to be an exhaustive list. "blame -C -C -C" may tell you more.
You are the party that wants this relicensing, not me. Please do not
burden me with excessive legwork for you, but help me a bit more
proactively to make this happen.
> Meanwhile, a message ID lives forever and can be used in multiple
> contexts.
Oh, I never said "do not use message ID". I said "message ID alone is not
good enough for most people". Users of gmane and notmuch who know the
tool they use would benefit from having message ID, _too_, but even if you
were a user of notmuch, unless you have subscribed to the list and have
your own archive, you wouldn't be able to say "show id:frotz".
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-23 3:42 ` Junio C Hamano
@ 2010-02-23 3:51 ` Tay Ray Chuan
2010-02-23 9:21 ` Johannes Schindelin
2010-02-23 6:48 ` Matthieu Moy
2010-02-23 18:23 ` Carl Worth
2 siblings, 1 reply; 36+ messages in thread
From: Tay Ray Chuan @ 2010-02-23 3:51 UTC (permalink / raw)
To: Junio C Hamano
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git, notmuch,
Sverre Rabbelier
Hi,
On Tue, Feb 23, 2010 at 11:42 AM, Junio C Hamano <gitster@pobox.com> wrote:
> FWIW, I only said "_at least_ you need consent from them", and it was not
> meant to be an exhaustive list. "blame -C -C -C" may tell you more.
Without substantial analysis, "blame" alone is not sufficient - it
does not show which work was original, or derivative.
--
Cheers,
Ray Chuan
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-23 3:51 ` Tay Ray Chuan
@ 2010-02-23 9:21 ` Johannes Schindelin
0 siblings, 0 replies; 36+ messages in thread
From: Johannes Schindelin @ 2010-02-23 9:21 UTC (permalink / raw)
To: Tay Ray Chuan
Cc: Johannes Sixt, Pierre Habouzit, git, Junio C Hamano, notmuch,
Sverre Rabbelier
[-- Attachment #1: Type: TEXT/PLAIN, Size: 779 bytes --]
Hi,
On Tue, 23 Feb 2010, Tay Ray Chuan wrote:
> On Tue, Feb 23, 2010 at 11:42 AM, Junio C Hamano <gitster@pobox.com>
> wrote:
> > FWIW, I only said "_at least_ you need consent from them", and it was
> > not meant to be an exhaustive list. "blame -C -C -C" may tell you
> > more.
>
> Without substantial analysis, "blame" alone is not sufficient - it does
> not show which work was original, or derivative.
Well, I think that blame can get you very, very far. For example, you will
see that Josh Triplett's only (surviving) contribution to test-lib.sh is a
single line saying "unset MAIL", which is too trivial to be copyrightable
(and if it was not trivial, it still would be the only way to accomplish
what it does, so it is again not copyrightable).
Ciao,
Dscho
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-23 3:42 ` Junio C Hamano
2010-02-23 3:51 ` Tay Ray Chuan
@ 2010-02-23 6:48 ` Matthieu Moy
2010-02-23 18:23 ` Carl Worth
2 siblings, 0 replies; 36+ messages in thread
From: Matthieu Moy @ 2010-02-23 6:48 UTC (permalink / raw)
To: Junio C Hamano
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git, notmuch,
Sverre Rabbelier
Junio C Hamano <gitster@pobox.com> writes:
>> http://thread.gmane.org/gmane.mail.notmuch.general/1389/focus=140156
[...]
>> Meanwhile, a message ID lives forever and can be used in multiple
>> contexts.
>
> Oh, I never said "do not use message ID". I said "message ID alone is not
> good enough for most people".
FWIW, gmane allows links of the form
http://mid.gmane.org/7vaav8hpfo.fsf@alter.siamese.dyndns.org
which have the advantage of being simple to use, and still contain the
necessary information to get the message in case gmane dies.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-23 3:42 ` Junio C Hamano
2010-02-23 3:51 ` Tay Ray Chuan
2010-02-23 6:48 ` Matthieu Moy
@ 2010-02-23 18:23 ` Carl Worth
2 siblings, 0 replies; 36+ messages in thread
From: Carl Worth @ 2010-02-23 18:23 UTC (permalink / raw)
To: Junio C Hamano
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git,
Junio C Hamano, notmuch, Sverre Rabbelier
[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]
On Mon, 22 Feb 2010 19:42:30 -0800, Junio C Hamano <gitster@pobox.com> wrote:
> Please drop the above the next time.
Oops. Yes, I missed that.
> FWIW, I only said "_at least_ you need consent from them", and it was not
> meant to be an exhaustive list. "blame -C -C -C" may tell you more.
Fair enough.
> You are the party that wants this relicensing, not me. Please do not
> burden me with excessive legwork for you, but help me a bit more
> proactively to make this happen.
I hope you see I haven't asked you to do any additional legwork. A
suggestion was made to construct a patch, which I did. You always have
the option of accepting or rejecting the patch as you see fit.
> Oh, I never said "do not use message ID". I said "message ID alone is not
> good enough for most people". Users of gmane and notmuch who know the
> tool they use would benefit from having message ID, _too_, but even if you
> were a user of notmuch, unless you have subscribed to the list and have
> your own archive, you wouldn't be able to say "show id:frotz".
Certainly. My assumption was that in a commit message for git, readers
would naturally assume that a message ID with no additional
specification could be found in the archives of the standard git mailing
list, (which is the case here). Otherwise, I would have qualified the
message ID more specifically.
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-20 19:55 ` [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+ Carl Worth
2010-02-20 21:28 ` Junio C Hamano
@ 2010-02-20 21:49 ` Tay Ray Chuan
2010-02-20 22:22 ` Johannes Schindelin
2010-04-06 17:01 ` Michal Sojka
3 siblings, 0 replies; 36+ messages in thread
From: Tay Ray Chuan @ 2010-02-20 21:49 UTC (permalink / raw)
To: Carl Worth
Cc: Johannes Sixt, Johannes Schindelin, Pierre Habouzit, git, notmuch,
Sverre Rabbelier
Hi,
On Sun, Feb 21, 2010 at 3:55 AM, Carl Worth <cworth@cworth.org> wrote:
> The request for relicensing was presented to the git community in:
>
> Message-ID: <871vgmki4f.fsf@steelpick.localdomain>
>
> and explicitly agreed to by Junio C Hamano, Sverre Rabbelier, Johannes
> Schindelin, Pierre Habouzit, and Johannes Sixt.
(of all projects, Mercurial!) take a look at Mercurial's attempt at
relicensing last year (http://mercurial.selenic.com/wiki/Relicensing):
they contacted all 300+ contributors as part of the process.
Of course, we aren't talking about relicensing the whole codebase.
However, I don't think any of the contributors agreed to assign their
work to the 5 people mentioned above (eg. under a contributor licence
agreement), so just getting the approval of them is not enough; you
need to get the approval of *all* contributors to test-lib.sh.
Here's what I get with 'git shortlog t/test-lib.sh | grep "^[A-Z]"'
Alex Riesen (5):
Brandon Casey (2):
Bryan Donlan (3):
Carl Worth (1):
Christian Couder (1):
Clemens Buchacher (3):
David Reiss (1):
Emil Sit (1):
Eric Wong (3):
Fredrik Kuivinen (1):
Gerrit Pape (1):
Jakub Narebski (1):
Jeff King (7):
Johan Herland (1):
Johannes Schindelin (14):
Johannes Sixt (12):
Jonathan Nieder (1):
Josh Triplett (1):
Junio C Hamano (57):
Lea Wiemann (5):
Markus Heidelberg (1):
Martin Waitz (1):
Matthew Ogilvie (1):
Matthias Lederhofer (1):
Michael J Gruber (4):
Michele Ballabio (2):
Miklos Vajna (1):
Nicolas Pitre (1):
Pavel Roskin (3):
Petr Baudis (3):
Pierre Habouzit (2):
Robin Rosenberg (1):
Shawn O. Pearce (4):
Stephan Beyer (1):
Stephen Boyd (1):
Sverre Rabbelier (2):
PS: This message should not be construed as legal advice.
--
Cheers,
Ray Chuan
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-20 19:55 ` [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+ Carl Worth
2010-02-20 21:28 ` Junio C Hamano
2010-02-20 21:49 ` Tay Ray Chuan
@ 2010-02-20 22:22 ` Johannes Schindelin
2010-04-06 17:01 ` Michal Sojka
3 siblings, 0 replies; 36+ messages in thread
From: Johannes Schindelin @ 2010-02-20 22:22 UTC (permalink / raw)
To: Carl Worth; +Cc: Johannes Sixt, Pierre Habouzit, Sverre Rabbelier, notmuch, git
Hi,
On Sat, 20 Feb 2010, Carl Worth wrote:
> This file has had no explicit license information noted in it, but
> has clearly been created and modified according to the terms of GPLv2
> as with the rest of the git code base.
>
> The purpose of relicensing is to allow other GPLv3+ projects (in
> particular, the notmuch project: http://notmuchmail.org) to use this
> same test-suite structure (and to contribute changes back as well).
>
> The request for relicensing was presented to the git community in:
>
> Message-ID: <871vgmki4f.fsf@steelpick.localdomain>
>
> and explicitly agreed to by Junio C Hamano, Sverre Rabbelier, Johannes
> Schindelin, Pierre Habouzit, and Johannes Sixt.
As promised:
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Ciao,
Dscho
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-02-20 19:55 ` [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+ Carl Worth
` (2 preceding siblings ...)
2010-02-20 22:22 ` Johannes Schindelin
@ 2010-04-06 17:01 ` Michal Sojka
2010-04-15 18:08 ` Carl Worth
3 siblings, 1 reply; 36+ messages in thread
From: Michal Sojka @ 2010-04-06 17:01 UTC (permalink / raw)
To: Carl Worth, notmuch
On Sat, 20 Feb 2010, Carl Worth wrote:
> This file has had no explicit license information noted in it, but
> has clearly been created and modified according to the terms of GPLv2
> as with the rest of the git code base.
>
> The purpose of relicensing is to allow other GPLv3+ projects (in
> particular, the notmuch project: http://notmuchmail.org) to use this
> same test-suite structure (and to contribute changes back as well).
Hi Carl,
here is my report of git's test-lib relicensing. The following is the
last list sent to me by Junio. I guess you have this information
somewhere in your mailbox as well.
Acked-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Brandon Casey <drafnel@gmail.com>
Acked-by: David Reiss <dreiss@facebook.com>
Acked-by: Emil Sit <sit@emilsit.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Lea Wiemann <lewiemann@gmail.com>
Acked-by: Markus Heidelberg <markus.heidelberg@web.de>
Acked-by: Martin Waitz <tali@admingilde.org>
Acked-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Acked-by: Michele Ballabio <barra_cuda@katamail.com>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Acked-by: Pavel Roskin <proski@gnu.org>
Acked-by: Petr Baudis <pasky@ucw.cz>
Acked-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
According to https://git.wiki.kernel.org/index.php/Test-lib_reclicensing
we can add there the following lines:
Acked-by: Clemens Buchacher <drizzd@aon.at>
Acked-by: Fredrik Kuivinen <frekui@gmail.com>
Acked-by: Gerrit Pape <pape@smarden.org>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Johan Herland <johan@herland.net>
Acked-by: Matthias Lederhofer <matled@gmx.net>
Acked-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Thomas Rast <trast@student.ethz.ch>
There are three contributors who didn't respond to me. The contributions
of two of them are clearly not copyrightable (Stephan Beyer and Bert
Wesarg - see the links to commits in the wiki). The last contributor is
Bryan Donlan who fix a few quoting problems which are quite simple but I
do not have any clue whether this is copyrightable or not
(see gitk --author='Bryan Donlan' t/test-lib.sh).
Junio was talking about only three missing Acks so I guess he already
did some filtering based on copyrightability. Do you know which three
Acks were missing according to Junio and whether these are in my list?
Thanks
Michal
>
> The request for relicensing was presented to the git community in:
>
> Message-ID: <871vgmki4f.fsf@steelpick.localdomain>
>
> and explicitly agreed to by Junio C Hamano, Sverre Rabbelier, Johannes
> Schindelin, Pierre Habouzit, and Johannes Sixt.
>
> t/test-lib.sh | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index afd3053..004470f 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -2,6 +2,18 @@
> #
> # Copyright (c) 2005 Junio C Hamano
> #
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation, either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see http://www.gnu.org/licenses/ .
>
> # if --tee was passed, write the output not only to the terminal, but
> # additionally to the file test-results/$BASENAME.out, too.
> --
> 1.6.5.7
>
Non-text part: application/pgp-signature
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] test-lib.sh: Add explicit license detail, with change from GPLv2 to GPLv2+.
2010-04-06 17:01 ` Michal Sojka
@ 2010-04-15 18:08 ` Carl Worth
0 siblings, 0 replies; 36+ messages in thread
From: Carl Worth @ 2010-04-15 18:08 UTC (permalink / raw)
To: Michal Sojka, notmuch
[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]
On Tue, 06 Apr 2010 19:01:07 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> here is my report of git's test-lib relicensing. The following is the
> last list sent to me by Junio. I guess you have this information
> somewhere in your mailbox as well.
Hi Michal,
Thanks for following up with this.
> There are three contributors who didn't respond to me. The contributions
> of two of them are clearly not copyrightable (Stephan Beyer and Bert
> Wesarg - see the links to commits in the wiki). The last contributor is
> Bryan Donlan who fix a few quoting problems which are quite simple but I
> do not have any clue whether this is copyrightable or not
> (see gitk --author='Bryan Donlan' t/test-lib.sh).
>
> Junio was talking about only three missing Acks so I guess he already
> did some filtering based on copyrightability. Do you know which three
> Acks were missing according to Junio and whether these are in my list?
It seems you've done a careful job and I appreciate that. I don't know
any more details about what Junio was expecting. And he's really the one
you should approach at this point.
I do not plan to accept this source into our tree until the git project
itself has accepted the license change on its own. So if the above
analysis satisfies Junio, and he accepts the patch, then we can take it.
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Using test-lib.sh under GPLv3?
2010-02-19 8:19 ` Michal Sojka
2010-02-19 8:44 ` Sverre Rabbelier
2010-02-19 10:39 ` Johannes Schindelin
@ 2010-02-19 17:36 ` Johannes Sixt
2 siblings, 0 replies; 36+ messages in thread
From: Johannes Sixt @ 2010-02-19 17:36 UTC (permalink / raw)
To: Michal Sojka
Cc: Pierre Habouzit, Johannes Schindelin, Sverre Rabbelier, notmuch,
git
Michal Sojka schrieb:
> as you can read bellow, I'd like to use git's test-lib.sh in a GPLv3
> project. Do you mind if I use your work in that file under GPLv3?
I do not mind. Go ahead.
-- Hannes
^ permalink raw reply [flat|nested] 36+ messages in thread