Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add pid_fg to test_pid_file

  • Loading branch information...
commit 2fee3f30f0ba7a6ddac39b5c3c55a29714026887 1 parent 1df49de
@dekellum authored
Showing with 33 additions and 8 deletions.
  1. +1 −1  test/pid_fg
  2. +32 −7 test/test_pid_file
View
2  test/pid_fg
@@ -2,5 +2,5 @@
#-*- ruby -*-
#. hashdot.pid_file = ${hashdot.script}.pid
-puts "Exiting abruptly..."
+puts "Exiting abruptly with status code 1"
exit(1)
View
39 test/test_pid_file
@@ -2,15 +2,23 @@
#-*- ruby -*-
#. hashdot.pid_file = ${hashdot.script}.pid
-tdir = File.dirname( __FILE__ )
+TDIR = File.dirname( __FILE__ )
-efile = File.join( tdir, "pid_daemon.err" )
-daemon = File.join( tdir, "pid_daemon" )
-pfile = File.join( tdir, "pid_daemon.pid" )
-lfile = File.join( tdir, "pid_daemon.log" )
+def tfile( name )
+ File.join( TDIR, name )
+end
+
+def rm( file )
+ File.unlink( file ) if File.exist?( file )
+end
-File.unlink( efile ) if File.exist?( efile )
-File.unlink( lfile ) if File.exist?( lfile )
+efile = tfile( "pid_daemon.err" )
+daemon = tfile( "pid_daemon" )
+pfile = tfile( "pid_daemon.pid" )
+lfile = tfile( "pid_daemon.log" )
+
+rm( efile )
+rm( lfile )
40.times do
system( daemon ) or raise $?
@@ -32,4 +40,21 @@ end
if File.exist?( pfile )
puts( "ERROR: #{pfile} exists" )
+ exit 1
+else
+ puts( "PASS: pid_daemon" )
+end
+
+fg_pfile = tfile( "pid_fg.pid" )
+rm( fg_pfile )
+if system( tfile( "pid_fg" ) )
+ puts( "ERROR: pid_fg returned success." )
+ exit 2
+end
+
+if File.exist?( fg_pfile )
+ puts( "ERROR: #{fg_pfile} exists" )
+ exit 2
+else
+ puts( "PASS: pid_fg" )
end
Please sign in to comment.
Something went wrong with that request. Please try again.