[Groonga-commit] droonga/drntest at e3c5ddc [master] Use tmpfs if exists to improve test speed

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Dec 17 22:16:51 JST 2013


Kouhei Sutou	2013-12-17 22:16:51 +0900 (Tue, 17 Dec 2013)

  New Revision: e3c5ddc41059c61a3881fa16dd6d3f7f67f7d7b8
  https://github.com/droonga/drntest/commit/e3c5ddc41059c61a3881fa16dd6d3f7f67f7d7b8

  Message:
    Use tmpfs if exists to improve test speed

  Modified files:
    lib/drntest/test-runner.rb

  Modified: lib/drntest/test-runner.rb (+20 -3)
===================================================================
--- lib/drntest/test-runner.rb    2013-12-17 19:16:45 +0900 (bfb8d96)
+++ lib/drntest/test-runner.rb    2013-12-17 22:16:51 +0900 (b4bc57c)
@@ -85,8 +85,7 @@ module Drntest
     def setup
       return unless temporary_engine?
 
-      FileUtils.rm_rf(temporary_dir)
-      FileUtils.mkdir_p(temporary_dir)
+      setup_temporary_dir
 
       temporary_config = temporary_dir + "fluentd.conf"
       FileUtils.cp(config_file, temporary_config)
@@ -120,11 +119,29 @@ module Drntest
       Process.kill(:TERM, @engine_pid)
       Process.wait(@engine_pid)
 
+      teardown_temporary_dir
+    end
+
+    def setup_temporary_dir
+      tmpfs = Pathname("/run/shm")
+      if tmpfs.directory? and tmpfs.writable?
+        FileUtils.rm_rf(temporary_base_dir)
+        FileUtils.ln_s(tmpfs.to_s, temporary_base_dir.to_s)
+      end
+      FileUtils.rm_rf(temporary_dir)
+      FileUtils.mkdir_p(temporary_dir)
+    end
+
+    def teardown_temporary_dir
       FileUtils.rm_rf(temporary_dir.to_s)
     end
 
+    def temporary_base_dir
+      @base_path + "tmp"
+    end
+
     def temporary_dir
-      config_dir + "tmp"
+      temporary_base_dir + "drntest"
     end
 
     def temporary_engine?
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index