Skip to content

Commit 6fc5542

Browse files
committed
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
2 parents 70cdbbe + 180a4d7 commit 6fc5542

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

t/t5539-fetch-http-shallow.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ start_httpd
99
commit() {
1010
echo "$1" >tracked &&
1111
git add tracked &&
12+
test_tick &&
1213
git commit -m "$1"
1314
}
1415

1516
test_expect_success 'setup shallow clone' '
17+
test_tick=1500000000 &&
1618
commit 1 &&
1719
commit 2 &&
1820
commit 3 &&
@@ -48,7 +50,6 @@ EOF
4850
test_expect_success 'no shallow lines after receiving ACK ready' '
4951
(
5052
cd shallow &&
51-
test_tick &&
5253
for i in $(test_seq 15)
5354
do
5455
git checkout --orphan unrelated$i &&
@@ -66,6 +67,7 @@ test_expect_success 'no shallow lines after receiving ACK ready' '
6667
(
6768
cd clone &&
6869
git checkout --orphan newnew &&
70+
test_tick=1400000000 &&
6971
test_commit new-too &&
7072
# NEEDSWORK: If the overspecification of the expected result is reduced, we
7173
# might be able to run this test in all protocol versions.

t/t6000-rev-list-misc.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_expect_success setup '
88
echo content1 >wanted_file &&
99
echo content2 >unwanted_file &&
1010
git add wanted_file unwanted_file &&
11+
test_tick &&
1112
git commit -m one
1213
'
1314

@@ -21,6 +22,7 @@ test_expect_success 'rev-list --objects with pathspecs and deeper paths' '
2122
mkdir foo &&
2223
>foo/file &&
2324
git add foo/file &&
25+
test_tick &&
2426
git commit -m two &&
2527
2628
git rev-list --objects HEAD -- foo >output &&
@@ -69,6 +71,7 @@ test_expect_success '--no-object-names and --object-names are last-one-wins' '
6971
'
7072

7173
test_expect_success 'rev-list A..B and rev-list ^A B are the same' '
74+
test_tick &&
7275
git commit --allow-empty -m another &&
7376
git tag -a -m "annotated" v1.0 &&
7477
git rev-list --objects ^v1.0^ v1.0 >expect &&
@@ -84,10 +87,10 @@ test_expect_success 'propagate uninteresting flag down correctly' '
8487
test_expect_success 'symleft flag bit is propagated down from tag' '
8588
git log --format="%m %s" --left-right v1.0...master >actual &&
8689
cat >expect <<-\EOF &&
87-
> two
88-
> one
8990
< another
9091
< that
92+
> two
93+
> one
9194
EOF
9295
test_cmp expect actual
9396
'

t/t9100-git-svn-basic.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ GIT_SVN_ID=alt
200200
export GIT_SVN_ID
201201
test_expect_success "$name" \
202202
'git svn init "$svnrepo" && git svn fetch &&
203-
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
204-
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
203+
git log --format="tree %T %s" remotes/git-svn |
204+
awk "!seen[\$0]++ { print \$1, \$2 }" >a &&
205+
git log --format="tree %T" alt >b &&
205206
test_cmp a b'
206207

207208
name='check imported tree checksums expected tree checksums'

t/t9700/test.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ sub adjust_dirsep {
5959
open STDERR, ">&", $tmpstderr or die "cannot restore STDERR";
6060

6161
# ident
62-
like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ \+0000$/,
62+
like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ [+-]\d{4}$/,
6363
"ident scalar: author (type)");
64-
like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ \+0000$/,
64+
like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ [+-]\d{4}$/,
6565
"ident scalar: committer (type)");
6666
is($r->ident("invalid"), "invalid", "ident scalar: invalid ident string (no parsing)");
6767
my ($name, $email, $time_tz) = $r->ident('author');
6868
is_deeply([$name, $email], ["A U Thor", "author\@example.com"],
6969
"ident array: author");
70-
like($time_tz, qr/[0-9]+ \+0000/, "ident array: author");
70+
like($time_tz, qr/[0-9]+ [+-]\d{4}/, "ident array: author");
7171
is_deeply([$r->ident("Name <email> 123 +0000")], ["Name", "email", "123 +0000"],
7272
"ident array: ident string");
7373
is_deeply([$r->ident("invalid")], [], "ident array: invalid ident string");

t/test-lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,18 @@ TEST_AUTHOR_LOCALNAME=author
441441
TEST_AUTHOR_DOMAIN=example.com
442442
GIT_AUTHOR_EMAIL=${TEST_AUTHOR_LOCALNAME}@${TEST_AUTHOR_DOMAIN}
443443
GIT_AUTHOR_NAME='A U Thor'
444+
GIT_AUTHOR_DATE='1112354055 +0200'
444445
TEST_COMMITTER_LOCALNAME=committer
445446
TEST_COMMITTER_DOMAIN=example.com
446447
GIT_COMMITTER_EMAIL=${TEST_COMMITTER_LOCALNAME}@${TEST_COMMITTER_DOMAIN}
447448
GIT_COMMITTER_NAME='C O Mitter'
449+
GIT_COMMITTER_DATE='1112354055 +0200'
448450
GIT_MERGE_VERBOSITY=5
449451
GIT_MERGE_AUTOEDIT=no
450452
export GIT_MERGE_VERBOSITY GIT_MERGE_AUTOEDIT
451453
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
452454
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
455+
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
453456
export EDITOR
454457

455458
# Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output

0 commit comments

Comments
 (0)