Don't run ASAN unit tests under gdb

This commit is contained in:
Raúl Marín 2024-08-01 18:59:17 +02:00
parent 58998d7069
commit 4e9761acf9
3 changed files with 25 additions and 3 deletions

View File

@ -4,4 +4,4 @@ ARG FROM_TAG=latest
FROM clickhouse/test-base:$FROM_TAG
COPY run.sh /
CMD ["/bin/bash", "/run.sh"]
ENTRYPOINT ["/run.sh"]

View File

@ -2,4 +2,23 @@
set -x
timeout 40m gdb -q -ex 'set print inferior-events off' -ex 'set confirm off' -ex 'set print thread-events off' -ex run -ex bt -ex quit --args ./unit_tests_dbms --gtest_output='json:test_output/test_result.json' | tee test_output/test_result.txt
if [ "$#" -ne 1 ]; then
echo "Expected exactly one argument"
exit 1
fi
if [ "$1" = "GDB" ];
then
timeout 40m \
gdb -q -ex "set print inferior-events off" -ex "set confirm off" -ex "set print thread-events off" -ex run -ex bt -ex quit --args \
./unit_tests_dbms --gtest_output='json:test_output/test_result.json' \
| tee test_output/test_result.txt
elif [ "$1" = "NO_GDB" ];
then
timeout 40m \
./unit_tests_dbms --gtest_output='json:test_output/test_result.json' \
| tee test_output/test_result.txt
else
echo "Unknown argument: $1"
exit 1
fi

View File

@ -174,10 +174,13 @@ def main():
test_output = temp_path / "test_output"
test_output.mkdir(parents=True, exist_ok=True)
# Don't run ASAN under gdb since that breaks leak detection
gdb_enabled = "NO_GDB" if "asan" in check_name else "GDB"
run_command = (
f"docker run --cap-add=SYS_PTRACE --volume={tests_binary}:/unit_tests_dbms "
"--security-opt seccomp=unconfined " # required to issue io_uring sys-calls
f"--volume={test_output}:/test_output {docker_image}"
f"--volume={test_output}:/test_output {docker_image} ${gdb_enabled}"
)
run_log_path = test_output / "run.log"