OLD | NEW |
1 import os | 1 import os |
2 from autotest_lib.client.bin import test, utils | 2 from autotest_lib.client.bin import test, utils |
3 | 3 |
4 | 4 |
5 # Dbt-2 is a fair-use implementation of the TPC-C benchmark. The test is | 5 # Dbt-2 is a fair-use implementation of the TPC-C benchmark. The test is |
6 # currently hardcoded to use PostgreSQL but the kit also supports MySQL. | 6 # currently hardcoded to use PostgreSQL but the kit also supports MySQL. |
7 | 7 |
8 class dbt2(test.test): | 8 class dbt2(test.test): |
9 version = 2 | 9 version = 2 |
10 | 10 |
11 def initialize(self): | 11 def initialize(self): |
12 self.job.require_gcc() | 12 self.job.require_gcc() |
13 | 13 |
14 | 14 |
15 # http://osdn.dl.sourceforge.net/sourceforge/osdldbt/dbt2-0.39.tar.gz | 15 # http://osdn.dl.sourceforge.net/sourceforge/osdldbt/dbt2-0.39.tar.gz |
16 def setup(self, tarball = 'dbt2-0.39.tar.bz2'): | 16 def setup(self, tarball = 'dbt2-0.39.tar.bz2'): |
17 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 17 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
18 utils.extract_tarball_to_dir(tarball, self.srcdir) | 18 utils.extract_tarball_to_dir(tarball, self.srcdir) |
19 self.job.setup_dep(['pgsql', 'pgpool', 'mysql']) | 19 self.job.setup_dep(['pgsql', 'pgpool', 'mysql']) |
20 | 20 |
21 # | 21 # |
22 # Extract one copy of the kit for MySQL. | 22 # Extract one copy of the kit for MySQL. |
23 # | 23 # |
24 utils.system('cp -pR ' + self.srcdir + ' ' + self.srcdir + '.mysql') | 24 utils.system('cp -pR ' + self.srcdir + ' ' + self.srcdir + '.mysql') |
25 os.chdir(self.srcdir + '.mysql') | 25 os.chdir(self.srcdir + '.mysql') |
26 utils.system('./configure --with-mysql=%s/deps/mysql/mysql' \ | 26 utils.configure('--with-mysql=%s/deps/mysql/mysql' % self.autodir) |
27 % self.autodir) | 27 utils.make() |
28 utils.system('make') | |
29 | 28 |
30 # | 29 # |
31 # Extract one copy of the kit for PostgreSQL. | 30 # Extract one copy of the kit for PostgreSQL. |
32 # | 31 # |
33 utils.system('cp -pR ' + self.srcdir + ' ' + self.srcdir + '.pgsql') | 32 utils.system('cp -pR ' + self.srcdir + ' ' + self.srcdir + '.pgsql') |
34 os.chdir(self.srcdir + '.pgsql') | 33 os.chdir(self.srcdir + '.pgsql') |
35 utils.system('./configure --with-postgresql=%s/deps/pgsql/pgsql' \ | 34 utils.configure('--with-postgresql=%s/deps/pgsql/pgsql' % self.autodir) |
36 % self.autodir) | 35 utils.make() |
37 utils.system('make') | |
38 | 36 |
39 # Create symlinks to autotest's results directory from dbt-2's | 37 # Create symlinks to autotest's results directory from dbt-2's |
40 # preferred results directory to self.resultsdir | 38 # preferred results directory to self.resultsdir |
41 utils.system('ln -s %s %s' % | 39 utils.system('ln -s %s %s' % |
42 (self.resultsdir, self.srcdir + '.mysql/scripts/output')) | 40 (self.resultsdir, self.srcdir + '.mysql/scripts/output')) |
43 utils.system('ln -s %s %s' % | 41 utils.system('ln -s %s %s' % |
44 (self.resultsdir, self.srcdir + '.pgsql/scripts/output')) | 42 (self.resultsdir, self.srcdir + '.pgsql/scripts/output')) |
45 | 43 |
46 | 44 |
47 def execute(self, db_type, args = ''): | 45 def execute(self, db_type, args = ''): |
(...skipping 22 matching lines...) Expand all Loading... |
70 | 68 |
71 def execute_pgsql(self, args = ''): | 69 def execute_pgsql(self, args = ''): |
72 utils.system(self.srcdir + '.pgsql/scripts/pgsql/build_db.sh -g -w 1') | 70 utils.system(self.srcdir + '.pgsql/scripts/pgsql/build_db.sh -g -w 1') |
73 utils.system(self.srcdir + '.pgsql/scripts/run_workload.sh ' + args) | 71 utils.system(self.srcdir + '.pgsql/scripts/run_workload.sh ' + args) |
74 # | 72 # |
75 # Clean up by dropping the database after the test. | 73 # Clean up by dropping the database after the test. |
76 # | 74 # |
77 utils.system(self.srcdir + '.pgsql/scripts/pgsql/start_db.sh') | 75 utils.system(self.srcdir + '.pgsql/scripts/pgsql/start_db.sh') |
78 utils.system(self.srcdir + '.pgsql/scripts/pgsql/drop_db.sh') | 76 utils.system(self.srcdir + '.pgsql/scripts/pgsql/drop_db.sh') |
79 utils.system(self.srcdir + '.pgsql/scripts/pgsql/stop_db.sh') | 77 utils.system(self.srcdir + '.pgsql/scripts/pgsql/stop_db.sh') |
OLD | NEW |