Skip to content

Commit f5233e1

Browse files
Turn on tests in CI dimension for mySQL (#1063)
We've recently resolved missing symbols and gaps for mySQL. This turns on running unit tests with MySQL/AWS-LC.
1 parent 56067dc commit f5233e1

File tree

5 files changed

+104
-10
lines changed

5 files changed

+104
-10
lines changed

tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ batch:
3535
compute-type: BUILD_GENERAL1_MEDIUM
3636
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-22.04_gcc-12x_latest
3737

38-
# Only runs the build for now, tests are disabled. MySQL build is bloated without any obvious build configurations we can
39-
# use to speed up the build, so we use a larger instance here.
38+
# MySQL build is bloated without any obvious build configurations we can use to speed up the build, so we use a larger instance here.
4039
- identifier: mysql_integration
4140
buildspec: tests/ci/codebuild/common/run_simple_target.yml
4241
env:

tests/ci/docker_images/linux-x86/ubuntu-22.04_base/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN set -ex && \
4040
llvm-dev \
4141
libicu-dev \
4242
libipc-run-perl \
43+
libjson-perl \
4344
libpcre2-dev \
4445
libreadline-dev \
4546
libudev-dev \
@@ -63,7 +64,6 @@ RUN set -ex && \
6364
# Download a copy of LLVM's libcxx which is required for building and running with Memory Sanitizer
6465
git clone https://github.com/llvm/llvm-project.git --branch llvmorg-11.1.0 --depth 1 && \
6566
cd llvm-project && rm -rf $(ls -A | grep -Ev "(libcxx|libcxxabi)") && \
66-
apt-get --purge remove -y unzip && \
6767
apt-get autoremove --purge -y && \
6868
apt-get clean && \
6969
apt-get autoclean && \
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
diff --git a/testclients/mysql_client_test.cc b/testclients/mysql_client_test.cc
2+
index f1e6744b..26021419 100644
3+
--- a/testclients/mysql_client_test.cc
4+
+++ b/testclients/mysql_client_test.cc
5+
@@ -23050,6 +23050,9 @@ static void test_bug32915973() {
6+
mysql_stmt_close(stmt);
7+
}
8+
9+
+/* This test uses stateful session resumption, which is not supported in AWS-LC. */
10+
+#if !defined (OPENSSL_IS_AWSLC)
11+
+
12+
static void test_wl13075() {
13+
int rc;
14+
myheader("test_wl13075");
15+
@@ -23182,6 +23185,7 @@ static void test_wl13075() {
16+
DIE_UNLESS(ret_ses_data == nullptr);
17+
}
18+
}
19+
+#endif
20+
21+
static void finish_with_error(MYSQL *con) {
22+
fprintf(stderr, "[%i] %s\n", mysql_errno(con), mysql_error(con));
23+
@@ -23841,7 +23845,9 @@ static struct my_tests_st my_tests[] = {
24+
{"test_bug32892045", test_bug32892045},
25+
{"test_bug33164347", test_bug33164347},
26+
{"test_bug32915973", test_bug32915973},
27+
+#if !defined (OPENSSL_IS_AWSLC)
28+
{"test_wl13075", test_wl13075},
29+
+#endif
30+
{"test_bug34007830", test_bug34007830},
31+
{"test_bug33535746", test_bug33535746},
32+
{"test_server_telemetry_traces", test_server_telemetry_traces},

tests/ci/integration/run_mariadb_integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function mariadb_run_tests() {
5353
# More complicated integration tests. mtr expects to be launched in-place and with write access to it's own directories
5454
#
5555
# main.plugin_load passes, but is skipped over since it generates a warning when we run the script in Codebuild. Warnings will cause
56-
# a failure in MariaDB's test runs, unless --nowarnings is turned on. The warning is not reproducable in Gitlab's CI or any local
56+
# a failure in MariaDB's test runs, unless --nowarnings is turned on. The warning is not reproducible in Gitlab's CI or any local
5757
# container runs. This test isn't relevant to AWS-LC integration so we skip over the Codebuild specific issue for now.
5858
echo "main.mysqldump : Field separator argument is not what is expected; check the manual when executing 'SELECT INTO OUTFILE'
5959
main.flush_logs_not_windows : query 'flush logs' succeeded - should have failed with error ER_CANT_CREATE_FILE (1004)

tests/ci/integration/run_mysql_integration.sh

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ BOOST_INSTALL_FOLDER=/home/dependencies/boost
2525
# Assumes script is executed from the root of aws-lc directory
2626
SCRATCH_FOLDER=${SYS_ROOT}/"MYSQL_BUILD_ROOT"
2727
MYSQL_SRC_FOLDER="${SCRATCH_FOLDER}/mysql-server"
28-
MYSQL_BUILD_FOLDER="${SCRATCH_FOLDER}/server/mysql-aws-lc"
28+
MYSQL_BUILD_FOLDER="${SCRATCH_FOLDER}/mysql-aws-lc"
29+
MYSQL_PATCH_FOLDER=${SRC_ROOT}/"tests/ci/integration/mysql_patch"
2930
AWS_LC_BUILD_FOLDER="${SCRATCH_FOLDER}/aws-lc-build"
3031
AWS_LC_INSTALL_FOLDER="${MYSQL_SRC_FOLDER}/aws-lc-install"
3132

33+
3234
mkdir -p ${SCRATCH_FOLDER}
3335
rm -rf ${SCRATCH_FOLDER}/*
3436
cd ${SCRATCH_FOLDER}
@@ -43,17 +45,77 @@ function mysql_patch_reminder() {
4345
}
4446

4547
function mysql_build() {
46-
cmake ${MYSQL_SRC_FOLDER} -GNinja -DENABLED_PROFILING=OFF -DWITH_NDB_JAVA=OFF -DWITH_BOOST=${BOOST_INSTALL_FOLDER} -DWITH_SSL=${AWS_LC_INSTALL_FOLDER} "-B${MYSQL_BUILD_FOLDER}"
48+
cmake ${MYSQL_SRC_FOLDER} -GNinja -DWITH_BOOST=${BOOST_INSTALL_FOLDER} -DWITH_SSL=${AWS_LC_INSTALL_FOLDER} "-B${MYSQL_BUILD_FOLDER}"
4749
ninja -C ${MYSQL_BUILD_FOLDER}
4850
ls -R ${MYSQL_BUILD_FOLDER}
4951
}
5052

5153
function mysql_run_tests() {
52-
pushd ${MYSQL_BUILD_FOLDER}
53-
ninja test
54+
pushd ${MYSQL_BUILD_FOLDER}/mysql-test
55+
# More complicated integration tests. mtr expects to be launched in-place and with write access to it's own directories.
56+
#
57+
# Tests marked with Bug#0000 are tests that have are known to fail in containerized environments. These tests aren't exactly relevant
58+
# to testing AWS-LC functionality.
59+
# Tests marked with Bug#0001 use DHE cipher suites for the connection. AWS-LC has no intention of supporting DHE cipher suites.
60+
# Tests marked with Bug#0002 use stateful session resumption, otherwise known as session caching. It is known that AWS-LC does not
61+
# currently support this.
62+
echo "main.mysqlpump_bugs : Bug#0000 Can't create/open a file ~/dump.sql'
63+
main.restart_server : Bug#0000 mysqld is not managed by supervisor process
64+
main.file_contents : Bug#0000 Cannot open 'INFO_SRC' in ''
65+
main.resource_group_thr_prio_unsupported : Bug#0000 Invalid thread priority value -5
66+
main.dd_upgrade_error : Bug#0000 running mysqld as root
67+
main.dd_upgrade_error_cs : Bug#0000 running mysqld as root
68+
main.basedir : Bug#0000 running mysqld as root
69+
main.lowercase_fs_off : Bug#0000 running mysqld as root
70+
main.upgrade : Bug#0000 running mysqld as root
71+
main.mysqld_cmdline_warnings : Bug#0000 running mysqld as root
72+
main.mysqld_daemon : Bug#0000 failed, error: 256, status: 1, errno: 2.
73+
main.mysqld_safe : Bug#0000 nonexistent: No such file or directory
74+
main.grant_user_lock : Bug#0000 Access denied for user root at localhost
75+
main.persisted_variables_bugs_fast : Bug#0000 Unsure
76+
main.mysqldump : Bug#0000 contains nonaggregated column
77+
main.func_math : Bug#0000 should have failed with errno 1690
78+
main.derived_condition_pushdown : Bug#0000 Fails with OpenSSL as well. Not relevant to AWS-LC.
79+
main.grant_alter_user_qa : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
80+
main.grant_user_lock_qa : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
81+
main.openssl_1 : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
82+
main.ssl : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
83+
main.ssl_cipher : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
84+
main.ssl_dynamic : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
85+
main.ssl-sha512 : Bug#0001 Uses DHE cipher suites in test, which AWS-LC does not support.
86+
main.ssl_cache : Bug#0002 AWS-LC does not support Stateful session resumption (Session Caching).
87+
main.ssl_cache_tls13 : Bug#0002 AWS-LC does not support Stateful session resumption (Session Caching).
88+
"> skiplist
89+
./mtr --suite=main --force --parallel=auto --skip-test-list=${MYSQL_BUILD_FOLDER}/mysql-test/skiplist --retry-failure=3
5490
popd
5591
}
5692

93+
# MySQL tests expect the OpenSSL style of error messages. We patch this to expect AWS-LC's style.
94+
# These are checked as part of mySQL's unit tests, but we don't actually run them in our CI. They are known to be flaky
95+
# within docker containers. The mtr tests are much more robust and run full server test suites that actually do TLS
96+
# connections end-to-end.
97+
# TODO: Remove this when we make an upstream contribution.
98+
function mysql_patch_error_strings() {
99+
MYSQL_TEST_FILES=("test_routing_splicer.cc" "test_http_server.cc")
100+
MYSQL_ERROR_STRING=("certificate verify failed" "no start line" "ee key too small")
101+
AWS_LC_EXPECTED_ERROR_STRING=("CERTIFICATE_VERIFY_FAILED" "NO_START_LINE" "key-size too small")
102+
for file in "${MYSQL_TEST_FILES[@]}"; do
103+
for i in "${!MYSQL_ERROR_STRING[@]}"; do
104+
find ./ -type f -name "$file" | xargs sed -i -e "s|${MYSQL_ERROR_STRING[$i]}|${AWS_LC_EXPECTED_ERROR_STRING[$i]}|g"
105+
done
106+
done
107+
}
108+
109+
# MySQL relies on some behaviour that AWS-LC intentionally does not provide support for. Some of these known gaps are listed below:
110+
# * DH cipher suites in libssl
111+
# * Stateful session resumption
112+
function mysql_patch_tests() {
113+
for patchfile in $(find -L "${MYSQL_PATCH_FOLDER}" -type f -name '*.patch'); do
114+
echo "Apply patch $patchfile..."
115+
patch -p1 --quiet -i "$patchfile"
116+
done
117+
}
118+
57119
# Get latest MySQL version. MySQL often updates with large changes depending on OpenSSL all at once, so we pin to a specific version.
58120
mysql_patch_reminder
59121
git clone https://github.com/mysql/mysql-server.git ${MYSQL_SRC_FOLDER} -b ${MYSQL_VERSION_TAG} --depth 1
@@ -62,7 +124,8 @@ ls
62124

63125
aws_lc_build ${SRC_ROOT} ${AWS_LC_BUILD_FOLDER} ${AWS_LC_INSTALL_FOLDER}
64126
pushd ${MYSQL_SRC_FOLDER}
127+
mysql_patch_tests
128+
mysql_patch_error_strings
65129
mysql_build
66-
# TODO: There are still pending test failures that need to be resolved. Turn this on once we resolve them.
67-
# mysql_run_tests
130+
mysql_run_tests
68131
popd

0 commit comments

Comments
 (0)