Skip to content

Commit

Permalink
Merge branch 'js/windows-tests'
Browse files Browse the repository at this point in the history
* js/windows-tests:
  t0060: fix whitespace in "wc -c" invocation
  t5503: GIT_DEBUG_SEND_PACK is not supported on MinGW
  t7004: Use prerequisite tags to skip tests that need gpg
  Use prerequisites to skip tests that need unzip
  t3700: Skip a test with backslashes in pathspec
  Skip tests that require a filesystem that obeys POSIX permissions
  t0060: Fix tests on Windows
  Use prerequisite tags to skip tests that depend on symbolic links
  t9100, t9129: Use prerequisite tags for UTF-8 tests
  t5302: Use prerequisite tags to skip 64-bit offset tests
  Skip tests that fail if the executable bit is not handled by the filesystem
  t3600: Use test prerequisite tags
  test-lib: Infrastructure to test and check for prerequisites
  t0050: Check whether git init detected symbolic link support correctly
  Tests on Windows: $(pwd) must return Windows-style paths
  test-lib: Work around missing sum on Windows
  test-lib: Work around incompatible sort and find on Windows

Conflicts:
	t/t3000-ls-files-others.sh
  • Loading branch information
Junio C Hamano committed Mar 24, 2009
2 parents edbc25c + 28baf82 commit 78360b5
Show file tree
Hide file tree
Showing 52 changed files with 594 additions and 288 deletions.
58 changes: 46 additions & 12 deletions t/t0000-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ test_expect_failure 'pretend we have a known breakage' '
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
Expand Down Expand Up @@ -100,12 +115,31 @@ test_expect_success \
'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
for p in path0 path2/file2 path3/file3 path3/subp3/file3
paths='path0 path2/file2 path3/file3 path3/subp3/file3'
for p in $paths
do
echo "hello $p" >$p
ln -s "hello $p" ${p}sym
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'
Expand All @@ -115,7 +149,7 @@ test_expect_success \
'showing stage with git ls-files --stage' \
'git ls-files --stage >current'

cat >expected <<\EOF
$expectfilter >expected <<\EOF
100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
Expand All @@ -134,7 +168,7 @@ test_expect_success \
'tree=$(git write-tree)'
test_expect_success \
'validate object ID for a known tree.' \
'test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b'
'test "$tree" = "$expectedtree"'

test_expect_success \
'showing tree with git ls-tree' \
Expand All @@ -145,7 +179,7 @@ cat >expected <<\EOF
040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
EOF
test_expect_success \
test_expect_success SYMLINKS \
'git ls-tree output for a known tree.' \
'test_cmp expected current'

Expand All @@ -154,7 +188,7 @@ test_expect_success \
test_expect_success \
'showing tree with git ls-tree -r' \
'git ls-tree -r $tree >current'
cat >expected <<\EOF
$expectfilter >expected <<\EOF
100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
Expand Down Expand Up @@ -185,7 +219,7 @@ cat >expected <<\EOF
100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
EOF
test_expect_success \
test_expect_success SYMLINKS \
'git ls-tree -r output for a known tree.' \
'test_cmp expected current'

Expand All @@ -194,14 +228,14 @@ test_expect_success \
'ptree=$(git write-tree --prefix=path3)'
test_expect_success \
'validate object ID for a known tree.' \
'test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3'
'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" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2'
'test "$ptree" = "$expectedptree2"'

cat >badobjects <<EOF
100644 blob 1000000000000000000000000000000000000000 dir/file1
Expand Down Expand Up @@ -234,7 +268,7 @@ test_expect_success \
newtree=$(git write-tree) &&
test "$newtree" = "$tree"'

cat >expected <<\EOF
$expectfilter >expected <<\EOF
:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
Expand All @@ -257,7 +291,7 @@ test_expect_success \
'git diff-files >current && cmp -s current /dev/null'

################################################################
P=087704a96baf1c2d1c869a8b084481e121c88b5b
P=$expectedtree
test_expect_success \
'git commit-tree records the correct tree in a commit.' \
'commit0=$(echo NO | git commit-tree $P) &&
Expand Down Expand Up @@ -293,7 +327,7 @@ test_expect_success 'update-index D/F conflict' '
test $numpath0 = 1
'

test_expect_success 'absolute path works as expected' '
test_expect_success SYMLINKS 'absolute path works as expected' '
mkdir first &&
ln -s ../.git first/.git &&
mkdir second &&
Expand Down
8 changes: 4 additions & 4 deletions t/t0004-unwritable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test_expect_success setup '
'

test_expect_success 'write-tree should notice unwritable repository' '
test_expect_success POSIXPERM 'write-tree should notice unwritable repository' '
(
chmod a-w .git/objects .git/objects/?? &&
Expand All @@ -27,7 +27,7 @@ test_expect_success 'write-tree should notice unwritable repository' '
'

test_expect_success 'commit should notice unwritable repository' '
test_expect_success POSIXPERM 'commit should notice unwritable repository' '
(
chmod a-w .git/objects .git/objects/?? &&
Expand All @@ -39,7 +39,7 @@ test_expect_success 'commit should notice unwritable repository' '
'

test_expect_success 'update-index should notice unwritable repository' '
test_expect_success POSIXPERM 'update-index should notice unwritable repository' '
(
echo 6O >file &&
Expand All @@ -52,7 +52,7 @@ test_expect_success 'update-index should notice unwritable repository' '
'

test_expect_success 'add should notice unwritable repository' '
test_expect_success POSIXPERM 'add should notice unwritable repository' '
(
echo b >file &&
Expand Down
6 changes: 3 additions & 3 deletions t/t0024-crlf-archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ test_expect_success 'tar archive' '
"$UNZIP" -v >/dev/null 2>&1
if [ $? -eq 127 ]; then
say "Skipping ZIP test, because unzip was not found"
test_done
exit
else
test_set_prereq UNZIP
fi

test_expect_success 'zip archive' '
test_expect_success UNZIP 'zip archive' '
git archive --format=zip HEAD >test.zip &&
Expand Down
28 changes: 26 additions & 2 deletions t/t0050-filesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ aumlcdiar=`printf '\x61\xcc\x88'`

case_insensitive=
unibad=
test_expect_success 'see if we expect ' '
no_symlinks=
test_expect_success 'see what we expect' '
test_case=test_expect_success
test_unicode=test_expect_success
Expand All @@ -31,13 +32,21 @@ test_expect_success 'see if we expect ' '
;;
*) ;;
esac &&
rm -fr junk
rm -fr junk &&
{
ln -s x y 2> /dev/null &&
test -h y 2> /dev/null ||
no_symlinks=1
rm -f y
}
'

test "$case_insensitive" &&
say "will test on a case insensitive filesystem"
test "$unibad" &&
say "will test on a unicode corrupting filesystem"
test "$no_symlinks" &&
say "will test on a filesystem lacking symbolic links"

if test "$case_insensitive"
then
Expand All @@ -53,6 +62,21 @@ test_expect_success "detection of case insensitive filesystem during repo init"
'
fi

if test "$no_symlinks"
then
test_expect_success "detection of filesystem w/o symlink support during repo init" '
v=$(git config --bool core.symlinks) &&
test "$v" = false
'
else
test_expect_success "detection of filesystem w/o symlink support during repo init" '
test_must_fail git config --bool core.symlinks ||
test "$(git config --bool core.symlinks)" = true
'
fi

test_expect_success "setup case tests" '
git config core.ignorecase true &&
Expand Down
6 changes: 3 additions & 3 deletions t/t0055-beyond-symlinks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ test_description='update-index and add refuse to add beyond symlinks'

. ./test-lib.sh

test_expect_success setup '
test_expect_success SYMLINKS setup '
>a &&
mkdir b &&
ln -s b c &&
>c/d &&
git update-index --add a b/d
'

test_expect_success 'update-index --add beyond symlinks' '
test_expect_success SYMLINKS 'update-index --add beyond symlinks' '
test_must_fail git update-index --add c/d &&
! ( git ls-files | grep c/d )
'

test_expect_success 'add beyond symlinks' '
test_expect_success SYMLINKS 'add beyond symlinks' '
test_must_fail git add c/d &&
! ( git ls-files | grep c/d )
'
Expand Down
Loading

0 comments on commit 78360b5

Please sign in to comment.