[SCM] master: Fix signal ordering; remove hard-wired name tests in TestSignalSet.
cagney@sourceware.org
cagney@sourceware.org
Fri Jan 25 14:43:00 GMT 2008
The branch, master has been updated
via c7fee00e30f845e0c44c947aa480d0376a7c2b92 (commit)
from 8611edff5032e4510277be420ceeb7f8ea496c47 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit c7fee00e30f845e0c44c947aa480d0376a7c2b92
Author: Andrew Cagney <cagney@toil.yyz.redhat.com>
Date: Fri Jan 25 09:42:37 2008 -0500
Fix signal ordering; remove hard-wired name tests in TestSignalSet.
frysk-sys/frysk/sys/ChangeLog
2008-01-25 Andrew Cagney <cagney@redhat.com>
* Signal.java-sh (compareTo(Object)): Fix ordering.
* TestSignal.java (testCompareTo()): New.
* TestSignalSet.java (testSingleToString())
(testMultiToString()): Do not hard-wire signal names and numbers.
-----------------------------------------------------------------------
Summary of changes:
frysk-sys/frysk/sys/ChangeLog | 7 +++++++
frysk-sys/frysk/sys/Signal.java-sh | 2 +-
frysk-sys/frysk/sys/TestSignal.java | 9 +++++++++
frysk-sys/frysk/sys/TestSignalSet.java | 10 ++++++----
4 files changed, 23 insertions(+), 5 deletions(-)
First 500 lines of diff:
diff --git a/frysk-sys/frysk/sys/ChangeLog b/frysk-sys/frysk/sys/ChangeLog
index b233dc8..39912ff 100644
--- a/frysk-sys/frysk/sys/ChangeLog
+++ b/frysk-sys/frysk/sys/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-25 Andrew Cagney <cagney@redhat.com>
+
+ * Signal.java-sh (compareTo(Object)): Fix ordering.
+ * TestSignal.java (testCompareTo()): New.
+ * TestSignalSet.java (testSingleToString())
+ (testMultiToString()): Do not hard-wire signal names and numbers.
+
2008-01-23 Andrew Cagney <cagney@redhat.com>
* Signal.java-sh (valueOf(int)): Make package-private.
diff --git a/frysk-sys/frysk/sys/Signal.java-sh b/frysk-sys/frysk/sys/Signal.java-sh
index 6c91559..3c5fa4a 100644
--- a/frysk-sys/frysk/sys/Signal.java-sh
+++ b/frysk-sys/frysk/sys/Signal.java-sh
@@ -99,7 +99,7 @@ public class Signal implements Comparable {
}
public int compareTo(Object o) {
Signal rhs = (Signal)o; // exception ok
- return rhs.intValue() - this.intValue();
+ return this.intValue() - rhs.intValue();
}
/**
diff --git a/frysk-sys/frysk/sys/TestSignal.java b/frysk-sys/frysk/sys/TestSignal.java
index f399e03..1414566 100644
--- a/frysk-sys/frysk/sys/TestSignal.java
+++ b/frysk-sys/frysk/sys/TestSignal.java
@@ -70,6 +70,15 @@ public class TestSignal extends TestCase {
check(15, Signal.TERM, "SIGTERM");
}
+ public void testCompareTo() {
+ assertTrue("SIGNONE < SIGKILL",
+ Signal.NONE.compareTo(Signal.KILL) < 0);
+ assertTrue("SIGKILL == SIGKILL",
+ Signal.KILL.compareTo(Signal.KILL) == 0);
+ assertTrue("SIGTERM > SIGKILL",
+ Signal.TERM.compareTo(Signal.KILL) > 0);
+ }
+
public void testUnknown() {
// Something large, that will create an unknown signal.
final int sig = 100000000;
diff --git a/frysk-sys/frysk/sys/TestSignalSet.java b/frysk-sys/frysk/sys/TestSignalSet.java
index 68d6bad..ba0607b 100644
--- a/frysk-sys/frysk/sys/TestSignalSet.java
+++ b/frysk-sys/frysk/sys/TestSignalSet.java
@@ -1,6 +1,6 @@
// This file is part of the program FRYSK.
//
-// Copyright 2005, 2006, Red Hat Inc.
+// Copyright 2005, 2006, 2008, Red Hat Inc.
//
// FRYSK is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
@@ -129,17 +129,19 @@ public class TestSignalSet extends TestCase {
assertEquals ("empty set", "{}", new SignalSet().toString());
}
public void testSingleToString() {
- assertEquals("SIGHUP set", "{SIGHUP}",
+ assertEquals("SIGHUP set", "{" + Signal.HUP + "}",
new SignalSet(Signal.HUP).toString());
}
public void testMultiToString() {
// assumes a specific ordering
if (Signal.HUP.compareTo(Signal.USR1) < 0)
- assertEquals("SIGHUP+SIGUSR1 set", "{SIGUSR1,SIGHUP}",
+ assertEquals("SIGHUP+SIGUSR1 set",
+ "{" + Signal.HUP + "," + Signal.USR1 + "}",
new SignalSet(new Signal[] {Signal.HUP, Signal.USR1})
.toString());
else
- assertEquals("SIGHUP+SIGUSR1 set", "{SIGHUP,SIGUSR1}",
+ assertEquals("SIGHUP+SIGUSR1 set",
+ "{" + Signal.USR1 + "," + Signal.HUP + "}",
new SignalSet(new Signal[] {Signal.HUP, Signal.USR1})
.toString());
}
hooks/post-receive
--
frysk system monitor/debugger
More information about the Frysk-cvs
mailing list