Merge branch 'ds/more-index-cleanups'
Cleaning various codepaths up. * ds/more-index-cleanups: t1092: test interesting sparse-checkout scenarios test-lib: test_region looks for trace2 regions sparse-checkout: load sparse-checkout patterns name-hash: use trace2 regions for init repository: add repo reference to index_state fsmonitor: de-duplicate BUG()s around dirty bits cache-tree: extract subtree_pos() cache-tree: simplify verify_cache() prototype cache-tree: clean up cache_tree_update()
This commit is contained in:
@ -1683,3 +1683,45 @@ test_subcommand () {
|
||||
grep "\[$expr\]"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that the given command was invoked as part of the
|
||||
# trace2-format trace on stdin.
|
||||
#
|
||||
# test_region [!] <category> <label> git <command> <args>...
|
||||
#
|
||||
# For example, to look for trace2_region_enter("index", "do_read_index", repo)
|
||||
# in an invocation of "git checkout HEAD~1", run
|
||||
#
|
||||
# GIT_TRACE2_EVENT="$(pwd)/trace.txt" GIT_TRACE2_EVENT_NESTING=10 \
|
||||
# git checkout HEAD~1 &&
|
||||
# test_region index do_read_index <trace.txt
|
||||
#
|
||||
# If the first parameter passed is !, this instead checks that
|
||||
# the given region was not entered.
|
||||
#
|
||||
test_region () {
|
||||
local expect_exit=0
|
||||
if test "$1" = "!"
|
||||
then
|
||||
expect_exit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
grep -e '"region_enter".*"category":"'"$1"'","label":"'"$2"\" "$3"
|
||||
exitcode=$?
|
||||
|
||||
if test $exitcode != $expect_exit
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
grep -e '"region_leave".*"category":"'"$1"'","label":"'"$2"\" "$3"
|
||||
exitcode=$?
|
||||
|
||||
if test $exitcode != $expect_exit
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user