Changeset 30347 for gs2-extensions/tdb/trunk/perllib/dbutil.pm
- Timestamp:
- 2015-12-10T12:19:20+13:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb/trunk/perllib/dbutil.pm
r30340 r30347 37 37 } 38 38 # Are we running standalone? In which case the INC won't be correct 39 #if (!caller) { 40 # Ensure the INC includes the path to FileUtils.pm 41 unshift(@INC, $ENV{'GSDLHOME'} . '/perllib'); 42 43 #} 44 require DBDrivers::GDBM; 45 my $driver = DBDrivers::GDBM->new(1); 39 my $perllib_path = $ENV{'GSDLHOME'} . '/perllib'; 40 my $all_inc = join(':', @INC); 41 if ($all_inc !~ /$perllib_path/) { 42 unshift(@INC, $perllib_path); 43 } 46 44 } 47 45 … … 240 238 'tea' => ['a drink with jam and bread'], 241 239 'doh' => ['which brings us back to']}; 240 $test_count = 0; 241 $pass_count = 0; 242 $skip_count = 0; 242 243 print "===== DBUtils Testing Suite =====\n"; 243 244 print "For each driver specified, run a battery of tests\n"; … … 259 260 &_addPathsToINC(); 260 261 foreach my $driver_name (@drivers) { 261 print "* Testing: " . $driver_name . "\n"; 262 my $t1 = [gettimeofday()]; 263 print "=== Testing: " . $driver_name . " ===\n"; 262 264 my $driver = _loadDBDriver($driver_name); 263 265 my $db_path = $driver->get_infodb_file_path('test','/tmp/'); … … 274 276 &_printTest('writing raw entry', 1); 275 277 # 3. Close handle 276 $driver->close_infodb_handle($db_handle); 277 &_printTest('closing handle', (tell($db_handle) < 1)); 278 $driver->close_infodb_write_handle($db_handle); 279 if ($driver->supportsPersistentConnection()) { 280 $test_count += 1; 281 $skip_count += 1; 282 print " - Skipping test as persistent drivers delay 'close'.\n"; 283 } 284 else { 285 &_printTest('closing handle', (tell($db_handle) < 1)); 286 } 278 287 # 4a. Read entry 279 288 my $data3 = $driver->read_infodb_entry($db_path, 'Alpha'); … … 302 311 my $db_handle2 = $driver->open_infodb_write_handle($db_path, 'append'); 303 312 $driver->delete_infodb_entry($db_handle2, 'Alpha'); 304 $driver->close_infodb_ handle($db_handle2);313 $driver->close_infodb_write_handle($db_handle2); 305 314 my $keys2 = {}; 306 315 $driver->read_infodb_keys($db_path, $keys2); … … 308 317 # 8. Remove test db 309 318 #unlink($db_path); 319 my $t2 = [gettimeofday()]; 320 my $elapsed1 = tv_interval($t1, $t2); 321 print " - Testing took " . $elapsed1 . " seconds\n"; 310 322 } 311 323 print "===== Results =====\n"; … … 320 332 print "Warning! No drivers specified - expected as arguments to call\n"; 321 333 } 322 my $t 1= [gettimeofday()];323 my $elapsed = tv_interval($t0, $t1);324 print "===== Complete in " . $elapsed . " seconds =====\n";334 my $t3 = [gettimeofday()]; 335 my $elapsed2 = tv_interval($t0, $t3); 336 print "===== Complete in " . $elapsed2 . " seconds =====\n"; 325 337 print "\n"; 326 338 exit(0);
Note:
See TracChangeset
for help on using the changeset viewer.