aboutsummaryrefslogtreecommitdiff
path: root/t/test-lib.sh
Commit message (Collapse)AuthorAge
* Update tests to use test-chmtimeEric Wong2007-02-25
| | | | | | | | | | | | | | | 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>
* Make tests independent of global config filesJohannes Schindelin2007-02-22
| | | | | | | | | | | | 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>
* Default GIT_MERGE_VERBOSITY to 5 during tests.Shawn O. Pearce2007-02-03
| | | | | | | | | 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>
* use 'init' instead of 'init-db' for shipped docs and toolsNicolas Pitre2007-01-12
| | | | | | | | | 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>
* Fix timestamp for test-tickJunio C Hamano2007-01-06
| | | | | | | | 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>
* t5400 send-pack test: try a bit more nontrivial transfer.Junio C Hamano2006-12-29
| | | | | | | 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>
* GIT_SKIP_TESTS: allow users to omit tests that are known to breakJunio C Hamano2006-12-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* test-lib: quiet down init-db output for testsEric Wong2006-12-28
| | | | | | | | 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>
* Introduce GIT_TEMPLATE_DIRJohannes Schindelin2006-12-19
| | | | | | | | | | | 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>
* Revert "fix testsuite: make sure they use templates freshly built from the ↵Junio C Hamano2006-12-19
| | | | | | | | | 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.
* fix testsuite: make sure they use templates freshly built from the sourceJunio C Hamano2006-12-18
| | | | | | | | | | | 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>
* remove merge-recursive-oldJunio C Hamano2006-11-21
| | | | | | This frees the Porcelain-ish that comes with the core Python-free. Signed-off-by: Junio C Hamano <junkio@cox.net>
* test-lib.sh: A command dying due to a signal is an unexpected failure.Johannes Sixt2006-11-13
| | | | | | | | 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>
* Set $HOME for selftestsGerrit Pape2006-10-24
| | | | | | | | | | | 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>
* test-lib: separate individual test better in verbose mode.Martin Waitz2006-10-07
| | | | | | | | | | 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>
* Merge branch 'jc/gitpm'Junio C Hamano2006-09-30
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 * ...
| * Merge branch 'master' into pb/gitpmJunio C Hamano2006-08-07
| |\ | | | | | | | | | This is to resolve the conflicts with Ryan's annotate updates early.
| * | Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC mungingPetr Baudis2006-07-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Perly Git: make sure we do test the freshly built one.Junio C Hamano2006-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Perl interface: make testsuite work again.Junio C Hamano2006-07-02
| | | | | | | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | | Deprecate merge-recursive.pyJunio C Hamano2006-09-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Quote arguments to tr in test-libRobin Rosenberg2006-09-22
| | | | | | | | | | | | | | | | | | | | | 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>
* | | Trace into a file or an open fd and refactor tracing code.Christian Couder2006-09-02
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'ml/trace'Junio C Hamano2006-07-12
|\ \ | | | | | | | | | | | | | | | | | | * 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
| * | test-lib: unset GIT_TRACEJunio C Hamano2006-07-12
| |/ | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | tests: Set EDITOR=: and VISUAL=: globallyEric Wong2006-07-11
|/ | | | | | | | | 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>
* Merge part of jc/portable branchJunio C Hamano2006-02-21
|\
| * Optionally work without pythonJohannes Schindelin2006-02-18
| | | | | | | | | | | | | | | | 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>
* | Abstract test_create_repo out for use in tests.Carl Worth2006-02-17
|/ | | | | Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Define GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL) to known values.Junio C Hamano2006-02-10
| | | | | | | | | | | 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>
* trivial: check, if t/trash directory was successfully createdAlex Riesen2006-01-05
| | | | | | | | 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>
* get_sha1_basic(): corner case ambiguity fixJunio C Hamano2005-12-15
| | | | | | | | | | | | | | 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>
* t0000: catch trivial pilot errors.Junio C Hamano2005-12-10
| | | | | | | | 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>
* Use GIT_EXEC_PATH explicitly for initial git-init-db in tests.Junio C Hamano2005-12-09
| | | | | | | | 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>
* use "git init-db" in testsAlex Riesen2005-12-09
| | | | | | | | | | | 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>
* Make sure we use compat/subprocess.py with Python 2.3 while running tests.Junio C Hamano2005-12-07
| | | | | | Otherwise the test will not succeed without installing. Signed-off-by: Junio C Hamano <junkio@cox.net>
* test-lib.sh: Add new function, test_expect_codeFredrik Kuivinen2005-12-03
| | | | | | | 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>
* Fix tests with new git in CJohannes Schindelin2005-11-15
| | | | | | | 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>
* Disable hooks during tests.Junio C Hamano2005-10-16
| | | | | | | | 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>
* Also force LC_ALL in test scripts.Junio C Hamano2005-10-09
| | | | | | Noticed by Junichi Uekawa. Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Trapping exit in tests, using return for errors: further fixes.Pavel Roskin2005-08-11
| | | | | | | | | | | | | "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>
* [PATCH] Trapping exit in tests, using return for errorsPavel Roskin2005-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [PATCH] Need to set PAGER in testsPavel Roskin2005-08-11
| | | | | | | | | "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>
* String comparison of test is done with '=', not '=='.Junio C Hamano2005-08-11
| | | | | | Caught this during a test setting /bin/sh to (d)ash. Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Test framework: prettyprint the failed command.Junio C Hamano2005-07-22
| | | | | | | | | | The output from a failure case had the test description message and the first line of the actual test script concatenated on the same line, which was ugly. Correct the output routine a bit to make it more readable. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH 1/2] Test suite fixup.Junio C Hamano2005-05-14
| | | | | | | | | | | | | | Exposing test_expect_success and test_expect_failure turns out to be enough for the test scripts and there is no need for exposing test_ok or test_failure. This patch cleans it up and fixes the users of test_ok and test_failure. Also test scripts have acquired a new command line flag '--immediate' to cause them to exit upon the first failure. This is useful especially during the development of a new test. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Try to make test output look betterPetr Baudis2005-05-14
| | | | | | NO changed to FAIL and ok was right-aligned with it so that it is easier to visually identify the failed tests, and the removal of # should reduce the clutter on the line and aid the eye to spot the test number better.
* Fixed t0000-basic.sh and test-lib.sh permissionsPetr Baudis2005-05-14
| | | | | The +x bit was missing. I applied the original patch three times and set the permissions correctly two times. Guess which was the time I forgot.
* [PATCH 1/2] Test framework take two.Junio C Hamano2005-05-14
This adds t/ directory to host test suite, a test helper library and a basic set of tests. Petr Baudis raised many valid points at the earlier attempts in git mailing list. This round, test-lib.sh has been updated to a bit more modern style, and the default output is made easier to read. Also included is one sample test script that tests the very basics. This test has already found one leftover bug missed when we introduced symlink support, which has been fixed since then. The supplied Makefile is designed to run all the available tests. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Petr Baudis <pasky@ucw.cz>