Skip to content

Commit 9977a16

Browse files
committed
script/cibuild,t: always enable test count locks
In commit 9b73c80 of PR git-lfs#3125 the GIT_LFS_LOCK_ACQUIRE_DISABLED environment variable was introduced for use with our test suites. When this variable was set to the value "1", it indicated to the lfstest-count-tests test utility that it should skip creating a test_count.lock file before updating the test_count file we use to track the number of active test suites. 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 by skipping the creation of a lock file altogether on Windows. This change was also made in conjunction with the addition of another environment variable, GIT_LFS_NO_TEST_COUNT, in commit c591ff7 of the same PR. That variable is also set only on Windows, and stops the setup() and shutdown() shell functions defined in our t/testhelpers.sh script from calling the lfstest-count-tests program. As we have now resolved the underlying problem in the lfstest-count-tests utility, in a prior commit in this PR, we can now remove both of these environment variables and the test suite features they control. We start by removing support for the GIT_LFS_LOCK_ACQUIRE_DISABLED environment variable from the lfstest-count-tests utility, and changing our script/cibuild script so it no longer sets the variable. We can also remove the environment variable from the list of those we unset before running certain tests. We had to introduce 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 42b6649 commit 9977a16

File tree

4 files changed

+2
-21
lines changed

4 files changed

+2
-21
lines changed

script/cibuild

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

1615
# Build git-lfs-transfer from scutiger.

t/cmd/lfstest-count-tests.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,6 @@ var (
170170
// acquire acquires the lock file necessary to perform updates to test_count,
171171
// and returns an error if that lock cannot be acquired.
172172
func acquire(ctx context.Context) error {
173-
if disabled() {
174-
return nil
175-
}
176-
177173
path, err := path(lockFile)
178174
if err != nil {
179175
return err
@@ -205,10 +201,6 @@ func acquire(ctx context.Context) error {
205201
// release releases the lock file so that another process can take over, or
206202
// returns an error.
207203
func release() error {
208-
if disabled() {
209-
return nil
210-
}
211-
212204
path, err := path(lockFile)
213205
if err != nil {
214206
return err
@@ -279,16 +271,6 @@ func path(s string) (string, error) {
279271
return p, nil
280272
}
281273

282-
// disabled returns true if and only if the lock acquisition phase is disabled.
283-
func disabled() bool {
284-
s := os.Getenv("GIT_LFS_LOCK_ACQUIRE_DISABLED")
285-
b, err := strconv.ParseBool(s)
286-
if err != nil {
287-
return false
288-
}
289-
return b
290-
}
291-
292274
// fatal reports the given error (if non-nil), and then dies. If the error was
293275
// nil, nothing happens.
294276
func fatal(err error) {

t/t-env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git config filter.lfs.clean = "git-lfs clean -- %f"'
88

99
unset_vars() {
1010
# If set, these will cause the test to fail.
11-
unset GIT_LFS_NO_TEST_COUNT GIT_LFS_LOCK_ACQUIRE_DISABLED
11+
unset GIT_LFS_NO_TEST_COUNT
1212
}
1313

1414
begin_test "env with no remote"

t/t-worktree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ git config filter.lfs.clean = "git-lfs clean -- %f"'
99

1010
unset_vars () {
1111
# If set, these will cause the test to fail.
12-
unset GIT_LFS_NO_TEST_COUNT GIT_LFS_LOCK_ACQUIRE_DISABLED
12+
unset GIT_LFS_NO_TEST_COUNT
1313
}
1414

1515
begin_test "git worktree"

0 commit comments

Comments
 (0)