From: Michael J Gruber <hidden> Date: 2016-06-15 22:54:15
t3910 is skipped for most users because it requires a filesystem which
does automatic conversion between different utf-8 types. Currently, this
results in a skipped test with "no reason given".
Use the skip_all mechanism from our test suite so that a reason for
skipping the test is given to the user.
Signed-off-by: Michael J Gruber <redacted>
---
Alternatively, we could set a prerequisite and mark all tests with that. Since
it's either or for the whole test skip_all seems more appropriate. In that
case, we can also flatten the else branch, of course. The current patch is
minimally invasive, though.
t/t3910-mac-os-precompose.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
@@ -22,8 +22,11 @@ esac rm-rfjunk-iftest"$test_nfd"+if!test"$test_nfd"then+skip_all="filesystem does not convert utf-8 nfd to nfc"+test_done+else# create more utf-8 variablesOdiarnfc=`printf'\303\226'`Odiarnfd=`printf'O\314\210'`
t3910 is skipped for most users because it requires a filesystem which
does automatic conversion between different utf-8 types. Currently, this
results in a skipped test with "no reason given".
Use the skip_all mechanism from our test suite so that a reason for
skipping the test is given to the user.
Signed-off-by: Michael J Gruber <redacted>
---
Alternatively, we could set a prerequisite and mark all tests with that. Since
it's either or for the whole test skip_all seems more appropriate. In that
case, we can also flatten the else branch, of course. The current patch is
minimally invasive, though.
Good point, thanks.
If we spin that idea further,
we could move the whole t3910 into t0050.
That would be nice for all non Mac OS X users in a way that we save CPU time.
We already detect unicode corruption in t0050.
From: Michael J Gruber <hidden> Date: 2016-06-15 22:54:20
This mini series provides and makes use of test prerequisites for
case insensitivity, symlinks and unicode conversion.
SYMLINKS existed before but was not used in t0050.
CASE_INSENSITIVE_FS was defined in t0003 rather than test-lib (and redone in
t0050).
UTF8_NFD_TO_NFC did not exist but was redone in two ways in two tests.
After this series, all 3 are defined in test-lib and used in the various tests.
Michael J Gruber (5):
test-lib: provide case insensitivity as a prerequisite
t0050: use the CASE_INSENSITIVE_FS test prereq
t0050: use the SYMLINKS test prereq
test-lib: provide UTF8 behaviour as a prerequisite
t3910: use the SYMLINKS test prereq
t/README | 9 ++
t/t0003-attributes.sh | 10 --
t/t0050-filesystem.sh | 64 ++++------
t/t3910-mac-os-precompose.sh | 281 +++++++++++++++++++++----------------------
t/test-lib.sh | 24 ++++
5 files changed, 189 insertions(+), 199 deletions(-)
Really (-w), it is this besides the tab removals:
t/README | 9 +++++++++
t/t0003-attributes.sh | 10 ----------
t/t0050-filesystem.sh | 62 ++++++++++++++++++++------------------------------------------
t/t3910-mac-os-precompose.sh | 25 +++++++------------------
t/test-lib.sh | 24 ++++++++++++++++++++++++
5 files changed, 60 insertions(+), 70 deletions(-)
--
1.7.12.rc0.198.gd66b616
@@ -8,7 +8,6 @@ auml=$(printf '\303\244')aumlcdiar=$(printf'\141\314\210')unibad=-no_symlinks= test_expect_success'see what we expect''test_unicode=test_expect_success&&
@@ -21,13 +20,7 @@ test_expect_success 'see what we expect' ';;*);;esac&&-rm-frjunk&&-{-ln-sxy2>/dev/null&&-test-hy2>/dev/null||-no_symlinks=1&&-rm-fy-}+rm-frjunk'iftest_have_prereqCASE_INSENSITIVE_FS
@@ -40,7 +33,7 @@ fitest"$unibad"&&say"will test on a unicode corrupting filesystem"-test"$no_symlinks"&&+test_have_prereqSYMLINKS||say"will test on a filesystem lacking symbolic links"iftest_have_prereqCASE_INSENSITIVE_FS
@@ -57,18 +50,18 @@ test_expect_success "detection of case insensitive filesystem during repo init"'fi-iftest"$no_symlinks"+iftest_have_prereqSYMLINKSthen test_expect_success"detection of filesystem w/o symlink support during repo init"'-v=$(gitconfig--boolcore.symlinks)&&-test"$v"=false+test_must_failgitconfig--boolcore.symlinks||+test"$(gitconfig--boolcore.symlinks)"=true'else test_expect_success"detection of filesystem w/o symlink support during repo init"'-test_must_failgitconfig--boolcore.symlinks||-test"$(gitconfig--boolcore.symlinks)"=true+v=$(gitconfig--boolcore.symlinks)&&+test"$v"=false'fi
From: Michael J Gruber <hidden> Date: 2016-06-15 22:54:20
Case insensitivity plays a role in several tests and is tested in several
tests. Therefore, move the test from t003 into the test lib and use the
prerequisite in t0003.
Signed-off-by: Michael J Gruber <redacted>
---
t/README | 4 ++++
t/t0003-attributes.sh | 10 ----------
t/test-lib.sh | 10 ++++++++++
3 files changed, 14 insertions(+), 10 deletions(-)
@@ -625,6 +625,10 @@ use these, and "test_set_prereq" for how to define your own. Git was compiled with USE_LIBPCRE=YesPlease. Wrap any tests that use git-grep --perl-regexp or git-grep -P in these.+ - CASE_INSENSITIVE_FS++ Test is run on a case insensitive file system.+ Tips for Writing Tests ----------------------
@@ -123,16 +123,6 @@ test_expect_success 'attribute matching is case insensitive when core.ignorecase'-test_expect_success'check whether FS is case-insensitive''-mkdirjunk&&-echogood>junk/CamelCase&&-echobad>junk/camelcase&&-iftest"$(catjunk/CamelCase)"!=good-then-test_set_prereqCASE_INSENSITIVE_FS-fi-'- test_expect_successCASE_INSENSITIVE_FS'additional case insensitivity tests''test_must_failattr_checka/B/D/g"a/b/d/*""-c core.ignorecase=0"&&test_must_failattr_checkA/B/D/NO"a/b/d/*""-c core.ignorecase=0"&&
@@ -666,3 +666,13 @@ rm -f y# When the tests are run as root, permission tests will report that# things are writable when they shouldn't be.test-w/||test_set_prereqSANITY++# check whether FS is case-insensitive+mkdirjunk&&+echogood>junk/CamelCase&&+echobad>junk/camelcase&&+iftest"$(catjunk/CamelCase)"!=good+then+test_set_prereqCASE_INSENSITIVE_FS+fi+rm-rfjunk
From: Michael J Gruber <hidden> Date: 2016-06-15 22:54:21
Besides reusing the new test prerequisite, this fixes also the issue
that the current output is not TAP compliant and produces the output "no
reason given" [for skipping].
Signed-off-by: Michael J Gruber <redacted>
---
t/t3910-mac-os-precompose.sh | 281 +++++++++++++++++++++----------------------
1 file changed, 135 insertions(+), 146 deletions(-)
@@ -7,158 +7,147 @@ test_description='utf-8 decomposed (nfd) converted to precomposed (nfc)' ../test-lib.sh+if!test_have_prereqUTF8_NFD_TO_NFC+then+skip_all="filesystem does not convert utf-8 nfd to nfc"+test_done+fi++# create utf-8 variablesAdiarnfc=`printf'\303\204'`Adiarnfd=`printf'A\314\210'`-# check if the feature is compiled in-mkdirjunk&&->junk/"$Adiarnfc"&&-case"$(cdjunk&&echo*)"in-"$Adiarnfd")-test_nfd=1-;;-*);;-esac-rm-rfjunk+Odiarnfc=`printf'\303\226'`+Odiarnfd=`printf'O\314\210'`+AEligatu=`printf'\303\206'`+Invalidu=`printf'\303\377'`-iftest"$test_nfd"-then-# create more utf-8 variables-Odiarnfc=`printf'\303\226'`-Odiarnfd=`printf'O\314\210'`-AEligatu=`printf'\303\206'`-Invalidu=`printf'\303\377'`+#Create a string with 255 bytes (decomposed)+Alongd=$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd#21 Byte+Alongd=$Alongd$Alongd$Alongd#63 Byte+Alongd=$Alongd$Alongd$Alongd$Alongd$Adiarnfd#255 Byte+#Create a string with 254 bytes (precomposed)+Alongc=$AEligatu$AEligatu$AEligatu$AEligatu$AEligatu#10 Byte+Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc#50 Byte+Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc#250 Byte+Alongc=$Alongc$AEligatu$AEligatu#254 Byte-#Create a string with 255 bytes (decomposed)-Alongd=$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd$Adiarnfd#21 Byte-Alongd=$Alongd$Alongd$Alongd#63 Byte-Alongd=$Alongd$Alongd$Alongd$Alongd$Adiarnfd#255 Byte--#Create a string with 254 bytes (precomposed)-Alongc=$AEligatu$AEligatu$AEligatu$AEligatu$AEligatu#10 Byte-Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc#50 Byte-Alongc=$Alongc$Alongc$Alongc$Alongc$Alongc#250 Byte-Alongc=$Alongc$AEligatu$AEligatu#254 Byte--test_expect_success"detect if nfd needed"'-precomposeunicode=`gitconfigcore.precomposeunicode`&&-test"$precomposeunicode"=false&&-gitconfigcore.precomposeunicodetrue-'-test_expect_success"setup"'->x&&-gitaddx&&-gitcommit-m"1st commit"&&-gitrmx&&-gitcommit-m"rm x"-'-test_expect_success"setup case mac"'-gitcheckout-bmac_os-'-# This will test nfd2nfc in readdir()-test_expect_success"add file Adiarnfc"'-echof.Adiarnfc>f.$Adiarnfc&&-gitaddf.$Adiarnfc&&-gitcommit-m"add f.$Adiarnfc"-'-# This will test nfd2nfc in git stage()-test_expect_success"stage file d.Adiarnfd/f.Adiarnfd"'-mkdird.$Adiarnfd&&-echod.$Adiarnfd/f.$Adiarnfd>d.$Adiarnfd/f.$Adiarnfd&&-gitstaged.$Adiarnfd/f.$Adiarnfd&&-gitcommit-m"add d.$Adiarnfd/f.$Adiarnfd"-'-test_expect_success"add link Adiarnfc"'-ln-sd.$Adiarnfd/f.$Adiarnfdl.$Adiarnfc&&-gitaddl.$Adiarnfc&&-gitcommit-m"add l.Adiarnfc"-'-# This will test git log-test_expect_success"git log f.Adiar"'-gitlogf.$Adiarnfc>f.Adiarnfc.log&&-gitlogf.$Adiarnfd>f.Adiarnfd.log&&-test-sf.Adiarnfc.log&&-test-sf.Adiarnfd.log&&-test_cmpf.Adiarnfc.logf.Adiarnfd.log&&-rmf.Adiarnfc.logf.Adiarnfd.log-'-# This will test git ls-files-test_expect_success"git lsfiles f.Adiar"'-gitls-filesf.$Adiarnfc>f.Adiarnfc.log&&-gitls-filesf.$Adiarnfd>f.Adiarnfd.log&&-test-sf.Adiarnfc.log&&-test-sf.Adiarnfd.log&&-test_cmpf.Adiarnfc.logf.Adiarnfd.log&&-rmf.Adiarnfc.logf.Adiarnfd.log-'-# This will test git mv-test_expect_success"git mv"'-gitmvf.$Adiarnfdf.$Odiarnfc&&-gitmvd.$Adiarnfdd.$Odiarnfc&&-gitmvl.$Adiarnfdl.$Odiarnfc&&-gitcommit-m"mv Adiarnfd Odiarnfc"-'-# Files can be checked out as nfc-# And the link has been corrected from nfd to nfc-test_expect_success"git checkout nfc"'-rmf.$Odiarnfc&&-gitcheckoutf.$Odiarnfc-'-# Make it possible to checkout files with their NFD names-test_expect_success"git checkout file nfd"'-rm-ff.*&&-gitcheckoutf.$Odiarnfd-'-# Make it possible to checkout links with their NFD names-test_expect_success"git checkout link nfd"'-rml.*&&-gitcheckoutl.$Odiarnfd-'-test_expect_success"setup case mac2"'-gitcheckoutmaster&&-gitreset--hard&&-gitcheckout-bmac_os_2-'-# This will test nfd2nfc in git commit-test_expect_success"commit file d2.Adiarnfd/f.Adiarnfd"'-mkdird2.$Adiarnfd&&-echod2.$Adiarnfd/f.$Adiarnfd>d2.$Adiarnfd/f.$Adiarnfd&&-gitaddd2.$Adiarnfd/f.$Adiarnfd&&-gitcommit-m"add d2.$Adiarnfd/f.$Adiarnfd"--d2.$Adiarnfd/f.$Adiarnfd-'-test_expect_success"setup for long decomposed filename"'-gitcheckoutmaster&&-gitreset--hard&&-gitcheckout-bmac_os_long_nfd_fn-'-test_expect_success"Add long decomposed filename"'-echolongd>$Alongd&&-gitadd*&&-gitcommit-m"Long filename"-'-test_expect_success"setup for long precomposed filename"'-gitcheckoutmaster&&-gitreset--hard&&-gitcheckout-bmac_os_long_nfc_fn-'-test_expect_success"Add long precomposed filename"'-echolongc>$Alongc&&-gitadd*&&-gitcommit-m"Long filename"-'-# Test if the global core.precomposeunicode stops autosensing-# Must be the last test case-test_expect_success"respect git config --global core.precomposeunicode"'-gitconfig--globalcore.precomposeunicodetrue&&-rm-rf.git&&-gitinit&&-precomposeunicode=`gitconfigcore.precomposeunicode`&&-test"$precomposeunicode"="true"-'-else-say"Skipping nfc/nfd tests"-fi+test_expect_success"detect if nfd needed"'+precomposeunicode=`gitconfigcore.precomposeunicode`&&+test"$precomposeunicode"=false&&+gitconfigcore.precomposeunicodetrue+'+test_expect_success"setup"'+>x&&+gitaddx&&+gitcommit-m"1st commit"&&+gitrmx&&+gitcommit-m"rm x"+'+test_expect_success"setup case mac"'+gitcheckout-bmac_os+'+# This will test nfd2nfc in readdir()+test_expect_success"add file Adiarnfc"'+echof.Adiarnfc>f.$Adiarnfc&&+gitaddf.$Adiarnfc&&+gitcommit-m"add f.$Adiarnfc"+'+# This will test nfd2nfc in git stage()+test_expect_success"stage file d.Adiarnfd/f.Adiarnfd"'+mkdird.$Adiarnfd&&+echod.$Adiarnfd/f.$Adiarnfd>d.$Adiarnfd/f.$Adiarnfd&&+gitstaged.$Adiarnfd/f.$Adiarnfd&&+gitcommit-m"add d.$Adiarnfd/f.$Adiarnfd"+'+test_expect_success"add link Adiarnfc"'+ln-sd.$Adiarnfd/f.$Adiarnfdl.$Adiarnfc&&+gitaddl.$Adiarnfc&&+gitcommit-m"add l.Adiarnfc"+'+# This will test git log+test_expect_success"git log f.Adiar"'+gitlogf.$Adiarnfc>f.Adiarnfc.log&&+gitlogf.$Adiarnfd>f.Adiarnfd.log&&+test-sf.Adiarnfc.log&&+test-sf.Adiarnfd.log&&+test_cmpf.Adiarnfc.logf.Adiarnfd.log&&+rmf.Adiarnfc.logf.Adiarnfd.log+'+# This will test git ls-files+test_expect_success"git lsfiles f.Adiar"'+gitls-filesf.$Adiarnfc>f.Adiarnfc.log&&+gitls-filesf.$Adiarnfd>f.Adiarnfd.log&&+test-sf.Adiarnfc.log&&+test-sf.Adiarnfd.log&&+test_cmpf.Adiarnfc.logf.Adiarnfd.log&&+rmf.Adiarnfc.logf.Adiarnfd.log+'+# This will test git mv+test_expect_success"git mv"'+gitmvf.$Adiarnfdf.$Odiarnfc&&+gitmvd.$Adiarnfdd.$Odiarnfc&&+gitmvl.$Adiarnfdl.$Odiarnfc&&+gitcommit-m"mv Adiarnfd Odiarnfc"+'+# Files can be checked out as nfc+# And the link has been corrected from nfd to nfc+test_expect_success"git checkout nfc"'+rmf.$Odiarnfc&&+gitcheckoutf.$Odiarnfc+'+# Make it possible to checkout files with their NFD names+test_expect_success"git checkout file nfd"'+rm-ff.*&&+gitcheckoutf.$Odiarnfd+'+# Make it possible to checkout links with their NFD names+test_expect_success"git checkout link nfd"'+rml.*&&+gitcheckoutl.$Odiarnfd+'+test_expect_success"setup case mac2"'+gitcheckoutmaster&&+gitreset--hard&&+gitcheckout-bmac_os_2+'+# This will test nfd2nfc in git commit+test_expect_success"commit file d2.Adiarnfd/f.Adiarnfd"'+mkdird2.$Adiarnfd&&+echod2.$Adiarnfd/f.$Adiarnfd>d2.$Adiarnfd/f.$Adiarnfd&&+gitaddd2.$Adiarnfd/f.$Adiarnfd&&+gitcommit-m"add d2.$Adiarnfd/f.$Adiarnfd"--d2.$Adiarnfd/f.$Adiarnfd+'+test_expect_success"setup for long decomposed filename"'+gitcheckoutmaster&&+gitreset--hard&&+gitcheckout-bmac_os_long_nfd_fn+'+test_expect_success"Add long decomposed filename"'+echolongd>$Alongd&&+gitadd*&&+gitcommit-m"Long filename"+'+test_expect_success"setup for long precomposed filename"'+gitcheckoutmaster&&+gitreset--hard&&+gitcheckout-bmac_os_long_nfc_fn+'+test_expect_success"Add long precomposed filename"'+echolongc>$Alongc&&+gitadd*&&+gitcommit-m"Long filename"+'+# Test if the global core.precomposeunicode stops autosensing+# Must be the last test case+test_expect_success"respect git config --global core.precomposeunicode"'+gitconfig--globalcore.precomposeunicodetrue&&+rm-rf.git&&+gitinit&&+precomposeunicode=`gitconfigcore.precomposeunicode`&&+test"$precomposeunicode"="true"+' test_done
From: Michael J Gruber <hidden> Date: 2016-06-15 22:54:21
UTF8 behaviour of the filesystem (conversion from nfd to nfc) plays a
role in several tests and is tested in several tests. Therefore, move
the test from t0050 into the test lib and use the prerequisite in t0050.
Signed-off-by: Michael J Gruber <redacted>
---
t/README | 5 +++++
t/t0050-filesystem.sh | 24 +++++++-----------------
t/test-lib.sh | 14 ++++++++++++++
3 files changed, 26 insertions(+), 17 deletions(-)
@@ -629,6 +629,11 @@ use these, and "test_set_prereq" for how to define your own. Test is run on a case insensitive file system.+ - UTF8_NFD_TO_NFC++ Test is run on a filesystem which converts decomposed utf-8 (nfd)+ to precomposed utf-8 (nfc).+ Tips for Writing Tests ----------------------
@@ -7,22 +7,6 @@ test_description='Various filesystem issues'auml=$(printf'\303\244')aumlcdiar=$(printf'\141\314\210')-unibad=-test_expect_success'see what we expect''--test_unicode=test_expect_success&&-mkdirjunk&&->junk/"$auml"&&-case"$(cdjunk&&echo*)"in-"$aumlcdiar")-test_unicode=test_expect_failure&&-unibad=t-;;-*);;-esac&&-rm-frjunk-'-iftest_have_prereqCASE_INSENSITIVE_FSthensay"will test on a case insensitive filesystem"
@@ -31,8 +15,14 @@ elsetest_case=test_expect_successfi-test"$unibad"&&+iftest_have_prereqUTF8_NFD_TO_NFC+thensay"will test on a unicode corrupting filesystem"+test_unicode=test_expect_failure+else+test_unicode=test_expect_success+fi+ test_have_prereqSYMLINKS||say"will test on a filesystem lacking symbolic links"
@@ -7,23 +7,12 @@ test_description='Various filesystem issues'auml=$(printf'\303\244')aumlcdiar=$(printf'\141\314\210')-case_insensitive=unibad=no_symlinks= test_expect_success'see what we expect''-test_case=test_expect_success&&test_unicode=test_expect_success&&mkdirjunk&&-echogood>junk/CamelCase&&-echobad>junk/camelcase&&-iftest"$(catjunk/CamelCase)"!=good-then-test_case=test_expect_failure&&-case_insensitive=t-fi&&-rm-frjunk&&-mkdirjunk&&>junk/"$auml"&&case"$(cdjunk&&echo*)"in"$aumlcdiar")
@@ -41,14 +30,20 @@ test_expect_success 'see what we expect' '}'-test"$case_insensitive"&&+iftest_have_prereqCASE_INSENSITIVE_FS+thensay"will test on a case insensitive filesystem"+test_case=test_expect_failure+else+test_case=test_expect_success+fi+test"$unibad"&&say"will test on a unicode corrupting filesystem"test"$no_symlinks"&&say"will test on a filesystem lacking symbolic links"-iftest"$case_insensitive"+iftest_have_prereqCASE_INSENSITIVE_FSthen test_expect_success"detection of case insensitive filesystem during repo init"'