Control: tags -1 patch

Hi Otto,

Please find attached a patch and the individual files, whatever you find
more convenient) for adding autopkgtest to MariaDB (tested with 10.0)

Paul
Tests: smoke
Depends: mariadb-server-10.0
Restrictions: allow-stderr needs-root

Tests: upstream
Depends: mariadb-test
Restrictions: allow-stderr breaks-testbed
#!/bin/sh
set -ex

# dep8 smoke test for mysql-server
# Author: Robie Basak <robie.basak at canonical.com>
#
# This test should be declared in debian/tests/control with a dependency
# on the package that provides a configured MariaDB server (eg.
# mariadb-server-10.0).
#
# This test should be declared in debian/tests/control with the
# following restrictions:
#
# needs-root (to be able to log into the database)
# allow-stderr
#
# This test:
#
# 1) Creates a test database and test user as the root user.
#
# 2) Creates a test table and checks it appears to operate normally
# using the test user and test database.

mysql <<EOT
CREATE DATABASE testdatabase;
CREATE USER 'testuser'@'localhost' identified by 'testpassword';
GRANT ALL ON testdatabase.* TO 'testuser'@'localhost';
EOT

mysql testdatabase <<EOT
CREATE TABLE foo (bar INTEGER);
INSERT INTO foo (bar) VALUES (41);
EOT

result=`echo 'SELECT bar+1 FROM foo;'|mysql --batch --skip-column-names 
--user=testuser --password=testpassword testdatabase`
if [ "$result" != "42" ]; then
       echo "Unexpected result" >&2
       exit 1
fi

mysql --user=testuser --password=testpassword testdatabase <<EOT
DROP TABLE foo;
EOT

mysql <<EOT
DROP DATABASE testdatabase;
DROP USER 'testuser'@'localhost';
EOT
#!/bin/sh
# autopkgtest check: Build and run the upstream test suite.
# (C) 2012 Canonical Ltd.
# Author: Daniel Kessel <[email protected]>

# running the mysql testsuite as described in:
# https://bugs.launchpad.net/ubuntu/+source/mysql-5.5/+bug/959683

echo "running test 'testsuite'"
set -e

SKIP_TEST_LST="/tmp/skip-test.lst"
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIRi $SKIP_TEST_LST" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

mkdir var
mkdir tmp

echo "using vardir: $WORKDIR/var"
echo "using tmpdir: $WORKDIR/tmp"

echo "Setting up skip-tests-list"
cat > $SKIP_TEST_LST << EOF
binlog.binlog_server_start_options : Requires writable /usr
main.ctype_uca : Requires writable /usr
rpl.rpl_gtid_mode : Requires starting server as root ref 
http://bugs.mysql.com/bug.php?id=70517
EOF

cd /usr/share/mysql/mysql-test
echo "starting mysql-test-tun.pl..."
./mysql-test-run.pl --suite=main --vardir=$WORKDIR/var --tmpdir=$WORKDIR/tmp \
    --skip-ndbcluster --parallel=auto --skip-rpl \
    --force --skip-test-list=$SKIP_TEST_LST $@ 2>&1
echo "run: OK"
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..10e4fcd
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,7 @@
+Tests: smoke
+Depends: mariadb-server-10.0
+Restrictions: allow-stderr needs-root
+
+Tests: upstream
+Depends: mariadb-test
+Restrictions: allow-stderr breaks-testbed
diff --git a/debian/tests/smoke b/debian/tests/smoke
new file mode 100644
index 0000000..a05cee5
--- /dev/null
+++ b/debian/tests/smoke
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -ex
+
+# dep8 smoke test for mysql-server
+# Author: Robie Basak <robie.basak at canonical.com>
+#
+# This test should be declared in debian/tests/control with a dependency
+# on the package that provides a configured MariaDB server (eg.
+# mariadb-server-10.0).
+#
+# This test should be declared in debian/tests/control with the
+# following restrictions:
+#
+# needs-root (to be able to log into the database)
+# allow-stderr
+#
+# This test:
+#
+# 1) Creates a test database and test user as the root user.
+#
+# 2) Creates a test table and checks it appears to operate normally
+# using the test user and test database.
+
+mysql <<EOT
+CREATE DATABASE testdatabase;
+CREATE USER 'testuser'@'localhost' identified by 'testpassword';
+GRANT ALL ON testdatabase.* TO 'testuser'@'localhost';
+EOT
+
+mysql testdatabase <<EOT
+CREATE TABLE foo (bar INTEGER);
+INSERT INTO foo (bar) VALUES (41);
+EOT
+
+result=`echo 'SELECT bar+1 FROM foo;'|mysql --batch --skip-column-names --user=testuser --password=testpassword testdatabase`
+if [ "$result" != "42" ]; then
+       echo "Unexpected result" >&2
+       exit 1
+fi
+
+mysql --user=testuser --password=testpassword testdatabase <<EOT
+DROP TABLE foo;
+EOT
+
+mysql <<EOT
+DROP DATABASE testdatabase;
+DROP USER 'testuser'@'localhost';
+EOT
diff --git a/debian/tests/upstream b/debian/tests/upstream
new file mode 100755
index 0000000..6addb3b
--- /dev/null
+++ b/debian/tests/upstream
@@ -0,0 +1,35 @@
+#!/bin/sh
+# autopkgtest check: Build and run the upstream test suite.
+# (C) 2012 Canonical Ltd.
+# Author: Daniel Kessel <[email protected]>
+
+# running the mysql testsuite as described in:
+# https://bugs.launchpad.net/ubuntu/+source/mysql-5.5/+bug/959683
+
+echo "running test 'testsuite'"
+set -e
+
+SKIP_TEST_LST="/tmp/skip-test.lst"
+WORKDIR=$(mktemp -d)
+trap "rm -rf $WORKDIRi $SKIP_TEST_LST" 0 INT QUIT ABRT PIPE TERM
+cd $WORKDIR
+
+mkdir var
+mkdir tmp
+
+echo "using vardir: $WORKDIR/var"
+echo "using tmpdir: $WORKDIR/tmp"
+
+echo "Setting up skip-tests-list"
+cat > $SKIP_TEST_LST << EOF
+binlog.binlog_server_start_options : Requires writable /usr
+main.ctype_uca : Requires writable /usr
+rpl.rpl_gtid_mode : Requires starting server as root ref http://bugs.mysql.com/bug.php?id=70517
+EOF
+
+cd /usr/share/mysql/mysql-test
+echo "starting mysql-test-tun.pl..."
+./mysql-test-run.pl --suite=main --vardir=$WORKDIR/var --tmpdir=$WORKDIR/tmp \
+    --skip-ndbcluster --parallel=auto --skip-rpl \
+    --force --skip-test-list=$SKIP_TEST_LST $@ 2>&1
+echo "run: OK"

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to