Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the suppressions script to source runtime suppressions in run_tests.py #28140

Merged
merged 5 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions testing/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ def main():
help='Generate coverage reports for each unit test framework run.')
parser.add_argument('--engine-capture-core-dump', dest='engine_capture_core_dump', action='store_true',
default=False, help='Capture core dumps from crashes of engine tests.')
parser.add_argument('--asan-options', dest='asan_options', action='store', type=str, default='',
help='Runtime AddressSanitizer flags to use if built wth asan (example: "verbosity=1:detect_leaks=0')
parser.add_argument('--use-sanitizer-suppressions', dest='sanitizer_suppressions', action='store_true',
default=False, help='Provide the sanitizer suppressions lists to the via environment to the tests.')

args = parser.parse_args()

Expand All @@ -559,8 +559,17 @@ def main():
if args.type != 'java':
assert os.path.exists(build_dir), 'Build variant directory %s does not exist!' % build_dir

if args.asan_options:
os.environ['ASAN_OPTIONS'] = args.asan_options
if args.sanitizer_suppressions:
file_dir = os.path.dirname(os.path.abspath(__file__))
command = [
"env", "-i", "bash",
"-c", "source {}/sanitizer_suppressions.sh >/dev/null && env".format(file_dir)
]
process = subprocess.Popen(command, stdout=subprocess.PIPE)
for line in process.stdout:
key, _, value = str(line).partition("=")
os.environ[key] = value
process.communicate() # Avoid pipe deadlock while waiting for termination.

engine_filter = args.engine_filter.split(',') if args.engine_filter else None
if 'engine' in types:
Expand Down
10 changes: 5 additions & 5 deletions testing/sanitizer_suppressions.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
CURRENT_DIRECTORY="$(pwd)/$(dirname "$0")"
TESTING_DIRECTORY=$(dirname "${BASH_SOURCE[0]}")

TSAN_SUPPRESSIONS_FILE="${CURRENT_DIRECTORY}/tsan_suppressions.txt"
TSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/tsan_suppressions.txt"
export TSAN_OPTIONS="suppressions=${TSAN_SUPPRESSIONS_FILE}"
echo "Using Thread Sanitizer suppressions in ${TSAN_SUPPRESSIONS_FILE}"

LSAN_SUPPRESSIONS_FILE="${CURRENT_DIRECTORY}/lsan_suppressions.txt"
LSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/lsan_suppressions.txt"
export LSAN_OPTIONS="suppressions=${LSAN_SUPPRESSIONS_FILE}"
echo "Using Leak Sanitizer suppressions in ${LSAN_SUPPRESSIONS_FILE}"

UBSAN_SUPPRESSIONS_FILE="${CURRENT_DIRECTORY}/ubsan_suppressions.txt"
UBSAN_SUPPRESSIONS_FILE="${TESTING_DIRECTORY}/ubsan_suppressions.txt"
export UBSAN_OPTIONS="suppressions=${UBSAN_SUPPRESSIONS_FILE}"
echo "Using Undefined Behavior suppressions in ${UBSAN_SUPPRESSIONS_FILE}"


export ASAN_OPTIONS="detect_leaks=1"
export ASAN_OPTIONS="detect_leaks=0:detect_container_overflow=0"