Skip to content

Commit 42ed74d

Browse files
committed
script/cibuild,t: always count running tests
In commit c591ff7 of PR git-lfs#3125 the GIT_LFS_NO_TEST_COUNT environment variable was introduced for use with our test suites. When this variable was set to a non-empty value, it indicated to the setup() and shutdown() test helper shell functions that they should skip running the lfstest-count-tests utility program entirely. This was done because the lfstest-count-tests program had a bug which prevented it from deleting the lock file, causing subsequent invocations of the program to be unable to exclusively create it again. As this bug was not resolved at the time, the choice was made to work around the problem in part by not counting the number of running test scripts on Windows. (We also introduced the GIT_LFS_LOCK_ACQUIRE_DISABLED environment variable, in commit 9b73c80 of the same PR, to further address the problem.) When running our test suite on Windows, we set the GIT_LFS_NO_TEST_COUNT to "1", which causes the individual test suites to skip invoking lfstest-count-tests entirely. Instead, the program is run just once in the "test" t/Makefile target before executing the test suites with the "prove" command, and then once again afterwards, both times by explicitly resetting the GIT_LFS_NO_TEST_COUNT variable to an empty string value. These two invocations cause the lfstest-count-tests program to start the lfstest-gitserver program before all the test suites were executed and then stop it once they had all finished. As we have now resolved the underlying problem in the lfstest-count-tests utility, in a prior commit in this PR, we can remove this environment variable and the test suite features it controls. We change our script/cibuild script to no longer set the GIT_LFS_NO_TEST_COUNT variable, and we revise the conditionals in the setup() and shutdown() test helper shell functions so they always call the lfstest-count-tests program, rather than only doing so if the GIT_LFS_NO_TEST_COUNT variable is unset or empty. We also change the "test" target's recipe in our t/Makefile file to not unset GIT_LFS_NO_TEST_COUNT when running lfstest-count-tests before and after it runs the "prove" command. Finally, as we have already removed the GIT_LFS_LOCK_ACQUIRE_DISABLED environment variable and all support for it, in a previous commit in this PR, that allows us now to also eliminate the unset_vars() shell functions in some of our t/t-*.sh test scripts, which was used to unset both that variable and the GIT_LFS_NO_TEST_COUNT variable before running the tests in those scripts. We added this behaviour in commit aca1aff of PR git-lfs#3808, when we migrated our CI test suite to GitHub Actions. However, we will no longer need to unset these variables as we will now never set them at all, and they will have no effect if they were set.
1 parent 9977a16 commit 42ed74d

File tree

5 files changed

+14
-48
lines changed

5 files changed

+14
-48
lines changed

script/cibuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ X=""
99
if [[ $UNAME == MINGW* || $UNAME == MSYS* || $UNAME == CYGWIN* ]]; then
1010
X=".exe"
1111
WINDOWS=1
12-
export GIT_LFS_NO_TEST_COUNT=1
1312
fi
1413

1514
# Build git-lfs-transfer from scutiger.

t/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ test-commands : $(TEST_CMDS)
4545

4646
test : test-commands
4747
$(RM) -r remote test_count{,.lock}
48-
@GIT_LFS_NO_TEST_COUNT= bash -c '. ./testenv.sh && setup'
48+
@bash -c '. ./testenv.sh && setup'
4949
$(PROVE) $(PROVE_EXTRA_ARGS) ./t-*.sh
50-
@GIT_LFS_NO_TEST_COUNT= bash -c '. ./testenv.sh && shutdown'
50+
@bash -c '. ./testenv.sh && shutdown'
5151

5252
.PHONY : $(TEST_SRCS)
5353
$(TEST_SRCS) : $(TEST_CMDS)

t/t-env.sh

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@ envInitConfig='git config filter.lfs.process = "git-lfs filter-process"
66
git config filter.lfs.smudge = "git-lfs smudge -- %f"
77
git config filter.lfs.clean = "git-lfs clean -- %f"'
88

9-
unset_vars() {
10-
# If set, these will cause the test to fail.
11-
unset GIT_LFS_NO_TEST_COUNT
12-
}
13-
149
begin_test "env with no remote"
1510
(
1611
set -e
1712
reponame="env-no-remote"
18-
unset_vars
1913
mkdir $reponame
2014
cd $reponame
2115
git init
@@ -67,7 +61,6 @@ begin_test "env with origin remote"
6761
(
6862
set -e
6963
reponame="env-origin-remote"
70-
unset_vars
7164
mkdir $reponame
7265
cd $reponame
7366
git init
@@ -125,7 +118,6 @@ begin_test "env with multiple remotes"
125118
(
126119
set -e
127120
reponame="env-multiple-remotes"
128-
unset_vars
129121
mkdir $reponame
130122
cd $reponame
131123
git init
@@ -186,7 +178,6 @@ begin_test "env with other remote"
186178
(
187179
set -e
188180
reponame="env-other-remote"
189-
unset_vars
190181
mkdir $reponame
191182
cd $reponame
192183
git init
@@ -245,7 +236,6 @@ begin_test "env with multiple remotes and lfs.url config"
245236
(
246237
set -e
247238
reponame="env-multiple-remotes-with-lfs-url"
248-
unset_vars
249239
mkdir $reponame
250240
cd $reponame
251241
git init
@@ -305,7 +295,6 @@ begin_test "env with multiple remotes and lfs configs"
305295
(
306296
set -e
307297
reponame="env-multiple-remotes-lfs-configs"
308-
unset_vars
309298
mkdir $reponame
310299
cd $reponame
311300
git init
@@ -367,7 +356,6 @@ begin_test "env with multiple remotes and batch configs"
367356
(
368357
set -e
369358
reponame="env-multiple-remotes-lfs-batch-configs"
370-
unset_vars
371359
mkdir $reponame
372360
cd $reponame
373361
git init
@@ -429,8 +417,6 @@ begin_test "env with .lfsconfig"
429417
(
430418
set -e
431419
reponame="env-with-lfsconfig"
432-
unset_vars
433-
434420
git init $reponame
435421
cd $reponame
436422

@@ -499,7 +485,6 @@ begin_test "env with environment variables"
499485
(
500486
set -e
501487
reponame="env-with-envvars"
502-
unset_vars
503488
git init $reponame
504489
mkdir -p $reponame/a/b/c
505490

@@ -677,7 +662,6 @@ begin_test "env with bare repo"
677662
(
678663
set -e
679664
reponame="env-with-bare-repo"
680-
unset_vars
681665
git init --bare $reponame
682666
cd $reponame
683667

@@ -725,7 +709,6 @@ begin_test "env with multiple ssh remotes"
725709
(
726710
set -e
727711
reponame="env-with-ssh"
728-
unset_vars
729712
mkdir $reponame
730713
cd $reponame
731714
git init
@@ -877,7 +860,6 @@ begin_test "env with extra transfer methods"
877860
(
878861
set -e
879862
reponame="env-with-transfers"
880-
unset_vars
881863
git init $reponame
882864
cd $reponame
883865

@@ -938,7 +920,6 @@ begin_test "env with multiple remotes and ref"
938920
(
939921
set -e
940922
reponame="env-multiple-remotes-ref"
941-
unset_vars
942923
mkdir $reponame
943924
cd $reponame
944925
git init
@@ -1001,7 +982,6 @@ begin_test "env with unicode"
1001982
# This contains a Unicode apostrophe, an E with grave accent, and a Euro sign.
1002983
# Only the middle one is representable in ISO-8859-1.
1003984
reponame="env-d’autre-nom-très-bizarr€"
1004-
unset_vars
1005985
mkdir $reponame
1006986
cd $reponame
1007987
git init
@@ -1063,7 +1043,6 @@ end_test
10631043
begin_test "env outside a repository"
10641044
(
10651045
set -e
1066-
unset_vars
10671046

10681047
# This may or may not work, depending on the system, but it should at least
10691048
# potentially cause Git to print non-English messages.
@@ -1113,7 +1092,6 @@ begin_test "env with duplicate endpoints"
11131092
(
11141093
set -e
11151094
reponame="env-duplicate-endpoints"
1116-
unset_vars
11171095
mkdir $reponame
11181096
cd $reponame
11191097
git init

t/t-worktree.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,10 @@ envInitConfig='git config filter.lfs.process = "git-lfs filter-process"
77
git config filter.lfs.smudge = "git-lfs smudge -- %f"
88
git config filter.lfs.clean = "git-lfs clean -- %f"'
99

10-
unset_vars () {
11-
# If set, these will cause the test to fail.
12-
unset GIT_LFS_NO_TEST_COUNT
13-
}
14-
1510
begin_test "git worktree"
1611
(
1712
set -e
1813
reponame="worktree-main"
19-
unset_vars
2014
mkdir $reponame
2115
cd $reponame
2216
git init
@@ -99,7 +93,6 @@ begin_test "git worktree with hooks"
9993
(
10094
set -e
10195
reponame="worktree-hooks"
102-
unset_vars
10396
mkdir $reponame
10497
cd $reponame
10598
git init

t/testhelpers.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -578,17 +578,15 @@ setup() {
578578
git lfs version | sed -e 's/^/# /g'
579579
git version | sed -e 's/^/# /g'
580580

581-
if [ -z "$GIT_LFS_NO_TEST_COUNT" ]; then
582-
LFSTEST_URL="$LFS_URL_FILE" \
583-
LFSTEST_SSL_URL="$LFS_SSL_URL_FILE" \
584-
LFSTEST_CLIENT_CERT_URL="$LFS_CLIENT_CERT_URL_FILE" \
585-
LFSTEST_DIR="$REMOTEDIR" \
586-
LFSTEST_CERT="$LFS_CERT_FILE" \
587-
LFSTEST_CLIENT_CERT="$LFS_CLIENT_CERT_FILE" \
588-
LFSTEST_CLIENT_KEY="$LFS_CLIENT_KEY_FILE" \
589-
LFSTEST_CLIENT_KEY_ENCRYPTED="$LFS_CLIENT_KEY_FILE_ENCRYPTED" \
590-
lfstest-count-tests increment
591-
fi
581+
LFSTEST_URL="$LFS_URL_FILE" \
582+
LFSTEST_SSL_URL="$LFS_SSL_URL_FILE" \
583+
LFSTEST_CLIENT_CERT_URL="$LFS_CLIENT_CERT_URL_FILE" \
584+
LFSTEST_DIR="$REMOTEDIR" \
585+
LFSTEST_CERT="$LFS_CERT_FILE" \
586+
LFSTEST_CLIENT_CERT="$LFS_CLIENT_CERT_FILE" \
587+
LFSTEST_CLIENT_KEY="$LFS_CLIENT_KEY_FILE" \
588+
LFSTEST_CLIENT_KEY_ENCRYPTED="$LFS_CLIENT_KEY_FILE_ENCRYPTED" \
589+
lfstest-count-tests increment
592590

593591
wait_for_file "$LFS_URL_FILE"
594592
wait_for_file "$LFS_SSL_URL_FILE"
@@ -646,11 +644,9 @@ shutdown() {
646644
# every t/t-*.sh file should cleanup its trashdir
647645
[ -z "$KEEPTRASH" ] && rm -rf "$TRASHDIR"
648646

649-
if [ -z "$GIT_LFS_NO_TEST_COUNT" ]; then
650-
LFSTEST_DIR="$REMOTEDIR" \
651-
LFS_URL_FILE="$LFS_URL_FILE" \
652-
lfstest-count-tests decrement
653-
fi
647+
LFSTEST_DIR="$REMOTEDIR" \
648+
LFS_URL_FILE="$LFS_URL_FILE" \
649+
lfstest-count-tests decrement
654650
}
655651

656652
tap_show_plan() {

0 commit comments

Comments
 (0)