@@ -25,10 +25,12 @@ BOOST_INSTALL_FOLDER=/home/dependencies/boost
2525# Assumes script is executed from the root of aws-lc directory
2626SCRATCH_FOLDER=${SYS_ROOT} /" MYSQL_BUILD_ROOT"
2727MYSQL_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"
2930AWS_LC_BUILD_FOLDER=" ${SCRATCH_FOLDER} /aws-lc-build"
3031AWS_LC_INSTALL_FOLDER=" ${MYSQL_SRC_FOLDER} /aws-lc-install"
3132
33+
3234mkdir -p ${SCRATCH_FOLDER}
3335rm -rf ${SCRATCH_FOLDER} /*
3436cd ${SCRATCH_FOLDER}
@@ -43,17 +45,77 @@ function mysql_patch_reminder() {
4345}
4446
4547function 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
5153function 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.
58120mysql_patch_reminder
59121git clone https://github.com/mysql/mysql-server.git ${MYSQL_SRC_FOLDER} -b ${MYSQL_VERSION_TAG} --depth 1
62124
63125aws_lc_build ${SRC_ROOT} ${AWS_LC_BUILD_FOLDER} ${AWS_LC_INSTALL_FOLDER}
64126pushd ${MYSQL_SRC_FOLDER}
127+ mysql_patch_tests
128+ mysql_patch_error_strings
65129mysql_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
68131popd
0 commit comments