summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
AgeCommit message (Collapse)Author
2007-07-31Unset GIT_EDITOR while running tests.Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-01Merge branch 'ei/worktree+filter'Junio C Hamano
* ei/worktree+filter: filter-branch: always export GIT_DIR if it is set setup_git_directory: fix segfault if repository is found in cwd test GIT_WORK_TREE extend rev-parse test for --is-inside-work-tree Use new semantics of is_bare/inside_git_dir/inside_work_tree introduce GIT_WORK_TREE to specify the work tree test git rev-parse rev-parse: introduce --is-bare-repository rev-parse: document --is-inside-git-dir
2007-06-07War on whitespaceJunio C Hamano
This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06introduce GIT_WORK_TREE to specify the work treeMatthias Lederhofer
setup_gdg is used as abbreviation for setup_git_directory_gently. The work tree can be specified using the environment variable GIT_WORK_TREE and the config option core.worktree (the environment variable has precendence over the config option). Additionally there is a command line option --work-tree which sets the environment variable. setup_gdg does the following now: GIT_DIR unspecified repository in .git directory parent directory of the .git directory is used as work tree, GIT_WORK_TREE is ignored GIT_DIR unspecified repository in cwd GIT_DIR is set to cwd see the cases with GIT_DIR specified what happens next and also see the note below GIT_DIR specified GIT_WORK_TREE/core.worktree unspecified cwd is used as work tree GIT_DIR specified GIT_WORK_TREE/core.worktree specified the specified work tree is used Note on the case where GIT_DIR is unspecified and repository is in cwd: GIT_WORK_TREE is used but is_inside_git_dir is always true. I did it this way because setup_gdg might be called multiple times (e.g. when doing alias expansion) and in successive calls setup_gdg should do the same thing every time. Meaning of is_bare/is_inside_work_tree/is_inside_git_dir: (1) is_bare_repository A repository is bare if core.bare is true or core.bare is unspecified and the name suggests it is bare (directory not named .git). The bare option disables a few protective checks which are useful with a working tree. Currently this changes if a repository is bare: updates of HEAD are allowed git gc packs the refs the reflog is disabled by default (2) is_inside_work_tree True if the cwd is inside the associated working tree (if there is one), false otherwise. (3) is_inside_git_dir True if the cwd is inside the git directory, false otherwise. Before this patch is_inside_git_dir was always true for bare repositories. When setup_gdg finds a repository git_config(git_default_config) is always called. This ensure that is_bare_repository makes use of core.bare and does not guess even though core.bare is specified. inside_work_tree and inside_git_dir are set if setup_gdg finds a repository. The is_inside_work_tree and is_inside_git_dir functions will die if they are called before a successful call to setup_gdg. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-04-29Fall back to $EMAIL for missing GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAILJosh Triplett
Some other programs get the user's email address from $EMAIL, so fall back to that if we don't have a Git-specific email address. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-24t/test-lib.sh: Protect ourselves from common misconfigurationJunio C Hamano
that exports CDPATH to the environment Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16Fix permissions on test scriptsAlex Riesen
Make every test executable. Remove exec-attribute from included shell files, they can't used standalone anyway. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25Update tests to use test-chmtimeEric Wong
test-lib: Make sure test-chmtime has been built before starting. t4200-rerere: Removed non-portable date dependency and avoid touch Avoid "test -a" which isn't portable, either lib-git-svn: Use test-chmtime instead of Perl one-liner to poke Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-23Make tests independent of global config filesJohannes Schindelin
This was done by setting $HOME to somewhere bogus. A better method is to reuse $GIT_CONFIG, which was invented for ignoring the global config file explicitely. Technically, setting GIT_CONFIG=.git/config could be wrong, but it passes all the tests, and we can keep the tests that way. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-04Default GIT_MERGE_VERBOSITY to 5 during tests.Shawn O. Pearce
Its really nice to be able to run a test with -v and automatically see the "debugging" dump from merge-recursive, especially if we are actually trying to debug merge-recursive. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12use 'init' instead of 'init-db' for shipped docs and toolsNicolas Pitre
While 'init-db' still is and probably will always remain a valid git command for obvious backward compatibility reasons, it would be a good idea to move shipped tools and docs to using 'init' instead. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06Fix timestamp for test-tickJunio C Hamano
The earlier test timestamp was too old; I forgot that the bare unixtime integer had to be after Jan 1, 2000. This changes test_tick to use the git-epoch timestamp. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-29t5400 send-pack test: try a bit more nontrivial transfer.Junio C Hamano
Not that this reveals anything new, but I did test_tick shell function in test-lib and found it rather cute and nice. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-29GIT_SKIP_TESTS: allow users to omit tests that are known to breakJunio C Hamano
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 $ cd t $ GIT_SKIP_TESTS=t9200.8 t9200-git-cvsexport-commit.sh and even: $ GIT_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make test 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. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28test-lib: quiet down init-db output for testsEric Wong
I don't think anybody running tests needs to know they're running init-db and creating a repository for testing. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-19Introduce GIT_TEMPLATE_DIRJohannes Schindelin
Instead of passing --template explicitely to init-db and clone, you can just set the environment variable GIT_TEMPLATE_DIR. Also make use of it in the tests, to make sure that the templates are copied. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-19Revert "fix testsuite: make sure they use templates freshly built from the ↵Junio C Hamano
source" This reverts commit 74d20040cafdced657efbf49795183d209a3a07b. Version from Johannes to introduce GIT_TEMPLATE_DIR is simpler, although I unconsciously stayed away from introducing yet another environment variable.
2006-12-19fix testsuite: make sure they use templates freshly built from the sourceJunio C Hamano
The initial t/trash repository for testing was created properly but over time we gained many tests that create secondary test repositories with init-db or clone and they were not careful enough. This fixes it. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-22remove merge-recursive-oldJunio C Hamano
This frees the Porcelain-ish that comes with the core Python-free. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-13test-lib.sh: A command dying due to a signal is an unexpected failure.Johannes Sixt
When test_expect_failure detects that a command failed, it still has to treat a program that crashed from a signal as unexpected failure. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-24Set $HOME for selftestsGerrit Pape
Set HOME environment variable to test trash directory and export for selftests. This fixes the git-svn selftests with nonexistent or not readable home, as found in at least one automated build system: http://buildd.debian.org/fetch.cgi?&pkg=git-core&ver=1%3A1.4.2.3-2&arch=alpha&stamp=1161537466&file=log Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-08test-lib: separate individual test better in verbose mode.Martin Waitz
When running tests with --verbose it is difficult to see where one test starts and where it ends because everything is printed in one big lump. Fix that by printing one single newline between each test. Signed-off-by: Martin Waitz <tali@admingilde.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-01Merge branch 'jc/gitpm'Junio C Hamano
* jc/gitpm: (52 commits) Remove -fPIC which was only needed for Git.xs Git.pm: Kill Git.xs for now Revert "Make it possible to set up libgit directly (instead of from the environment)" Revert "Git.pm: Introduce fast get_object() method" Revert "Convert git-annotate to use Git.pm" Fix compilation with Sun CC pass DESTDIR to the generated perl/Makefile Eliminate Scalar::Util usage from private-Error.pm Convert git-annotate to use Git.pm Git.pm: Introduce fast get_object() method Make it possible to set up libgit directly (instead of from the environment) Work around sed and make interactions on the backslash at the end of line. Git.pm: Introduce ident() and ident_person() methods Convert git-send-email to use Git.pm Git.pm: Add config() method Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging INSTALL: a tip for running after building but without installing. Perly Git: make sure we do test the freshly built one. Git.pm: Don't #define around die Git.xs: older perl do not know const char * ...
2006-09-25Deprecate merge-recursive.pyJunio C Hamano
This renames merge-recursive written in Python to merge-recursive-old, and makes merge-recur as a synonym to merge-recursive. We do not remove merge-recur yet, but we will remove merge-recur and merge-recursive-old in a few releases down the road. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-23Quote arguments to tr in test-libRobin Rosenberg
When there are single-character filenames in the test directory, the shell tries to expand regexps meant for tr. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02Trace into a file or an open fd and refactor tracing code.Christian Couder
If GIT_TRACE is set to an absolute path (starting with a '/' character), we interpret this as a file path and we trace into it. Also if GIT_TRACE is set to an integer value greater than 1 and lower than 10, we interpret this as an open fd value and we trace into it. Note that this behavior is not compatible with the previous one. We also trace whole messages using one write(2) call to make sure messages from processes do net get mixed up in the middle. This patch makes it possible to get trace information when running "make test". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-08Merge branch 'master' into pb/gitpmJunio C Hamano
This is to resolve the conflicts with Ryan's annotate updates early.
2006-07-13Merge branch 'ml/trace'Junio C Hamano
* ml/trace: test-lib: unset GIT_TRACE GIT_TRACE: fix a mixed declarations and code warning GIT_TRACE: show which built-in/external commands are executed
2006-07-13test-lib: unset GIT_TRACEJunio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-11tests: Set EDITOR=: and VISUAL=: globallyEric Wong
This way we don't have to remember to set it for each test; and if we forget, we won't cause interactive editors to be spawned for non-interactive tests. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-04Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC mungingPetr Baudis
This makes the Git perl scripts check $GITPERLLIB instead of $RUNNING_GIT_TESTS, which makes more sense if you are setting up your shell environment to use a non-installed Git instance. It also weeds out the @INC munging from the individual scripts and makes Makefile add it during the .perl files processing, so that we can change just a single place when we modify this shared logic. It looks ugly in the scripts, too. ;-) And instead of doing arcane things with the @INC array, we just do 'use lib' instead, which is essentialy the same thing anyway. I first want to do three separate patches but it turned out that it's quite a lot neater when bundled together, so I hope it's ok. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-03Perly Git: make sure we do test the freshly built one.Junio C Hamano
We could BEGIN { push @INC, '@@INSTLIBDIR@@'; } but that is not a good idea for normal execution. The would prevent a workaround for a user who is trying to override an old, faulty Git.pm installed on the system path with a newer version installed under $HOME/. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-03Perl interface: make testsuite work again.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21Merge part of jc/portable branchJunio C Hamano
2006-02-19Optionally work without pythonJohannes Schindelin
In some setups (notably server setups) you do not need that dependency. Gracefully handle the absence of python when NO_PYTHON is defined. Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18Abstract test_create_repo out for use in tests.Carl Worth
Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-11Define GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL) to known values.Junio C Hamano
Without these, running tests with an account with empty gecos field would fail. We might want to loosen error from "git-var -l" (but not "git-var GIT_AUTHOR_NAME") later, but that is more or less an independent issue. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-06trivial: check, if t/trash directory was successfully createdAlex Riesen
and was successfully entered. Otherwise git-init-db will create it directly in the working directory (t/) which can be dangerous. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-15get_sha1_basic(): corner case ambiguity fixJunio C Hamano
When .git/refs/heads/frotz and .git/refs/tags/frotz existed, and the object name stored in .git/refs/heads/frotz were corrupt, we ended up picking tags/frotz without complaining. Worse yet, if the corrupt .git/refs/heads/frotz was more than 40 bytes and began with hexadecimal characters, it silently overwritten the initial part of the returned result. This commit adds a couple of tests to demonstrate these cases, with a fix. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-11t0000: catch trivial pilot errors.Junio C Hamano
People seem to be getting test failure from t6021 not becuase git is faulty but because they forgot to install "merge". Check this and other trivial pilot errors in the first test. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-10Use GIT_EXEC_PATH explicitly for initial git-init-db in tests.Junio C Hamano
This is just a belts-and-suspenders check, but makes sure we have both "git" and "git-init-db" built, executable, and checking. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-09use "git init-db" in testsAlex Riesen
This is to catch an error where tests are run without first building what are being tested. Relying on prefixing $PATH with the build directory and expect that the PATH mechanism would find what we just built would silently run an already installed binaries from the PATH. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-08Make sure we use compat/subprocess.py with Python 2.3 while running tests.Junio C Hamano
Otherwise the test will not succeed without installing. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-03test-lib.sh: Add new function, test_expect_codeFredrik Kuivinen
The test is considered OK if it exits with code $1 Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-16Fix tests with new git in CJohannes Schindelin
GIT_EXEC_PATH *has* to be set. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-16Disable hooks during tests.Junio C Hamano
Individual tests for hooks would want to have their own tests when written. Also we should not pick up from random templates the user happens to have. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-10Also force LC_ALL in test scripts.Junio C Hamano
Noticed by Junichi Uekawa. Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-12[PATCH] Trapping exit in tests, using return for errors: further fixes.Pavel Roskin
"return" from a test would leave the exit trap set, which could cause a spurious error message if it's the last test in the script or --immediate is used. The easiest solution would be to have a global trap that is set when test-lib.sh is sourced and unset either by test_done(), error() or by test_failure_() with --immediate. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-12[PATCH] Trapping exit in tests, using return for errorsPavel Roskin
I have noticed that "make test" fails without any explanations when the "merge" utility is missing. I don't think tests should be silent in case of failure. It turned out that the particular test was using "exit" to interrupt the test in case of an error. This caused the whole test script to exit. No further tests would be run even if "--immediate" wasn't specified. No error message was printed. This patch does following: All instances of "exit", "exit 1" and "(exit 1)" in tests have been replaced with "return 1". In fact, "(exit 1)" had no effect. File descriptor 5 is duplicated from file descriptor 1. This is needed to print important error messages from tests. New function test_run_() has been introduced. Any "return" in the test would merely cause that function to return without skipping calls to test_failure_() and test_ok_(). The new function also traps "exit" and treats it like a fatal error (in case somebody reintroduces "exit" in the tests). test_expect_failure() and test_expect_success() check both the result of eval and the return value of test_run_(). If the later is not 0, it's always a failure because it indicates the the test didn't complete. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-12[PATCH] Need to set PAGER in testsPavel Roskin
"t5400-send-pack.sh --verbose" stops waiting for user input. It happens because "git log" uses less for output now. To prevent this, PAGER should be set to cat. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>