~longbow/kewpie/py_pam

« back to all changes in this revision

Viewing changes to percona_tests/sqlbench/sqlbench_test.py

  • Committer: patrick crews
  • Date: 2011-10-20 02:44:33 UTC
  • Revision ID: gleebix@gmail.com-20111020024433-kuueite319pf4p7u
Added crashme and sqlbench suites / made them unittest mode

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
# -*- mode: python; indent-tabs-mode: nil; -*-
 
3
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
4
#
 
5
# Copyright (C) 2011 Patrick Crews
 
6
#
 
7
#
 
8
# This program is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation; either version 2 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# This program is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with this program; if not, write to the Free Software
 
20
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
21
 
 
22
import unittest
 
23
import subprocess
 
24
 
 
25
from lib.util.sqlbench_methods import execute_sqlbench
 
26
 
 
27
server_requirements = [[]]
 
28
servers = []
 
29
server_manager = None
 
30
test_executor = None
 
31
 
 
32
class sqlbenchTest(unittest.TestCase):
 
33
 
 
34
    #def setUp(self):
 
35
    #    """ If we need to do anything pre-test, we do it here.
 
36
    #        Any code here is executed before any test method we
 
37
    #        may execute
 
38
    #
 
39
    #    """
 
40
 
 
41
    #    return
 
42
 
 
43
 
 
44
    def test_run_all_sqlbench(self):
 
45
        test_cmd = "$SQLBENCH_DIR/run-all-tests --server=mysqld --host=127.0.0.1 --force --dir=$MYSQL_TEST_WORKDIR  --connect-options=port=$MASTER_MYPORT --verbose --debug --user=root"
 
46
 
 
47
        test_status, retcode, output = execute_sqlbench(test_cmd, test_executor, servers)
 
48
        self.assertTrue(retcode==0, output)
 
49
        self.assertTrue(test_status=='pass', output)
 
50
 
 
51
    def tearDown(self):
 
52
            server_manager.reset_servers(test_executor.name)
 
53
 
 
54
 
 
55
def run_test(output_file):
 
56
    suite = unittest.TestLoader().loadTestsFromTestCase(sqlbenchTest)
 
57
    return unittest.TextTestRunner(stream=output_file, verbosity=2).run(suite)
 
58