Merge branch 'dd/test-with-busybox'
Various tests have been updated to work around issues found with shell utilities that come with busybox etc. * dd/test-with-busybox: t5703: feed raw data into test-tool unpack-sideband t4124: tweak test so that non-compliant diff(1) can also be used t7063: drop non-POSIX argument "-ls" from find(1) t5616: use rev-parse instead to get HEAD's object_id t5003: skip conversion test if unzip -a is unavailable t5003: drop the subshell in test_lazy_prereq test-lib-functions: test_cmp: eval $GIT_TEST_CMP t4061: use POSIX compliant regex(7)
This commit is contained in:
commit
28ba5a7b27
@ -67,7 +67,7 @@ static void unpack_sideband(void)
|
|||||||
case PACKET_READ_NORMAL:
|
case PACKET_READ_NORMAL:
|
||||||
band = reader.line[0] & 0xff;
|
band = reader.line[0] & 0xff;
|
||||||
if (band < 1 || band > 2)
|
if (band < 1 || band > 2)
|
||||||
die("unexpected side band %d", band);
|
continue; /* skip non-sideband packets */
|
||||||
fd = band;
|
fd = band;
|
||||||
|
|
||||||
write_or_die(fd, reader.line + 1, reader.pktlen - 1);
|
write_or_die(fd, reader.line + 1, reader.pktlen - 1);
|
||||||
|
@ -17,7 +17,7 @@ compare_diff () {
|
|||||||
# Compare blame output using the expectation for a diff as reference.
|
# Compare blame output using the expectation for a diff as reference.
|
||||||
# Only look for the lines coming from non-boundary commits.
|
# Only look for the lines coming from non-boundary commits.
|
||||||
compare_blame () {
|
compare_blame () {
|
||||||
sed -n -e "1,4d" -e "s/^\+//p" <"$1" >.tmp-1
|
sed -n -e "1,4d" -e "s/^+//p" <"$1" >.tmp-1
|
||||||
sed -ne "s/^[^^][^)]*) *//p" <"$2" >.tmp-2
|
sed -ne "s/^[^^][^)]*) *//p" <"$2" >.tmp-2
|
||||||
test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
|
test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,13 @@ test_fix () {
|
|||||||
|
|
||||||
# find touched lines
|
# find touched lines
|
||||||
$DIFF file target | sed -n -e "s/^> //p" >fixed
|
$DIFF file target | sed -n -e "s/^> //p" >fixed
|
||||||
|
# busybox's diff(1) doesn't output normal format
|
||||||
|
if ! test -s fixed
|
||||||
|
then
|
||||||
|
$DIFF -u file target |
|
||||||
|
grep -v '^+++ target' |
|
||||||
|
sed -ne "/^+/s/+//p" >fixed
|
||||||
|
fi
|
||||||
|
|
||||||
# the changed lines are all expected to change
|
# the changed lines are all expected to change
|
||||||
fixed_cnt=$(wc -l <fixed)
|
fixed_cnt=$(wc -l <fixed)
|
||||||
|
@ -7,12 +7,12 @@ test_description='git archive --format=zip test'
|
|||||||
SUBSTFORMAT=%H%n
|
SUBSTFORMAT=%H%n
|
||||||
|
|
||||||
test_lazy_prereq UNZIP_SYMLINKS '
|
test_lazy_prereq UNZIP_SYMLINKS '
|
||||||
(
|
"$GIT_UNZIP" "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip &&
|
||||||
mkdir unzip-symlinks &&
|
test -h symlink
|
||||||
cd unzip-symlinks &&
|
'
|
||||||
"$GIT_UNZIP" "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip &&
|
|
||||||
test -h symlink
|
test_lazy_prereq UNZIP_CONVERT '
|
||||||
)
|
"$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip
|
||||||
'
|
'
|
||||||
|
|
||||||
check_zip() {
|
check_zip() {
|
||||||
@ -39,33 +39,33 @@ check_zip() {
|
|||||||
extracted=${dir_with_prefix}a
|
extracted=${dir_with_prefix}a
|
||||||
original=a
|
original=a
|
||||||
|
|
||||||
test_expect_success UNZIP " extract ZIP archive with EOL conversion" '
|
test_expect_success UNZIP_CONVERT " extract ZIP archive with EOL conversion" '
|
||||||
(mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile)
|
(mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success UNZIP " validate that text files are converted" "
|
test_expect_success UNZIP_CONVERT " validate that text files are converted" "
|
||||||
test_cmp_bin $extracted/text.cr $extracted/text.crlf &&
|
test_cmp_bin $extracted/text.cr $extracted/text.crlf &&
|
||||||
test_cmp_bin $extracted/text.cr $extracted/text.lf
|
test_cmp_bin $extracted/text.cr $extracted/text.lf
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success UNZIP " validate that binary files are unchanged" "
|
test_expect_success UNZIP_CONVERT " validate that binary files are unchanged" "
|
||||||
test_cmp_bin $original/binary.cr $extracted/binary.cr &&
|
test_cmp_bin $original/binary.cr $extracted/binary.cr &&
|
||||||
test_cmp_bin $original/binary.crlf $extracted/binary.crlf &&
|
test_cmp_bin $original/binary.crlf $extracted/binary.crlf &&
|
||||||
test_cmp_bin $original/binary.lf $extracted/binary.lf
|
test_cmp_bin $original/binary.lf $extracted/binary.lf
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success UNZIP " validate that diff files are converted" "
|
test_expect_success UNZIP_CONVERT " validate that diff files are converted" "
|
||||||
test_cmp_bin $extracted/diff.cr $extracted/diff.crlf &&
|
test_cmp_bin $extracted/diff.cr $extracted/diff.crlf &&
|
||||||
test_cmp_bin $extracted/diff.cr $extracted/diff.lf
|
test_cmp_bin $extracted/diff.cr $extracted/diff.lf
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success UNZIP " validate that -diff files are unchanged" "
|
test_expect_success UNZIP_CONVERT " validate that -diff files are unchanged" "
|
||||||
test_cmp_bin $original/nodiff.cr $extracted/nodiff.cr &&
|
test_cmp_bin $original/nodiff.cr $extracted/nodiff.cr &&
|
||||||
test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf &&
|
test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf &&
|
||||||
test_cmp_bin $original/nodiff.lf $extracted/nodiff.lf
|
test_cmp_bin $original/nodiff.lf $extracted/nodiff.lf
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success UNZIP " validate that custom diff is unchanged " "
|
test_expect_success UNZIP_CONVERT " validate that custom diff is unchanged " "
|
||||||
test_cmp_bin $original/custom.cr $extracted/custom.cr &&
|
test_cmp_bin $original/custom.cr $extracted/custom.cr &&
|
||||||
test_cmp_bin $original/custom.crlf $extracted/custom.crlf &&
|
test_cmp_bin $original/custom.crlf $extracted/custom.crlf &&
|
||||||
test_cmp_bin $original/custom.lf $extracted/custom.lf
|
test_cmp_bin $original/custom.lf $extracted/custom.lf
|
||||||
|
@ -49,7 +49,7 @@ test_expect_success 'do partial clone 1' '
|
|||||||
test_expect_success 'verify that .promisor file contains refs fetched' '
|
test_expect_success 'verify that .promisor file contains refs fetched' '
|
||||||
ls pc1/.git/objects/pack/pack-*.promisor >promisorlist &&
|
ls pc1/.git/objects/pack/pack-*.promisor >promisorlist &&
|
||||||
test_line_count = 1 promisorlist &&
|
test_line_count = 1 promisorlist &&
|
||||||
git -C srv.bare rev-list HEAD >headhash &&
|
git -C srv.bare rev-parse --verify HEAD >headhash &&
|
||||||
grep "$(cat headhash) HEAD" $(cat promisorlist) &&
|
grep "$(cat headhash) HEAD" $(cat promisorlist) &&
|
||||||
grep "$(cat headhash) refs/heads/master" $(cat promisorlist)
|
grep "$(cat headhash) refs/heads/master" $(cat promisorlist)
|
||||||
'
|
'
|
||||||
|
@ -13,10 +13,7 @@ get_actual_refs () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_actual_commits () {
|
get_actual_commits () {
|
||||||
sed -n -e '/packfile/,/0000/{
|
test-tool pkt-line unpack-sideband <out >o.pack &&
|
||||||
/packfile/d
|
|
||||||
p
|
|
||||||
}' <out | test-tool pkt-line unpack-sideband >o.pack &&
|
|
||||||
git index-pack o.pack &&
|
git index-pack o.pack &&
|
||||||
git verify-pack -v o.idx >objs &&
|
git verify-pack -v o.idx >objs &&
|
||||||
grep commit objs | cut -d" " -f1 | sort >actual_commits
|
grep commit objs | cut -d" " -f1 | sort >actual_commits
|
||||||
|
@ -18,7 +18,7 @@ GIT_FORCE_UNTRACKED_CACHE=true
|
|||||||
export GIT_FORCE_UNTRACKED_CACHE
|
export GIT_FORCE_UNTRACKED_CACHE
|
||||||
|
|
||||||
sync_mtime () {
|
sync_mtime () {
|
||||||
find . -type d -ls >/dev/null
|
find . -type d -exec ls -ld {} + >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
avoid_racy() {
|
avoid_racy() {
|
||||||
|
@ -905,7 +905,7 @@ test_expect_code () {
|
|||||||
# - not all diff versions understand "-u"
|
# - not all diff versions understand "-u"
|
||||||
|
|
||||||
test_cmp() {
|
test_cmp() {
|
||||||
$GIT_TEST_CMP "$@"
|
eval "$GIT_TEST_CMP" '"$@"'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that the given config key has the expected value.
|
# Check that the given config key has the expected value.
|
||||||
|
Loading…
Reference in New Issue
Block a user