[ruby-oci8-commit] [415] trunk/ruby-oci8: * ext/oci8/env.c, ext/oci8/extconf.rb: suppress warning
nobody at rubyforge.org
nobody at rubyforge.org
Sun Sep 12 08:50:44 EDT 2010
Revision: 415
Author: kubo
Date: 2010-09-12 08:50:44 -0400 (Sun, 12 Sep 2010)
Log Message:
-----------
* ext/oci8/env.c, ext/oci8/extconf.rb: suppress warning
'use "ruby/util.h" instead of bare "util.h".'
* test/test_break.rb: make tests insensitive to execution timing.
Modified Paths:
--------------
branches/ruby-oci8-2.0/ChangeLog
branches/ruby-oci8-2.0/ext/oci8/env.c
branches/ruby-oci8-2.0/ext/oci8/extconf.rb
branches/ruby-oci8-2.0/test/test_break.rb
trunk/ruby-oci8/ChangeLog
trunk/ruby-oci8/ext/oci8/env.c
trunk/ruby-oci8/ext/oci8/extconf.rb
trunk/ruby-oci8/test/test_break.rb
Modified: branches/ruby-oci8-2.0/ChangeLog
===================================================================
--- branches/ruby-oci8-2.0/ChangeLog 2010-09-10 12:38:41 UTC (rev 414)
+++ branches/ruby-oci8-2.0/ChangeLog 2010-09-12 12:50:44 UTC (rev 415)
@@ -1,3 +1,8 @@
+2010-09-12 KUBO Takehiro <kubo at jiubao.org>
+ * ext/oci8/env.c, ext/oci8/extconf.rb: suppress warning
+ 'use "ruby/util.h" instead of bare "util.h".'
+ * test/test_break.rb: make tests insensitive to execution timing.
+
2010-09-10 KUBO Takehiro <kubo at jiubao.org>
* test/test_array_dml.rb: delete workaround code. It now works
fine on rubinius head.
Modified: branches/ruby-oci8-2.0/ext/oci8/env.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/env.c 2010-09-10 12:38:41 UTC (rev 414)
+++ branches/ruby-oci8-2.0/ext/oci8/env.c 2010-09-12 12:50:44 UTC (rev 415)
@@ -6,23 +6,12 @@
*/
#include "oci8.h"
-#if defined(HAVE_UTIL_H)
-/* ruby_setenv for workaround ruby 1.8.4 */
+#if defined(HAVE_RUBY_UTIL_H)
+#include <ruby/util.h>
+#elif defined(HAVE_UTIL_H)
#include <util.h>
#endif
-#ifdef _WIN32
-#ifdef HAVE_RUBY_WIN32_H
-#include <ruby/win32.h> /* for rb_w32_getenv() */
-#else
-#include <win32/win32.h> /* for rb_w32_getenv() */
-#endif
-#endif
-
-#ifdef HAVE_RUBY_UTIL_H
-#include <ruby/util.h>
-#endif
-
#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
ub4 oci8_env_mode = OCI_OBJECT | OCI_THREADED;
#else
Modified: branches/ruby-oci8-2.0/ext/oci8/extconf.rb
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/extconf.rb 2010-09-10 12:38:41 UTC (rev 414)
+++ branches/ruby-oci8-2.0/ext/oci8/extconf.rb 2010-09-12 12:50:44 UTC (rev 415)
@@ -105,6 +105,7 @@
have_header("intern.h")
have_header("util.h")
# ruby 1.9 headers
+have_header("ruby/util.h")
have_type('rb_encoding', ['ruby/ruby.h', 'ruby/encoding.h'])
# $! in C API
Modified: branches/ruby-oci8-2.0/test/test_break.rb
===================================================================
--- branches/ruby-oci8-2.0/test/test_break.rb 2010-09-10 12:38:41 UTC (rev 414)
+++ branches/ruby-oci8-2.0/test/test_break.rb 2010-09-12 12:50:44 UTC (rev 415)
@@ -23,23 +23,22 @@
TIME_IN_PLSQL = 5
TIME_TO_BREAK = 2
- MARGIN = 0.1
def do_test_ocibreak(conn, expect)
$start_time = Time.now
th = Thread.start do
begin
- conn.exec("BEGIN DBMS_LOCK.SLEEP(#{TIME_IN_PLSQL}); END;")
- assert_equal(expect[PLSQL_DONE], (Time.now - $start_time + MARGIN).to_i, 'PLSQL_DONE')
+ conn.exec("BEGIN DBMS_LOCK.SLEEP(#{TIME_IN_PLSQL}); END;")
+ assert_equal(expect[PLSQL_DONE], (Time.now - $start_time).round, 'PLSQL_DONE')
rescue OCIBreak
- assert_equal(expect[OCIBREAK], (Time.now - $start_time + MARGIN).to_i, 'OCIBREAK')
+ assert_equal(expect[OCIBREAK], (Time.now - $start_time).round, 'OCIBREAK')
end
end
- sleep(0.01) # make a time to run DBMS_LOCK.SLEEP
- sleep(TIME_TO_BREAK)
- assert_equal(expect[SEND_BREAK], (Time.now - $start_time + MARGIN).to_i, 'SEND_BREAK')
+ sleep(0.3) # Wait until DBMS_LOCK.SLEEP is running.
+ sleep(TIME_TO_BREAK - 0.3)
+ assert_equal(expect[SEND_BREAK], (Time.now - $start_time).round, 'SEND_BREAK')
conn.break()
th.join
end
Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog 2010-09-10 12:38:41 UTC (rev 414)
+++ trunk/ruby-oci8/ChangeLog 2010-09-12 12:50:44 UTC (rev 415)
@@ -1,3 +1,8 @@
+2010-09-12 KUBO Takehiro <kubo at jiubao.org>
+ * ext/oci8/env.c, ext/oci8/extconf.rb: suppress warning
+ 'use "ruby/util.h" instead of bare "util.h".'
+ * test/test_break.rb: make tests insensitive to execution timing.
+
2010-09-10 KUBO Takehiro <kubo at jiubao.org>
* test/test_array_dml.rb: delete workaround code. It now works
fine on rubinius head.
Modified: trunk/ruby-oci8/ext/oci8/env.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/env.c 2010-09-10 12:38:41 UTC (rev 414)
+++ trunk/ruby-oci8/ext/oci8/env.c 2010-09-12 12:50:44 UTC (rev 415)
@@ -6,23 +6,12 @@
*/
#include "oci8.h"
-#if defined(HAVE_UTIL_H)
-/* ruby_setenv for workaround ruby 1.8.4 */
+#if defined(HAVE_RUBY_UTIL_H)
+#include <ruby/util.h>
+#elif defined(HAVE_UTIL_H)
#include <util.h>
#endif
-#ifdef _WIN32
-#ifdef HAVE_RUBY_WIN32_H
-#include <ruby/win32.h> /* for rb_w32_getenv() */
-#else
-#include <win32/win32.h> /* for rb_w32_getenv() */
-#endif
-#endif
-
-#ifdef HAVE_RUBY_UTIL_H
-#include <ruby/util.h>
-#endif
-
#ifdef HAVE_TYPE_RB_BLOCKING_FUNCTION_T
ub4 oci8_env_mode = OCI_OBJECT | OCI_THREADED;
#else
Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb 2010-09-10 12:38:41 UTC (rev 414)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb 2010-09-12 12:50:44 UTC (rev 415)
@@ -107,6 +107,7 @@
have_header("intern.h")
have_header("util.h")
# ruby 1.9 headers
+have_header("ruby/util.h")
have_type('rb_encoding', ['ruby/ruby.h', 'ruby/encoding.h'])
# $! in C API
Modified: trunk/ruby-oci8/test/test_break.rb
===================================================================
--- trunk/ruby-oci8/test/test_break.rb 2010-09-10 12:38:41 UTC (rev 414)
+++ trunk/ruby-oci8/test/test_break.rb 2010-09-12 12:50:44 UTC (rev 415)
@@ -23,23 +23,22 @@
TIME_IN_PLSQL = 5
TIME_TO_BREAK = 2
- MARGIN = 0.1
def do_test_ocibreak(conn, expect)
$start_time = Time.now
th = Thread.start do
begin
- conn.exec("BEGIN DBMS_LOCK.SLEEP(#{TIME_IN_PLSQL}); END;")
- assert_equal(expect[PLSQL_DONE], (Time.now - $start_time + MARGIN).to_i, 'PLSQL_DONE')
+ conn.exec("BEGIN DBMS_LOCK.SLEEP(#{TIME_IN_PLSQL}); END;")
+ assert_equal(expect[PLSQL_DONE], (Time.now - $start_time).round, 'PLSQL_DONE')
rescue OCIBreak
- assert_equal(expect[OCIBREAK], (Time.now - $start_time + MARGIN).to_i, 'OCIBREAK')
+ assert_equal(expect[OCIBREAK], (Time.now - $start_time).round, 'OCIBREAK')
end
end
- sleep(0.01) # make a time to run DBMS_LOCK.SLEEP
- sleep(TIME_TO_BREAK)
- assert_equal(expect[SEND_BREAK], (Time.now - $start_time + MARGIN).to_i, 'SEND_BREAK')
+ sleep(0.3) # Wait until DBMS_LOCK.SLEEP is running.
+ sleep(TIME_TO_BREAK - 0.3)
+ assert_equal(expect[SEND_BREAK], (Time.now - $start_time).round, 'SEND_BREAK')
conn.break()
th.join
end
More information about the ruby-oci8-commit
mailing list