[DRE-commits] [ruby-aruba] 29/74: Replace signal USR1 through HUP because jruby use this signal internally and recommends to use something else

Hideki Yamane henrich at moszumanska.debian.org
Sat Nov 28 01:16:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository ruby-aruba.

commit 86b2e33c81cb2f0139e5ac82a2c9d4a7e147b09e
Author: Dennis Günnewig <dg1 at ratiodata.de>
Date:   Tue Nov 24 12:08:26 2015 +0100

    Replace signal USR1 through HUP because jruby use this signal internally and recommends to use something else
---
 features/api/command/send_signal.feature   | 20 +++++++++---------
 features/api/command/stop.feature          | 16 +++++++-------
 features/steps/command/send_signal.feature | 34 +++++++++++++++---------------
 features/steps/command/stop.feature        |  8 +++----
 4 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/features/api/command/send_signal.feature b/features/api/command/send_signal.feature
index a124b79..04b9697 100644
--- a/features/api/command/send_signal.feature
+++ b/features/api/command/send_signal.feature
@@ -10,24 +10,24 @@ Feature: Send running command a signal
   Scenario: Existing executable
     Given an executable named "bin/cli" with:
     """ruby
-    #!/usr/bin/env ruby
-
-    $stderr.puts 'Now I run the code'
+    #!/usr/bin/env bash
 
-    Signal.trap 'USR1' do
-      $stderr.puts 'Exit...'
+    function hup {
+      echo 'Exit...' >&2
       exit 0
-    end
+    }
+
+    trap hup HUP
 
-    loop { sleep 1 }
+    while [ true ]; do sleep 1; done
     """
     And a file named "spec/run_spec.rb" with:
     """ruby
     require 'spec_helper'
 
-    RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3, :startup_wait_time => 2 do
+    RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5, :startup_wait_time => 4 do
       before(:each) { run('cli') }
-      before(:each) { last_command_started.send_signal 'USR1' }
+      before(:each) { last_command_started.send_signal 'HUP' }
       it { expect(last_command_started).to have_output /Exit/ }
     end
     """
@@ -44,7 +44,7 @@ Feature: Send running command a signal
     """ruby
     require 'spec_helper'
 
-    RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3, :startup_wait_time => 2 do
+    RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5, :startup_wait_time => 4 do
       before(:each) { run('cli') }
       it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError, /Command "cli" with PID/ }
     end
diff --git a/features/api/command/stop.feature b/features/api/command/stop.feature
index 6cfdaa7..0fca855 100644
--- a/features/api/command/stop.feature
+++ b/features/api/command/stop.feature
@@ -39,17 +39,17 @@ Feature: Stop command
     Given an executable named "bin/cli" with:
     """bash
     #!/bin/bash
-    function usr1 {
+    function hup {
       echo "Exit..."
       exit 0
     }
 
     function term {
-      echo "No! No exit here. Try USR1. I stop the command with exit 1."
+      echo "No! No exit here. Try HUP. I stop the command with exit 1."
       exit 1
     }
 
-    trap usr1 USR1
+    trap hup HUP
     trap term TERM
     while [ true ]; do sleep 1; done
     """
@@ -58,7 +58,7 @@ Feature: Stop command
     require 'spec_helper'
 
     Aruba.configure do |config|
-      config.stop_signal  = 'USR1'
+      config.stop_signal  = 'HUP'
       config.exit_timeout = 1
     end
 
@@ -74,17 +74,17 @@ Feature: Stop command
     Given an executable named "bin/cli" with:
     """bash
     #!/bin/bash
-    function usr1 {
+    function hup {
       echo "Exit..."
       exit 2
     }
 
     function term {
-      echo "No! No exit here. Try USR1. I stop the command with exit 1."
+      echo "No! No exit here. Try HUP. I stop the command with exit 1."
       exit 1
     }
 
-    trap usr1 USR1
+    trap hup HUP
     trap term TERM
     while [ true ]; do sleep 1; done
     """
@@ -93,7 +93,7 @@ Feature: Stop command
     require 'spec_helper'
 
     Aruba.configure do |config|
-      config.stop_signal  = 'USR1'
+      config.stop_signal  = 'HUP'
       config.exit_timeout = 1
     end
 
diff --git a/features/steps/command/send_signal.feature b/features/steps/command/send_signal.feature
index 71b7f3f..7ead024 100644
--- a/features/steps/command/send_signal.feature
+++ b/features/steps/command/send_signal.feature
@@ -2,8 +2,8 @@ Feature: Send a signal to command
 
   You can send a command a signal with the following steps:
 
-  - `When I send the signal "USR1" to the command started last`
-  - `When I send the signal "USR1" to the command "bin/cli"`
+  - `When I send the signal "HUP" to the command started last`
+  - `When I send the signal "HUP" to the command "bin/cli"`
 
   Or just use `kill` on compatible platforms.
 
@@ -14,12 +14,12 @@ Feature: Send a signal to command
     Given an executable named "bin/cli" with:
     """bash
     #!/usr/bin/env bash
-    function usr1 {
-      echo "Got signal USR1."
+    function hup {
+      echo "Got signal HUP."
       exit 0
     }
 
-    trap usr1 USR1
+    trap hup HUP
     while [ true ]; do sleep 1; done
     """
     And a file named "features/run.feature" with:
@@ -29,11 +29,11 @@ Feature: Send a signal to command
         Given the default aruba exit timeout is 5 seconds
         And I wait 2 seconds for a command to start up
         When I run `cli` in background
-        And I send the signal "USR1" to the command started last
+        And I send the signal "HUP" to the command started last
         Then the exit status should be 0
         And the output should contain:
         \"\"\"
-        Got signal USR1.
+        Got signal HUP.
         \"\"\"
     """
     When I run `cucumber`
@@ -43,12 +43,12 @@ Feature: Send a signal to command
     Given an executable named "bin/cli" with:
     """bash
     #!/usr/bin/env bash
-    function usr1 {
-      echo "Got signal USR1."
+    function hup {
+      echo "Got signal HUP."
       exit 0
     }
 
-    trap usr1 USR1
+    trap hup HUP
     while [ true ]; do sleep 1; done
     """
     And a file named "features/run.feature" with:
@@ -58,11 +58,11 @@ Feature: Send a signal to command
         Given the default aruba exit timeout is 5 seconds
         And I wait 2 seconds for a command to start up
         When I run `cli` in background
-        And I send the signal "USR1" to the command "cli"
+        And I send the signal "HUP" to the command "cli"
         Then the exit status should be 0
         And the output should contain:
         \"\"\"
-        Got signal USR1.
+        Got signal HUP.
         \"\"\"
     """
     When I run `cucumber`
@@ -79,12 +79,12 @@ Feature: Send a signal to command
     Given an executable named "bin/cli" with:
     """bash
     #!/usr/bin/env bash
-    function usr1 {
-      echo "Got signal USR1."
+    function hup {
+      echo "Got signal HUP."
       exit 0
     }
 
-    trap usr1 USR1
+    trap hup HUP
     while [ true ]; do sleep 1; done
     """
     And a file named "features/run.feature" with:
@@ -94,10 +94,10 @@ Feature: Send a signal to command
         Given the default aruba exit timeout is 5 seconds
         And I wait 2 seconds for a command to start up
         When I run `cli` in background
-        And I run `kill -USR1 <pid-last-command-started>`
+        And I run `kill -HUP <pid-last-command-started>`
         Then the output should contain:
         \"\"\"
-        Got signal USR1.
+        Got signal HUP.
         \"\"\"
     """
     When I run `cucumber`
diff --git a/features/steps/command/stop.feature b/features/steps/command/stop.feature
index cdc552f..0478ead 100644
--- a/features/steps/command/stop.feature
+++ b/features/steps/command/stop.feature
@@ -209,17 +209,17 @@ Feature: Stop commands
     Given an executable named "bin/cli" with:
     """bash
     #!/bin/bash
-    function usr1 {
+    function hup {
       echo "Exit..."
       exit 0
     }
 
     function term {
-      echo "No! No exit here. Try USR1. I stop the command with exit 1."
+      echo "No! No exit here. Try HUP. I stop the command with exit 1."
       exit 1
     }
 
-    trap usr1 USR1
+    trap hup HUP
     trap term TERM
     while [ true ]; do sleep 1; done
     """
@@ -227,7 +227,7 @@ Feature: Stop commands
     """
     Feature: Run it
       Scenario: Run command
-        Given the default aruba stop signal is "USR1"
+        Given the default aruba stop signal is "HUP"
         And the default aruba exit timeout is 5 seconds
         When I run `cli`
         Then the exit status should be 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git



More information about the Pkg-ruby-extras-commits mailing list