1. 23 3月, 2009 4 次提交
  2. 22 3月, 2009 1 次提交
    • J
      test-lib: Infrastructure to test and check for prerequisites · a7bb3940
      Johannes Sixt 提交于
      Some tests can be run only if a particular prerequisite is available. For
      example, some tests require that an UTF-8 locale is available. Here we
      introduce functions that are used in this way:
      
      1. Insert code that checks whether the prerequisite is available. If it is,
         call test_set_prereq with an arbitrary tag name that subsequently can be
         used to check for the prerequisite:
      
            case $LANG in
            *.utf-8)
                  test_set_prereq UTF8
                  ;;
            esac
      
      2. In the calls to test_expect_success pass the tag name:
      
            test_expect_success UTF8 '...description...' '...tests...'
      
      3. There is an auxiliary predicate that can be used anywhere to test for
         a prerequisite explicitly:
      
            if test_have_prereq UTF8
            then
                  ...code to be skipped if prerequisite is not available...
            fi
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      a7bb3940
  3. 20 3月, 2009 13 次提交
    • J
    • J
      Tests on Windows: $(pwd) must return Windows-style paths · 4114156a
      Johannes Sixt 提交于
      Many tests pass $(pwd) in some form to git and later test that the output
      of git contains the correct value of $(pwd). For example, the test of
      'git remote show' sets up a remote that contains $(pwd) and then the
      expected result must contain $(pwd).
      
      Again, MSYS-bash's path mangling kicks in: Plain $(pwd) uses the MSYS style
      absolute path /c/path/to/git. The test case would write this name into
      the 'expect' file. But when git is invoked, MSYS-bash converts this name to
      the Windows style path c:/path/to/git, and git would produce this form in
      the result; the test would fail.
      
      We fix this by passing -W to bash's pwd that produces the Windows-style
      path.
      
      There are a two cases that need an accompanying change:
      
      - In t1504 the value of $(pwd) becomes part of a path list. In this case,
        the lone 'c' in something like /foo:c:/path/to/git:/bar inhibits
        MSYS-bashes path mangling; IOW in this case we want the /c/path/to/git
        form to allow path mangling. We use $PWD instead of $(pwd), which always
        has the latter form.
      
      - In t6200, $(pwd) - the Windows style path - must be used to construct the
        expected result because that is the path form that git sees. (The change
        in the test itself is just for consistency: 'git fetch' always sees the
        Windows-style path, with or without the change.)
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      4114156a
    • J
      test-lib: Work around missing sum on Windows · 5397ea31
      Johannes Sixt 提交于
      t1002-read-tree-m-u-2way.sh uses 'sum', but it does not rely on the exact
      form of the sum, only that it is a hash digest. Therefore, we can sneak
      in 'md5sum' under the name 'sum'.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      5397ea31
    • J
      test-lib: Work around incompatible sort and find on Windows · f17e9fbb
      Johannes Sixt 提交于
      If the PATH lists the Windows system directories before the MSYS
      directories, Windows's own incompatible sort and find commands would be
      picked up. We implement these commands as functions and call the real
      tools by absolute path.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      f17e9fbb
    • J
      t5602: Work around path mangling on MSYS · a8cbc9ab
      Johannes Sixt 提交于
      MSYS's bash rewrites /something/bin/... into a Windows path that looks like
      c:/msysgit/something/bin/... before git sees it. But later the test case
      verifies that the path was used and compares it to the unmangled version.
      This fails, of course. This make the path relative so that the path
      mangling is not triggered.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      a8cbc9ab
    • J
      t5300, t5302, t5303: Do not use /dev/zero · b689ccf6
      Johannes Sixt 提交于
      We do not have /dev/zero on Windows. This replaces it by data generated
      with printf, perl, or echo. Most of the cases do not depend on that the
      data is a stream of zero bytes, so we use something printable; nor is an
      unlimited stream of data needed, so we produce only as many bytes as the
      test cases need.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      b689ccf6
    • J
      t2200, t7004: Avoid glob pattern that also matches files · 0aaaef7b
      Johannes Sixt 提交于
      On Windows, there is an unfortunate interaction between the MSYS bash and
      git's command line processing:
      
      - Since Windows's CMD does not do the wildcard expansion, but passes
        arguments like path* through to the programs, the programs must do the
        expansion themselves. This happens in the startup code before main() is
        entered.
      
      - bash, however, passes the argument "path*" to git, assuming that git will
        see the unquoted word unchanged as a single argument.
      
      But actually git expands the unquoted word before main() is entered.
      
      In t2200, not all names that the test case is interested in exist as files
      at the time when 'git ls-files' is invoked. git expands "path?" to only
      the subset of files the exist, and only that subset was listed, so that the
      test failed.  We now list all interesting paths explicitly.
      
      In t7004, git exanded the pattern "*a*" to "actual" (the file that stdout
      was redirected to), which is not what the was tested for. We fix it by
      renaming the output file (and removing any existing files matching *a*).
      This was originally fixed by Johannes Schindelin.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      0aaaef7b
    • J
      t7300: fix clean up on Windows · e2c24076
      Johannes Schindelin 提交于
      On Windows, you cannot remove files that are in use, not even with
      'rm -rf'.  So we need to run 'exec <foo/bar' inside a subshell lest
      removing the whole test repository fail.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      e2c24076
    • J
      test-lib: Introduce test_chmod and use it instead of update-index --chmod · 1f553918
      Johannes Sixt 提交于
      This function replaces sequences of 'chmod +x' and 'git update-index
      --chmod=+x' in the test suite, whose purpose is to help filesystems
      that need core.filemode=false. Two places where only 'chmod +x' was used
      we also use this new function.
      
      The function calls 'git update-index --chmod' without checking
      core.filemode (unlike some of the call sites did). We do this because the
      call sites *expect* that the executable bit ends up in the index (ie. it
      is not the purpose of the call sites to *test* whether git treats
      'chmod +x' and 'update-index --chmod=+x' correctly). Therefore, on
      filesystems with core.filemode=true the 'git update-index --chmod' is a
      no-op.
      
      The function uses --add with update-index to help one call site in
      t6031-merge-recursive. It makes no difference for the other callers.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      1f553918
    • J
      test-lib: Simplify test counting. · 8586f98b
      Johannes Sixt 提交于
      Since the test case counter was incremented very late, there were a few
      users of the counter had to do their own incrementing. Now we increment it
      early and simplify these users.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      8586f98b
    • J
      test-lib: Replace uses of $(expr ...) by POSIX shell features. · d5d9de1b
      Johannes Sixt 提交于
      In particular:
      
      - Test case counting can be achieved by arithmetic expansion.
      
      - The name of the test, e.g. t1234, can be computed with ${0%%} and ${0##}.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      d5d9de1b
    • J
      Call 'say' outside test_expect_success · 5b46a428
      Johannes Sixt 提交于
      There were some uses of 'say' inside test_expect_success. But if the tests
      were not run in verbose mode, this message went to /dev/null. Pull them out
      of test_expect_success.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      5b46a428
    • J
      test suite: Use 'say' to say something instead of 'test_expect_success' · fae74a04
      Johannes Sixt 提交于
      Some tests report that some tests will be skipped.  They used
      'test_expect_success' with a trivially successful test.  Nowadays we have
      the helper function 'say' for this purpose.
      
      In on case, 'say_color skip' is replaced by 'say' because the former is
      not intended as a public API.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      fae74a04
  4. 19 3月, 2009 1 次提交
    • J
      t9400, t9401: Do not force hard-linked clone · 7fd3ef1f
      Johannes Sixt 提交于
      The tests do not depend on that the clones are hard-linked, but used
      --local only as an optimization: At the time that --local was used first
      in t9400 hard-linked clones were not the default, yet.
      
      By removing --local, we help filesystems that do not support hard-links.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      7fd3ef1f
  5. 18 3月, 2009 21 次提交