Merge branch 'jk/tests-timestamp-fix' into master

The test framework has been updated so that most tests will run
with predictable (artificial) timestamps.

* jk/tests-timestamp-fix:
  t9100: stop depending on commit timestamps
  test-lib: set deterministic default author/committer date
  t9100: explicitly unset GIT_COMMITTER_DATE
  t5539: make timestamp requirements more explicit
  t9700: loosen ident timezone regex
  t6000: use test_tick consistently
This commit is contained in:
Junio C Hamano 2020-07-30 13:20:31 -07:00
commit 6fc5542564
5 changed files with 17 additions and 8 deletions

View file

@ -9,10 +9,12 @@ start_httpd
commit() {
echo "$1" >tracked &&
git add tracked &&
test_tick &&
git commit -m "$1"
}
test_expect_success 'setup shallow clone' '
test_tick=1500000000 &&
commit 1 &&
commit 2 &&
commit 3 &&
@ -48,7 +50,6 @@ EOF
test_expect_success 'no shallow lines after receiving ACK ready' '
(
cd shallow &&
test_tick &&
for i in $(test_seq 15)
do
git checkout --orphan unrelated$i &&
@ -66,6 +67,7 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
(
cd clone &&
git checkout --orphan newnew &&
test_tick=1400000000 &&
test_commit new-too &&
# NEEDSWORK: If the overspecification of the expected result is reduced, we
# might be able to run this test in all protocol versions.

View file

@ -8,6 +8,7 @@ test_expect_success setup '
echo content1 >wanted_file &&
echo content2 >unwanted_file &&
git add wanted_file unwanted_file &&
test_tick &&
git commit -m one
'
@ -21,6 +22,7 @@ test_expect_success 'rev-list --objects with pathspecs and deeper paths' '
mkdir foo &&
>foo/file &&
git add foo/file &&
test_tick &&
git commit -m two &&
git rev-list --objects HEAD -- foo >output &&
@ -69,6 +71,7 @@ test_expect_success '--no-object-names and --object-names are last-one-wins' '
'
test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
test_tick &&
git commit --allow-empty -m another &&
git tag -a -m "annotated" v1.0 &&
git rev-list --objects ^v1.0^ v1.0 >expect &&
@ -84,10 +87,10 @@ test_expect_success 'propagate uninteresting flag down correctly' '
test_expect_success 'symleft flag bit is propagated down from tag' '
git log --format="%m %s" --left-right v1.0...master >actual &&
cat >expect <<-\EOF &&
> two
> one
< another
< that
> two
> one
EOF
test_cmp expect actual
'

View file

@ -200,8 +200,9 @@ GIT_SVN_ID=alt
export GIT_SVN_ID
test_expect_success "$name" \
'git svn init "$svnrepo" && git svn fetch &&
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
git log --format="tree %T %s" remotes/git-svn |
awk "!seen[\$0]++ { print \$1, \$2 }" >a &&
git log --format="tree %T" alt >b &&
test_cmp a b'
name='check imported tree checksums expected tree checksums'

View file

@ -59,15 +59,15 @@ sub adjust_dirsep {
open STDERR, ">&", $tmpstderr or die "cannot restore STDERR";
# ident
like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ \+0000$/,
like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ [+-]\d{4}$/,
"ident scalar: author (type)");
like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ \+0000$/,
like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ [+-]\d{4}$/,
"ident scalar: committer (type)");
is($r->ident("invalid"), "invalid", "ident scalar: invalid ident string (no parsing)");
my ($name, $email, $time_tz) = $r->ident('author');
is_deeply([$name, $email], ["A U Thor", "author\@example.com"],
"ident array: author");
like($time_tz, qr/[0-9]+ \+0000/, "ident array: author");
like($time_tz, qr/[0-9]+ [+-]\d{4}/, "ident array: author");
is_deeply([$r->ident("Name <email> 123 +0000")], ["Name", "email", "123 +0000"],
"ident array: ident string");
is_deeply([$r->ident("invalid")], [], "ident array: invalid ident string");

View file

@ -441,15 +441,18 @@ TEST_AUTHOR_LOCALNAME=author
TEST_AUTHOR_DOMAIN=example.com
GIT_AUTHOR_EMAIL=${TEST_AUTHOR_LOCALNAME}@${TEST_AUTHOR_DOMAIN}
GIT_AUTHOR_NAME='A U Thor'
GIT_AUTHOR_DATE='1112354055 +0200'
TEST_COMMITTER_LOCALNAME=committer
TEST_COMMITTER_DOMAIN=example.com
GIT_COMMITTER_EMAIL=${TEST_COMMITTER_LOCALNAME}@${TEST_COMMITTER_DOMAIN}
GIT_COMMITTER_NAME='C O Mitter'
GIT_COMMITTER_DATE='1112354055 +0200'
GIT_MERGE_VERBOSITY=5
GIT_MERGE_AUTOEDIT=no
export GIT_MERGE_VERBOSITY GIT_MERGE_AUTOEDIT
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
export EDITOR
# Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output