blob: 9d1b47a3b26df49ed94c5eeb7e10969dd40622a9 [file] [edit]
#!/bin/bash
# Protocol Buffers - Google's data interchange format
# Copyright 2026 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
#
# Bisect the set of fasttable parsing functions to find the one(s) causing a
# test failure.
#
# Example usage:
#
# $ bazel test --//upb:fasttable_enabled=True upb/...
#
# # We notice that //upb/test:test_generated_code is failing
# # when fasttable is enabled. We can bisect the set of fasttable parsing
# # functions with this command:
#
# $ upb/wire/decode_fast/bisect.sh upb/test:test_generated_code
#
# Note that the map parsers are not part of the bisected range: they use
# out-of-band function indices rather than the (type, cardinality, tag size)
# numbering that UPB_DECODEFAST_DISABLE_FUNCTIONS_ABOVE walks. To check whether
# they are implicated, disable them all at once with:
#
# $ bazel test --//upb:fasttable_enabled=True \
# --per_file_copt=//upb/wire/decode_fast:select@-DUPB_DECODEFAST_DISABLE_MAPS \
# --host_per_file_copt=//upb/wire/decode_fast:select@-DUPB_DECODEFAST_DISABLE_MAPS \
# <test_target(s)>
if [[ $# -lt 1 ]]; then
echo "Usage: bisect.sh [bazel test flags] <test_target(s)>"
exit 1
fi
set -ex
/google/data/ro/teams/tetralight/bin/bisect -low 0 -high 256 \
"bazel test --//upb:fasttable_enabled=True \
--per_file_copt=//upb/wire/decode_fast:select@-DUPB_DECODEFAST_DISABLE_FUNCTIONS_ABOVE=\$X \
--host_per_file_copt=//upb/wire/decode_fast:select@-DUPB_DECODEFAST_DISABLE_FUNCTIONS_ABOVE=\$X \
$*"