~drizzle-trunk/drizzle/jenkins-Drizzle-Builder-129

« back to all changes in this revision

Viewing changes to tests/qp_tests/sysbench/sysbench_readonly_test.py

  • Committer: Continuous Integration
  • Date: 2012-08-22 16:46:57 UTC
  • mfrom: (2582.1.1 qp-sysbench-gsoc)
  • Revision ID: ci@drizzle.org-20120822164657-kscwyfppucshsl7v
added:
  tests/lib/util/database_connect.py
  tests/lib/util/drizzleslap_methods.py
  tests/lib/util/mailing_report.py
  tests/lib/util/sysbenchTestCase.py
  tests/qp_tests/drizzleslap/
  tests/qp_tests/drizzleslap/drizzleslap_test.py
  tests/qp_tests/sysbench/sysbench_readwrite_test.py
  tests/std_data/sysbench_db.sql
modified:
  docs/testing/kewpie.rst
  docs/testing/sysbench.rst
  tests/lib/modes/native/native_test_execution.py
  tests/lib/opts/test_run_options.py
  tests/lib/server_mgmt/drizzled.py
  tests/lib/server_mgmt/server.py
  tests/lib/sys_mgmt/system_management.py
  tests/lib/util/crashme_methods.py
  tests/lib/util/mysql_methods.py
  tests/lib/util/sysbench_methods.py
  tests/qp_tests/crashme/crashme_test.py
  tests/qp_tests/sqlbench/sqlbench_test.py
  tests/qp_tests/sysbench/sysbench_readonly_test.py
pending merge tips: (use -v to see all merge revisions)
  M.Sharan Kumar 2012-08-21 [merge] This branch consists of the work done in connection with GSoC.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
4
#
5
5
# Copyright (C) 2011 Patrick Crews
 
6
# Copyright (C) 2012 M.Sharan Kumar
6
7
#
7
8
#
8
9
# This program is free software; you can redistribute it and/or modify
19
20
# along with this program; if not, write to the Free Software
20
21
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
22
 
22
 
import unittest
 
23
import re
 
24
import time
 
25
import socket
23
26
import subprocess
24
 
import time
 
27
import datetime
 
28
from copy import deepcopy
25
29
 
26
30
from lib.util.sysbench_methods import prepare_sysbench
27
31
from lib.util.sysbench_methods import execute_sysbench
28
32
from lib.util.sysbench_methods import process_sysbench_output
29
 
from lib.util.mysqlBaseTestCase import mysqlBaseTestCase
 
33
from lib.util.sysbench_methods import sysbench_db_analysis
 
34
from lib.util.sysbench_methods import getSysbenchReport
 
35
from lib.util.sysbenchTestCase import sysbenchTestCase
 
36
from lib.util.database_connect import results_db_connect
 
37
from lib.util.mailing_report   import sendMail
30
38
 
31
39
# TODO:  make server_options vary depending on the type of server being used here
32
40
# drizzle options
33
 
#server_requirements = [['innodb.buffer-pool-size=256M innodb.log-file-size=64M innodb.log-buffer-size=8M innodb.thread-concurrency=0 innodb.additional-mem-pool-size=16M table-open-cache=4096 table-definition-cache=4096 mysql-protocol.max-connections=2048']]
 
41
server_requirements = [['innodb.buffer-pool-size=256M innodb.log-file-size=64M innodb.log-buffer-size=8M innodb.thread-concurrency=0 innodb.additional-mem-pool-size=16M table-open-cache=4096 table-definition-cache=4096 mysql-protocol.max-connections=2048']]
 
42
 
34
43
# mysql options
35
44
#server_requirements = [['innodb_buffer_pool_size=256M innodb_log_file_size=64M innodb_log_buffer_size=8M innodb_thread_concurrency=0 innodb_additional_mem_pool_size=16M table_open_cache=4096 table_definition_cache=4096 max_connections=2048']]
36
 
server_requirements = [[]]
 
45
 
37
46
servers = []
38
47
server_manager = None
39
48
test_executor = None
40
49
 
41
 
class basicTest(mysqlBaseTestCase):
42
 
        
 
50
class basicTest(sysbenchTestCase):
 
51
 
43
52
    def test_sysbench_readonly(self):
44
 
        self.logging = test_executor.logging
 
53
 
 
54
        # defining the test command
45
55
        master_server = servers[0]
46
 
        # our base test command
 
56
        self.config_name = 'innodb_1000K_readonly'
47
57
        test_cmd = [ "sysbench"
48
58
                   , "--max-time=240"
49
59
                   , "--max-requests=0"
58
68
                   , "--%s-host=localhost" %master_server.type
59
69
                   , "--db-driver=%s" %master_server.type
60
70
                   ]
61
 
 
62
71
        if master_server.type == 'drizzle':
63
72
            test_cmd.append("--drizzle-mysql=on")
64
73
        if master_server.type == 'mysql':
65
74
            test_cmd.append("--mysql-socket=%s" %master_server.socket_file)
66
 
       
67
 
        # We sleep for a minute to wait
68
 
        time.sleep(10) 
69
 
        # how many times to run sysbench at each concurrency
70
 
        iterations = 1
71
 
        
72
 
        # various concurrencies to use with sysbench
73
 
        #concurrencies = [16, 32, 64, 128, 256, 512, 1024]
74
 
        concurrencies = [1, 4, 8 ]
 
75
 
 
76
        # preparing sysbench_readonly test
 
77
        self.prepareSysbench(test_cmd,test_executor,servers)
75
78
 
76
79
        # start the test!
77
 
        for concurrency in concurrencies:
78
 
            self.logging.info("Resetting test server...")
79
 
            for query in ["DROP SCHEMA IF EXISTS test"
80
 
                         ,"CREATE SCHEMA test"
81
 
                         ]:
82
 
                retcode, result = self.execute_query(query, master_server, schema="INFORMATION_SCHEMA")
83
 
            test_cmd.append("--num-threads=%d" %concurrency)
84
 
            # we setup once per concurrency, copying drizzle-automation
85
 
            # this should likely change and if not for readonly, then definitely
86
 
            # for readwrite
87
 
 
88
 
            exec_cmd = " ".join(test_cmd)
89
 
            retcode, output = prepare_sysbench(test_executor, exec_cmd)
90
 
            err_msg = ("sysbench 'prepare' phase failed.\n"
91
 
                       "retcode:  %d"
92
 
                       "output:  %s" %(retcode,output))
93
 
            self.assertEqual(retcode, 0, msg = err_msg) 
94
 
 
95
 
            for test_iteration in range(iterations):
96
 
                retcode, output = execute_sysbench(test_executor, exec_cmd)
97
 
                self.assertEqual(retcode, 0, msg = output)
98
 
                parsed_output = process_sysbench_output(output)
99
 
                self.logging.info(parsed_output)
 
80
        # this method takes care of *running* the test and *saving* the test results
 
81
        self.executeSysbench()
 
82
 
 
83
        # reporting the test result
 
84
        # this method handles *dsn_string* and *mail_tgt*
 
85
        self.reportTestData(dsn_string,mail_tgt)
100
86
 
101
87
    def tearDown(self):
102
88
            server_manager.reset_servers(test_executor.name)
103