This updates the patch to set max-requests to 0, ensuring that we always run for the full 60s, and uses 1 thread per core on the test system.
diff -urpN mysql-5.7-5.7.20.orig/debian/tests/control mysql-5.7-5.7.20/debian/tests/control --- mysql-5.7-5.7.20.orig/debian/tests/control 2017-11-29 08:15:49.000000000 -0700 +++ mysql-5.7-5.7.20/debian/tests/control 2017-12-15 12:11:24.444111856 -0700 @@ -2,6 +2,10 @@ Tests: smoke Depends: mysql-server-5.7 Restrictions: allow-stderr needs-root breaks-testbed +Tests: sysbench +Depends: mysql-server-5.6, sysbench +Restrictions: allow-stderr needs-root breaks-testbed + Tests: upstream Depends: mysql-testsuite-5.7 Restrictions: allow-stderr breaks-testbed diff -urpN mysql-5.7-5.7.20.orig/debian/tests/sysbench mysql-5.7-5.7.20/debian/tests/sysbench --- mysql-5.7-5.7.20.orig/debian/tests/sysbench 1969-12-31 17:00:00.000000000 -0700 +++ mysql-5.7-5.7.20/debian/tests/sysbench 2017-12-15 12:12:28.140119805 -0700 @@ -0,0 +1,58 @@ +#!/bin/sh +set -ex + +# dep8 sysbench test for mysql-server +# Author: dann frazier <da...@debian.org> +# +# This test should be declared in debian/tests/control with the +# following restrictions: +# +# needs-root (needed to reset the root mysql password) +# breaks-testbed (because it resets the root mysql password) +# allow-stderr +# +# This test runs sysbench against a test database. The goal is to see if the +# server is stable enough to deal with multiple threads of concurrent activity. +# It serves as a regression test for LP: #1427406 (arm64/ppc64-specific). +# + +debconf-set-selections <<EOT +mysql-server-5.6 mysql-server/root_password password rootpassword +mysql-server-5.6 mysql-server/root_password_again password rootpassword +EOT + +DEBIAN_FRONTEND=noninteractive dpkg-reconfigure mysql-server-5.6 + +cleanup() { + local ret=0 + local mysqlclient="mysql --user=root --password=rootpassword" + + echo "DROP DATABASE sbtest;" | $mysqlclient || ret=1 + echo "DROP USER 'testuser'@'localhost';" | $mysqlclient || ret=1 + + return $ret +} + +do_sysbench() { + sysbench \ + --test=oltp \ + --num-threads=$(nproc) \ + --max-requests=0 \ + --max-time=60 \ + --mysql-user=testuser \ + --mysql-password=testpassword \ + $1 +} + +cleanup || /bin/true # in case a previous run failed + +mysql --user=root --password=rootpassword <<EOT +CREATE DATABASE sbtest; +CREATE USER 'testuser'@'localhost' identified by 'testpassword'; +GRANT ALL ON sbtest.* TO 'testuser'@'localhost'; +EOT + +do_sysbench prepare +do_sysbench run + +cleanup