зеркало из https://github.com/microsoft/git.git
Merge branch 'bp/rename-test-env-var'
Some environment variables that control the runtime options of Git used during tests are getting renamed for consistency. * bp/rename-test-env-var: t0000: do not get self-test disrupted by environment warnings preload-index: update GIT_FORCE_PRELOAD_TEST support read-cache: update TEST_GIT_INDEX_VERSION support fsmonitor: update GIT_TEST_FSMONITOR support preload-index: use git_env_bool() not getenv() for customization t/README: correct spelling of "uncommon"
This commit is contained in:
Коммит
340fde61be
6
Makefile
6
Makefile
|
@ -400,7 +400,7 @@ all::
|
|||
# (defaults to "man") if you want to have a different default when
|
||||
# "git help" is called without a parameter specifying the format.
|
||||
#
|
||||
# Define TEST_GIT_INDEX_VERSION to 2, 3 or 4 to run the test suite
|
||||
# Define GIT_TEST_INDEX_VERSION to 2, 3 or 4 to run the test suite
|
||||
# with a different indexfile format version. If it isn't set the index
|
||||
# file format used is index-v[23].
|
||||
#
|
||||
|
@ -2610,8 +2610,8 @@ endif
|
|||
ifdef GIT_INTEROP_MAKE_OPTS
|
||||
@echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
|
||||
endif
|
||||
ifdef TEST_GIT_INDEX_VERSION
|
||||
@echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
|
||||
ifdef GIT_TEST_INDEX_VERSION
|
||||
@echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
|
||||
endif
|
||||
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
|
||||
|
||||
|
|
2
config.c
2
config.c
|
@ -2278,7 +2278,7 @@ int git_config_get_max_percent_split_change(void)
|
|||
int git_config_get_fsmonitor(void)
|
||||
{
|
||||
if (git_config_get_pathname("core.fsmonitor", &core_fsmonitor))
|
||||
core_fsmonitor = getenv("GIT_FSMONITOR_TEST");
|
||||
core_fsmonitor = getenv("GIT_TEST_FSMONITOR");
|
||||
|
||||
if (core_fsmonitor && !*core_fsmonitor)
|
||||
core_fsmonitor = NULL;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "pathspec.h"
|
||||
#include "dir.h"
|
||||
#include "fsmonitor.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef NO_PTHREADS
|
||||
static void preload_index(struct index_state *index,
|
||||
|
@ -83,7 +84,7 @@ static void preload_index(struct index_state *index,
|
|||
return;
|
||||
|
||||
threads = index->cache_nr / THREAD_COST;
|
||||
if ((index->cache_nr > 1) && (threads < 2) && getenv("GIT_FORCE_PRELOAD_TEST"))
|
||||
if ((index->cache_nr > 1) && (threads < 2) && git_env_bool("GIT_TEST_PRELOAD_INDEX", 0))
|
||||
threads = 2;
|
||||
if (threads < 2)
|
||||
return;
|
||||
|
|
13
t/README
13
t/README
|
@ -315,7 +315,7 @@ packs on demand. This normally only happens when the object size is
|
|||
over 2GB. This variable forces the code path on any object larger than
|
||||
<n> bytes.
|
||||
|
||||
GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncomon pack-objects code
|
||||
GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncommon pack-objects code
|
||||
path where deltas larger than this limit require extra memory
|
||||
allocation for bookkeeping.
|
||||
|
||||
|
@ -327,6 +327,17 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
|
|||
be written after every 'git commit' command, and overrides the
|
||||
'core.commitGraph' setting to true.
|
||||
|
||||
GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
|
||||
code path for utilizing a file system monitor to speed up detecting
|
||||
new or changed files.
|
||||
|
||||
GIT_TEST_INDEX_VERSION=<n> exercises the index read/write code path
|
||||
for the index version specified. Can be set to any valid version
|
||||
(currently 2, 3, or 4).
|
||||
|
||||
GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
|
||||
by overriding the minimum number of cache entries required per thread.
|
||||
|
||||
Naming Tests
|
||||
------------
|
||||
|
||||
|
|
|
@ -87,6 +87,10 @@ _run_sub_test_lib_test_common () {
|
|||
passing metrics
|
||||
'
|
||||
|
||||
# Tell the framework that we are self-testing to make sure
|
||||
# it yields a stable result.
|
||||
GIT_TEST_FRAMEWORK_SELFTEST=t &&
|
||||
|
||||
# Point to the t/test-lib.sh, which isn't in ../ as usual
|
||||
. "\$TEST_DIRECTORY"/test-lib.sh
|
||||
EOF
|
||||
|
|
|
@ -6,7 +6,7 @@ test_description='split index mode tests'
|
|||
|
||||
# We need total control of index splitting here
|
||||
sane_unset GIT_TEST_SPLIT_INDEX
|
||||
sane_unset GIT_FSMONITOR_TEST
|
||||
sane_unset GIT_TEST_FSMONITOR
|
||||
|
||||
test_expect_success 'enable split index' '
|
||||
git config splitIndex.maxPercentChange 100 &&
|
||||
|
|
|
@ -4,13 +4,6 @@ test_description='git status with file system watcher'
|
|||
|
||||
. ./test-lib.sh
|
||||
|
||||
#
|
||||
# To run the entire git test suite using fsmonitor:
|
||||
#
|
||||
# copy t/t7519/fsmonitor-all to a location in your path and then set
|
||||
# GIT_FSMONITOR_TEST=fsmonitor-all and run your tests.
|
||||
#
|
||||
|
||||
# Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'
|
||||
# "git update-index --fsmonitor" can be used to get the extension written
|
||||
# before testing the results.
|
||||
|
@ -245,9 +238,9 @@ do
|
|||
git config core.preloadIndex $preload_val &&
|
||||
if test $preload_val = true
|
||||
then
|
||||
GIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST
|
||||
GIT_TEST_PRELOAD_INDEX=$preload_val; export GIT_TEST_PRELOAD_INDEX
|
||||
else
|
||||
unset GIT_FORCE_PRELOAD_TEST
|
||||
sane_unset GIT_TEST_PRELOAD_INDEX
|
||||
fi
|
||||
'
|
||||
|
||||
|
|
|
@ -134,9 +134,40 @@ export EDITOR
|
|||
GIT_TRACE_BARE=1
|
||||
export GIT_TRACE_BARE
|
||||
|
||||
if test -n "${TEST_GIT_INDEX_VERSION:+isset}"
|
||||
check_var_migration () {
|
||||
# the warnings and hints given from this helper depends
|
||||
# on end-user settings, which will disrupt the self-test
|
||||
# done on the test framework itself.
|
||||
case "$GIT_TEST_FRAMEWORK_SELFTEST" in
|
||||
t) return ;;
|
||||
esac
|
||||
|
||||
old_name=$1 new_name=$2
|
||||
eval "old_isset=\${${old_name}:+isset}"
|
||||
eval "new_isset=\${${new_name}:+isset}"
|
||||
|
||||
case "$old_isset,$new_isset" in
|
||||
isset,)
|
||||
echo >&2 "warning: $old_name is now $new_name"
|
||||
echo >&2 "hint: set $new_name too during the transition period"
|
||||
eval "$new_name=\$$old_name"
|
||||
;;
|
||||
isset,isset)
|
||||
# do this later
|
||||
# echo >&2 "warning: $old_name is now $new_name"
|
||||
# echo >&2 "hint: remove $old_name"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
|
||||
check_var_migration TEST_GIT_INDEX_VERSION GIT_TEST_INDEX_VERSION
|
||||
check_var_migration GIT_FORCE_PRELOAD_TEST GIT_TEST_PRELOAD_INDEX
|
||||
|
||||
# Use specific version of the index file format
|
||||
if test -n "${GIT_TEST_INDEX_VERSION:+isset}"
|
||||
then
|
||||
GIT_INDEX_VERSION="$TEST_GIT_INDEX_VERSION"
|
||||
GIT_INDEX_VERSION="$GIT_TEST_INDEX_VERSION"
|
||||
export GIT_INDEX_VERSION
|
||||
fi
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче