Revision: 71
Author: baron.schwa...@gmail.com
Date: Sat Feb 25 18:33:44 2012
Log: Fix the test so it works no matter where it's run from (fixes
issue 43)
http://code.google.com/p/innotop/source/detail?r=71
Modified:
/trunk/Changelog
/trunk/t/InnoDBParser.t
=======================================
--- /trunk/Changelog Sat Feb 25 18:21:42 2012
+++ /trunk/Changelog Sat Feb 25 18:33:44 2012
@@ -5,6 +5,7 @@
Bugs fixed:
* Various errors caused by variations in MySQL 5.5
* RPM spec file prevented building on CentOS 5.5 using mock (issue 44).
+ * Tests worked only from the test subdirectory (issue 43).
2010-11-06: version 1.8.0
=======================================
--- /trunk/t/InnoDBParser.t Sat Feb 25 18:16:12 2012
+++ /trunk/t/InnoDBParser.t Sat Feb 25 18:33:44 2012
@@ -5,7 +5,17 @@
use Test::More tests => 3;
use Data::Dumper;
-require "../innotop";
+my $path;
+BEGIN {
+ # Figure out the path to the directory above this file's dirname.
+ my $pwd = `pwd`;
+ chomp $pwd;
+ $path = "$pwd/$0";
+ $path =~ s{/[^/]+/[^/]+$}{/};
+ unshift @INC, $path;
+};
+my $class = "innotop";
+require $class;
my $innodb_parser = new InnoDBParser;
sub read_file {
@@ -18,7 +28,7 @@
}
my %tests = (
- 'innodb-status-001' => {
+ $path . 't/innodb-status-001' => {
IB_bp_add_pool_alloc => '0',
IB_bp_awe_mem_alloc => 0,
IB_bp_buf_free => '8172',
@@ -284,7 +294,7 @@
],
IB_tx_trx_id_counter => 908
},
- 'innodb-status-002' => {
+ $path . 't/innodb-status-002' => {
IB_bp_add_pool_alloc => '0',
IB_bp_awe_mem_alloc => 0,
IB_bp_buf_free => '378834',
@@ -523,7 +533,7 @@
],
IB_tx_trx_id_counter => '2804F389'
},
- 'innodb-status-006' => {
+ $path . 't/innodb-status-006' => {
IB_bp_add_pool_alloc => '0',
IB_bp_awe_mem_alloc => 0,
IB_bp_buf_free => '4605',