summaryrefslogtreecommitdiff
path: root/db-4.8.30/test/fopscript.tcl
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2016-12-17 21:28:53 -0800
committerJesse Morgan <jesse@jesterpm.net>2016-12-17 21:28:53 -0800
commit54df2afaa61c6a03cbb4a33c9b90fa572b6d07b8 (patch)
tree18147b92b969d25ffbe61935fb63035cac820dd0 /db-4.8.30/test/fopscript.tcl
Berkeley DB 4.8 with rust build script for linux.
Diffstat (limited to 'db-4.8.30/test/fopscript.tcl')
-rw-r--r--db-4.8.30/test/fopscript.tcl70
1 files changed, 70 insertions, 0 deletions
diff --git a/db-4.8.30/test/fopscript.tcl b/db-4.8.30/test/fopscript.tcl
new file mode 100644
index 0000000..7c898b0
--- /dev/null
+++ b/db-4.8.30/test/fopscript.tcl
@@ -0,0 +1,70 @@
+# See the file LICENSE for redistribution information.
+#
+# Copyright (c) 2003-2009 Oracle. All rights reserved.
+#
+# $Id$
+#
+# Fop006 script - test of fileops in multiple transactions
+# Usage: fopscript
+# omethod: access method for database
+# op: file operation to perform
+# end: how to end the transaction (abort or commit)
+# result: expected result of the transaction
+# names: name(s) of files to operate on
+# args: additional args to do_op
+
+source ./include.tcl
+source $test_path/test.tcl
+source $test_path/testutils.tcl
+
+set usage "fopscript operator omethod op end result names args"
+
+# Verify usage
+if { $argc < 6 } {
+ puts stderr "FAIL:[timestamp] Usage: $usage"
+ exit
+}
+
+# Initialize arguments
+set operator [ lindex $argv 0 ]
+set omethod [ lindex $argv 1 ]
+set op [ lindex $argv 2 ]
+set end [ lindex $argv 3 ]
+set result [ lindex $argv 4 ]
+set names [ lindex $argv 5 ]
+set args [lindex [lrange $argv 6 end] 0]
+
+# Join the env
+set dbenv [eval berkdb_env -home $testdir]
+error_check_good envopen [is_valid_env $dbenv] TRUE
+
+# Start transaction
+puts "\tFopscript.a: begin 2nd transaction (will block)"
+set txn2 [$dbenv txn]
+error_check_good txn2_begin [is_valid_txn $txn2 $dbenv] TRUE
+
+# Execute op2
+set op2result [$operator $omethod $op $names $txn2 $dbenv $args]
+
+# End txn2
+error_check_good txn2_end [$txn2 $end] 0
+if {$result == 0} {
+ error_check_good op2_should_succeed $op2result $result
+} else {
+ set error [extract_error $op2result]
+ error_check_good op2_wrong_failure $error $result
+}
+
+# Close any open db handles. We had to wait until now
+# because you can't close a database inside a transaction.
+set handles [berkdb handles]
+foreach handle $handles {
+ if {[string range $handle 0 1] == "db" } {
+ error_check_good db_close [$handle close] 0
+ }
+}
+
+# Close the env
+error_check_good dbenv_close [$dbenv close] 0
+puts "\tFopscript completed successfully"
+