Commits

sk  committed bdfcb80

Tests now initialize swank through launcher.

  • Participants
  • Parent commits bb2a102

Comments (0)

Files changed (1)

File src/org/lispdev/swank/SwankInterfaceTest.java

 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 public class SwankInterfaceTest extends SwankInterface
 {
+  private SwankInterface si = null;
+
   private static final String dir =
     "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\";
 
     super(dir,4005,SBCLImplementation.findImplementation(dir));
   }
 
+  private static SwankInterface startSwank()
+  {
+    SwankInterface res = null;
+    try
+    {
+      ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+      ILaunchConfigurationType cfgType =
+        manager.getLaunchConfigurationType(BaseLocalLispLaunchDelegate.ID);
+      ILaunchConfiguration cfg = cfgType.newInstance(null, "swank");
+      ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
+      wc.setAttribute(BaseLocalLispLaunchDelegate.ATTR_EXE,
+          "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\sbcl\\sbcl.exe");
+      wc.setAttribute(BaseLocalLispLaunchDelegate.ATTR_CMD_PARAMS,
+          Arrays.asList("--load",
+              "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\slime\\swank-loader.lisp"));
+      wc.setAttribute(BaseLocalLispLaunchDelegate.ATTR_ENV,
+          new HashMap<String,String>()
+          {private static final long serialVersionUID = 1L;
+          {put("SBCL_HOME","D:\\projects\\lispdev\\ws\\org.lispdev.swank\\sbcl\\");}});
+      wc.setAttribute(BaseLocalLispLaunchDelegate.ATTR_EXT,
+          "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\");
+      wc.setAttribute(BaseLocalLispLaunchDelegate.ATTR_PORT, 4005);
+      cfg = wc.doSave();
+      ILaunch launch = cfg.launch(ILaunchManager.PROFILE_MODE, null, false);
+      cfg.delete();
+      if( launch.getProcesses() != null && launch.getProcesses().length > 0
+          && launch.getProcesses()[0] instanceof LispProcess )
+      {
+        LispProcess lp = (LispProcess)launch.getProcesses()[0];
+        res = (SwankInterface)lp.getSwank();
+      }
+    }
+    catch ( CoreException e )
+    {
+      e.printStackTrace();
+    }
+    return res;
+  }
+
   // class for synchronization
   private class myBoolean
   {
   @Before
   public void init()
   {
-    if( !isConnected() )
-    {
-      initParams(new TestRunnableDriver());
-      connect();
-    }
+    si = startSwank();
+    si.connect();
   }
 
   @After
   public void end()
   {
-    disconnect();
+    si.disconnect();
+    si = null;
   }
 
   /*
     @Test
   public void test_debugStep()
   {
-    String res = sendEvalAndGrab(
+    String res = si.sendEvalAndGrab(
         "(declaim (optimize (speed 0) (space 0) (debug 3)))\n",1000);
-    res = sendEvalAndGrab("(defun g (x)\n" +
+    res = si.sendEvalAndGrab("(defun g (x)\n" +
         "  (progn\n" +
         "    (format t \"1 ~a~%\" (elt (progn (break) x) 1))\n" +
         "    (format t \"2 ~a~%\" (elt x 2))\n" +
       public void run()
       {
         String thread = debugInfo.result.get(1).value;
-        swank.removeListener(debugInfo);
-        swank.addListener(SwankEvent.DEBUG, debugInfo1);
-        sendStepDebug(null, thread);
+        si.swank.removeListener(debugInfo);
+        si.swank.addListener(SwankEvent.DEBUG, debugInfo1);
+        si.sendStepDebug(null, thread);
       }
     };
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
     try
     {
       synchronized(debugStart)
       {
-        sendEval("(g '(1 2 3))", null);
+        si.sendEval("(g '(1 2 3))", null);
         debugStart.wait(2000);
       }
     }
     catch(Exception e)
     {}
-    swank.removeListener(debugInfo1);
-    swank.removeListener(debugStart);
+    si.swank.removeListener(debugInfo1);
+    si.swank.removeListener(debugStart);
 
     assertEquals(true,debugInfo.result.toString().contains(
         "[Condition of type SIMPLE-CONDITION]"));
           if( !started.get() )
           {
             started.set(true);
-            sendReadString("abcde\n", null, result.get(1).value,
+            si.sendReadString("abcde\n", null, result.get(1).value,
                 result.get(2).value);
           }
         }
       }
     };
-    swank.addListener(SwankEvent.READ_STRING, readListener);
+    si.swank.addListener(SwankEvent.READ_STRING, readListener);
     try
     {
       synchronized(readListener)
       {
-        sendEval("(setf res (read-line))", null);
+        si.sendEval("(setf res (read-line))", null);
         readListener.wait(1000);
       }
     }
     catch(Exception e)
     {}
-    swank.removeListener(readListener);
+    si.swank.removeListener(readListener);
     assertEquals(":read-string", readListener.result.get(0).value);
-    String res = sendEvalAndGrab("res", 1000);
+    String res = si.sendEvalAndGrab("res", 1000);
     assertEquals("\"abcde\"", res);
   }
 
   @Test
   public void test_macroexpand()
   {
-    sendEvalAndGrab("(defmacro with-gensyms ((&rest names) &body body)\n" +
+    si.sendEvalAndGrab("(defmacro with-gensyms ((&rest names) &body body)\n" +
         "  `(let ,(loop for n in names collect `(,n (gensym)))\n" +
         "     ,@body))", 1000);
-    sendEvalAndGrab("(defmacro do-primes ((var start end) &body body)\n" +
+    si.sendEvalAndGrab("(defmacro do-primes ((var start end) &body body)\n" +
         "  (with-gensyms (ending-value-name)\n" +
         "    `(do ((,var (next-prime ,start) (next-prime (1+ ,var)))\n" +
         "          (,ending-value-name ,end))\n" +
     {
       synchronized(callBack)
       {
-        sendMacroExpand("(do-primes (p 0 19) (format t \"~d \" p))", callBack,
+        si.sendMacroExpand("(do-primes (p 0 19) (format t \"~d \" p))", callBack,
             false, "nil");
         callBack.wait(1000);
       }
     {
       synchronized(callBack)
       {
-        sendMacroExpand("(do-primes (p 0 19) (format t \"~d \" p))", callBack,
+        si.sendMacroExpand("(do-primes (p 0 19) (format t \"~d \" p))", callBack,
             true, "nil");
         callBack.wait(1000);
       }
         }
       }
     };
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
     try
     {
       synchronized(debugInfo)
       {
-        sendEval("(read-line)", null);
-        sendInterrupt(null);
+        si.sendEval("(read-line)", null);
+        si.sendInterrupt(null);
         debugInfo.wait(1000);
       }
     }
     catch(Exception e)
     {}
-    swank.removeListener(debugInfo);
+    si.swank.removeListener(debugInfo);
 
     assertEquals("Interrupt from Emacs", debugInfo.result.get(3).get(0).value);
   }
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun g (x)\n  (z x))\n\n(defun z (x)\n  (y x))\n",
+        si.sendCompileString("(defun g (x)\n  (z x))\n\n(defun z (x)\n  (y x))\n",
             "test.lisp", extDir, 0, "nil", callBack);
         callBack.wait(1000);
       } // sync
             started.set(true);
             LispNode info = debugInfo.result;
             String thread = info.get(1).value;
-            sendInspectFrameLocal(thread, "1", "0", callBack);
+            si.sendInspectFrameLocal(thread, "1", "0", callBack);
           }
         }
       }
       {}
     };
 
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
-    swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
     try
     {
       synchronized(debugStop)
         {
           synchronized(callBack)
           {
-            sendCompileString("(g 3)\n", "test.lisp", extDir, 40, "nil",
+            si.sendCompileString("(g 3)\n", "test.lisp", extDir, 40, "nil",
                 callBack);
             callBack.wait(1000);
           } // sync
     {
       e.printStackTrace();
     }
-    swank.removeListener(debugStart);
-    swank.removeListener(debugInfo);
-    swank.removeListener(debugStop);
+    si.swank.removeListener(debugStart);
+    si.swank.removeListener(debugInfo);
+    si.swank.removeListener(debugStop);
     // if test fails the frame might be wrong - try to change "32" in
     // sendGetFrameSourceLocation("32", thread, callBack) above.
     assertEquals("((`Value: 3 = #x00000003 = #o3 = #b11 = 3.e+0` `\n" +
     {
       try
       {
-        sendEval("\"this\"", callBack);
+        si.sendEval("\"this\"", callBack);
         callBack.wait(1000);
       }
       catch(InterruptedException e)
     {
       try
       {
-        sendInspectReplResult("1", callBack);
+        si.sendInspectReplResult("1", callBack);
         callBack.wait(1000);
       }
       catch(InterruptedException e)
     {
       try
       {
-        sendInspectInspectedPart("4", callBack);
+        si.sendInspectInspectedPart("4", callBack);
         callBack.wait(1000);
       }
       catch(InterruptedException e)
     {
       try
       {
-        sendInspectorPop(callBack);
+        si.sendInspectorPop(callBack);
         callBack.wait(1000);
       }
       catch(InterruptedException e)
     {
       try
       {
-        sendInspectorNext(callBack);
+        si.sendInspectorNext(callBack);
         callBack.wait(1000);
       }
       catch(InterruptedException e)
   @Test
   public void test_sendUndefine()
   {
-    String res = sendEvalAndGrab("(defun f (x) (+ 2 x))", 500);
+    String res = si.sendEvalAndGrab("(defun f (x) (+ 2 x))", 500);
     assertEquals("F", res);
-    res = sendEvalAndGrab("(f 3)", 1000);
+    res = si.sendEvalAndGrab("(f 3)", 1000);
     assertEquals("5", res);
     final SwankRunnable callBack = new SwankRunnable(){
       @Override
     {
       try
       {
-        sendUndefine("f", "nil", callBack);
+        si.sendUndefine("f", "nil", callBack);
         callBack.wait(1000);
       }
       catch(InterruptedException e)
         }
       }
     };
-    swank.addListener(SwankEvent.DEBUG, debug);
+    si.swank.addListener(SwankEvent.DEBUG, debug);
     synchronized(debug)
     {
       try
       {
-        res = sendEvalAndGrab("(f 3)", 1000);
+        res = si.sendEvalAndGrab("(f 3)", 1000);
         debug.wait(1000);
       }
       catch(Exception e)
       {}
     }
-    swank.removeListener(debug);
+    si.swank.removeListener(debug);
     assertEquals("", res);
     assertEquals("The function F is undefined.",
         debug.result.get(3).get(0).value);
   @Test
   public void test_setPackage()
   {
-    String res = sendEvalAndGrab("(defpackage :my (:use :cl))", 1000);
+    String res = si.sendEvalAndGrab("(defpackage :my (:use :cl))", 1000);
     assertEquals("#<PACKAGE \"MY\">", res);
-    setPackage("MY");
-    res = sendEvalAndGrab("*package*", 1000);
+    si.setPackage("MY");
+    res = si.sendEvalAndGrab("*package*", 1000);
     assertEquals("#<PACKAGE \"MY\">", res);
-    setPackage("CL-USER");
-    res = sendEvalAndGrab("*package*", 1000);
+    si.setPackage("CL-USER");
+    res = si.sendEvalAndGrab("*package*", 1000);
     assertEquals("#<PACKAGE \"COMMON-LISP-USER\">", res);
   }
 
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun f (x)\n  (+ 2 (g x)))\n", "test.lisp",
+        si.sendCompileString("(defun f (x)\n  (+ 2 (g x)))\n", "test.lisp",
             extDir, 0, "nil", callBack);
         callBack.wait(1000);
       } // sync
             started.set(true);
             LispNode info = debugInfo.result;
             String thread = info.get(1).value;
-            sendGetFrameSourceLocation(frame, thread, callBack);
+            si.sendGetFrameSourceLocation(frame, thread, callBack);
           }
         }
       }
       {}
     };
 
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
-    swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
     try
     {
       synchronized(debugStop)
         {
           synchronized(callBack)
           {
-            sendCompileString("(f 4)\n", "test.lisp", extDir, 25, "nil",
+            si.sendCompileString("(f 4)\n", "test.lisp", extDir, 25, "nil",
                 callBack);
             callBack.wait(1000);
           } // sync
     {
       e.printStackTrace();
     }
-    swank.removeListener(debugStart);
-    swank.removeListener(debugInfo);
-    swank.removeListener(debugStop);
+    si.swank.removeListener(debugStart);
+    si.swank.removeListener(debugInfo);
+    si.swank.removeListener(debugStop);
     return callBack.getReturn().getf(":swank-compilation-unit")
       .getf(":message").value.equals("undefined function: G")
       && callBack.getReturn().getf(":swank-compilation-unit")
             started.set(true);
             LispNode info = debugInfo.result;
             String thread = info.get(1).value;
-            sendGetFrameLocals("2", thread, callBack);
+            si.sendGetFrameLocals("2", thread, callBack);
           }
         }
       }
       {}
     };
 
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
-    swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
     try
     {
       synchronized(debugStop)
         {
           synchronized(callBack)
           {
-            sendEval("(defun f (x) (+ 2 (g x)))\n", null);
+            si.sendEval("(defun f (x) (+ 2 (g x)))\n", null);
             callBack.wait(500);
           } // sync
         }
         {
           synchronized(callBack)
           {
-            sendEval("(f 4)\n", null);
+            si.sendEval("(f 4)\n", null);
             callBack.wait(500);
           } // sync
         }
     {
       e.printStackTrace();
     }
-    swank.removeListener(debugStart);
-    swank.removeListener(debugInfo);
-    swank.removeListener(debugStop);
+    si.swank.removeListener(debugStart);
+    si.swank.removeListener(debugInfo);
+    si.swank.removeListener(debugStop);
     assertEquals("((`:name` `SB-DEBUG::ARG-0` `:id` `0` `:value` `(F 4)` ) "
         + "(`:name` `SB-DEBUG::ARG-1` `:id` `0` `:value` `#<NULL-LEXENV>` ) )",
         callBack.getReturn().toString());
     {
       synchronized(callBack)
       {
-        sendGetDocumentation("defun", "nil", callBack);
+        si.sendGetDocumentation("defun", "nil", callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendGetConnectionInfo(callBack);
+        si.sendGetConnectionInfo(callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun g (x)\n  (+ 2 x))\n", "test.lisp", extDir,
+        si.sendCompileString("(defun g (x)\n  (+ 2 x))\n", "test.lisp", extDir,
             0, "nil", callBack);
         callBack.wait(1000);
       } // sync
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun f (x)\n  (+ 2 (g x)))\n", "test.lisp",
+        si.sendCompileString("(defun f (x)\n  (+ 2 (g x)))\n", "test.lisp",
             extDir, 25, "nil", callBack);
         callBack.wait(1000);
       } // sync
     {
       synchronized(callBack)
       {
-        sendGetCallees("f", "nil", callBack);
+        si.sendGetCallees("f", "nil", callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendGetCallers("g", "nil", callBack);
+        si.sendGetCallers("g", "nil", callBack);
         callBack.wait(15000); // yep xref is crazy slow
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendGetAvailablePackages(callBack);
+        si.sendGetAvailablePackages(callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun g (x)\n  (+ 2 x))", "test.lisp", extDir,
+        si.sendCompileString("(defun g (x)\n  (+ 2 x))", "test.lisp", extDir,
             0, "nil", callBack);
         callBack.wait(1000);
       } // sync
     {
       synchronized(callBack)
       {
-        sendFindDefinitions("g", "nil", callBack);
+        si.sendFindDefinitions("g", "nil", callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendEval("(+ 1 3)", callBack);
+        si.sendEval("(+ 1 3)", callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun g (x)\n  (+ 1 x))", "test.lisp", extDir,
+        si.sendCompileString("(defun g (x)\n  (+ 1 x))", "test.lisp", extDir,
             0, "nil", callBack);
         callBack.wait(1000);
       } // sync
     {
       synchronized(callBack)
       {
-        sendDisassemble("g", "nil", callBack);
+        si.sendDisassemble("g", "nil", callBack);
         callBack.wait(1000);
       } // sync
     }
       public void run()
       {}
     };
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
     try
     {
       synchronized(callBack)
       {
-        sendDebugThread("0", callBack);
+        si.sendDebugThread("0", callBack);
         callBack.wait(1000);
       }
     }
     {
       e.printStackTrace();
     }
-    swank.removeListener(debugInfo);
+    si.swank.removeListener(debugInfo);
     assertEquals(":debug", debugInfo.result.get(0).value);
   }
 
     {
       synchronized(callBack)
       {
-        sendListThreads(callBack);
+        si.sendListThreads(callBack);
         callBack.wait(1000);
       }
     }
     {
       synchronized(callBack)
       {
-        sendCompileString("(defun g (x)\n  (+ 1 x))", "test.lisp", extDir,
+        si.sendCompileString("(defun g (x)\n  (+ 1 x))", "test.lisp", extDir,
             0, "nil", callBack);
         callBack.wait(1000);
       } // sync
     assertEquals("nil", String.valueOf(callBack.getReturn().get(1).value));
     assertEquals("(`t` )", String.valueOf(callBack.getReturn().get(2)));
 
-    final String res = sendEvalAndGrab("(g 2)", 1000);
+    final String res = si.sendEvalAndGrab("(g 2)", 1000);
     assertEquals("3", res);
   }
 
     {
       synchronized(callBack)
       {
-        sendCompileFile(extDir + "test.lisp", callBack);
+        si.sendCompileFile(extDir + "test.lisp", callBack);
         callBack.wait(1000);
       } // sync
     }
     assertEquals("nil", String.valueOf(callBack.getReturn().get(1).value));
     assertEquals("(`t` )", String.valueOf(callBack.getReturn().get(2)));
 
-    final String res = sendEvalAndGrab("(f 2)", 1000);
+    final String res = si.sendEvalAndGrab("(f 2)", 1000);
     assertEquals("3", res);
   }
 
         LispNode info = debugInfo.result;
         String thread = info.get(1).value;
 
-        sendQuitDebug(callBack, thread);
+        si.sendQuitDebug(callBack, thread);
       }
     };
 
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
     try
     {
       synchronized(callBack)
       {
-        sendEval("(list (break) 3)", null);
+        si.sendEval("(list (break) 3)", null);
         callBack.wait(500);
       } // sync
     }
     {
       e.printStackTrace();
     } // catch
-    swank.removeListener(debugStart);
-    swank.removeListener(debugInfo);
+    si.swank.removeListener(debugStart);
+    si.swank.removeListener(debugInfo);
     assertEquals(true, String.valueOf(debugStart.result)
         .startsWith("(`:debug-activate` "));
     assertEquals("(`:return` (`:abort` ) `3` )", String
         // LispNode options = info.get(4);
         // LispNode backtrace = info.get(5);
 
-        sendDebug("1", level, thread, callBack);
+        si.sendDebug("1", level, thread, callBack);
       }
     };
     final SwankRunnable debugStop = new SwankRunnable(){
       {}
     };
 
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
-    swank.addListener(SwankEvent.DEBUG, debugInfo);
-    swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, debugStart);
+    si.swank.addListener(SwankEvent.DEBUG, debugInfo);
+    si.swank.addListener(SwankEvent.DEBUG_RETURN, debugStop);
     try
     {
       synchronized(debugStop)
         {
           synchronized(callBack)
           {
-            sendEval("(list (break) 3)", null);
+            si.sendEval("(list (break) 3)", null);
             callBack.wait(500);
           } // sync
         }
     {
       e.printStackTrace();
     }
-    swank.removeListener(debugStart);
-    swank.removeListener(debugInfo);
-    swank.removeListener(debugStop);
+    si.swank.removeListener(debugStart);
+    si.swank.removeListener(debugInfo);
+    si.swank.removeListener(debugStop);
     assertEquals(true, String.valueOf(debugStart.result)
         .startsWith("(`:debug-activate` "));
     assertEquals("(`:return` (`:abort` ) `3` )", String
       {}
     };
 
-    swank.addListener(SwankEvent.DEBUG_ACTIVATE, callBack);
+    si.swank.addListener(SwankEvent.DEBUG_ACTIVATE, callBack);
     try
     {
       synchronized(callBack)
       {
-        sendEval("(f 3)", null);
+        si.sendEval("(f 3)", null);
         callBack.wait(1000);
       } // sync
     }
     {
       e.printStackTrace();
     } // catch
-    swank.removeListener(callBack);
+    si.swank.removeListener(callBack);
     assertEquals(true, String.valueOf(callBack.result)
         .startsWith("(`:debug-activate` "));
   }
       {}
     };
 
-    swank.addListener(SwankEvent.DEBUG, callBack);
+    si.swank.addListener(SwankEvent.DEBUG, callBack);
     try
     {
       synchronized(callBack)
       {
-        sendEval("(f 3)", null);
+        si.sendEval("(f 3)", null);
         callBack.wait(1000);
       } // sync
     }
     {
       e.printStackTrace();
     } // catch
-    swank.removeListener(callBack);
+    si.swank.removeListener(callBack);
     assertEquals(":debug", callBack.result.get(0).value);
     assertEquals("1", callBack.result.get(2).value);
     assertEquals("(`The function F is undefined.` `   "
   @Test
   public void test_basicStartup()
   {
-    String res = basicStartup(false, null, extDir);
+    String res = si.basicStartup(false, null, extDir);
     assertEquals(true,res.startsWith("\"You are running SBCL 1.0."));
   }
 
   @Test
   public void test_getSpecialArgList()
   {
-    sendEvalAndGrab("(defun foo (x &key a b c) (list x a b c))\n", 1000);
-    String r2 = getSpecialArglist("foo", "a", 1000);
+    si.sendEvalAndGrab("(defun foo (x &key a b c) (list x a b c))\n", 1000);
+    String r2 = si.getSpecialArglist("foo", "a", 1000);
     assertEquals("(foo x &key a b c)", r2);
   }
 
   @Test
   public void test_getCompletionsAndDocs()
   {
-    String[][] res = getCompletionsAndDocs("def", "nil", 1000, 3, false, 2);
+    String[][] res = si.getCompletionsAndDocs("def", "nil", 1000, 3, false, 2);
     ArrayList<ArrayList<String>> s = new ArrayList<ArrayList<String>>();
     for(String[] r : res)
     {
   @Test
   public void test_getCompletions()
   {
-    String[] res = getCompletions("in-", "nil", 1000, false, 10);
+    String[] res = si.getCompletions("in-", "nil", 1000, false, 10);
     String expected = "[, in-package]";
     assertEquals(expected, String.valueOf(Arrays.asList(res)));
 
-    res = getCompletions("i-p", "nil", 1000, true, 10);
+    res = si.getCompletions("i-p", "nil", 1000, true, 10);
     expected =
         "[in-package, input-stream-p, interactive-stream-p, "
             + "internal-time-units-per-second, float-infinity-p, "
   @Test
   public void test_getAvailablePackages()
   {
-    ArrayList<String> res = getAvailablePackages(1000);
+    ArrayList<String> res = si.getAvailablePackages(1000);
     assertEquals(true,String.valueOf(res).startsWith(
         "[SWANK-IO-PACKAGE, SWANK, SB-CLTL2-SYSTEM, SB-CLTL2, " +
         "SB-POSIX-SYSTEM, SB-POSIX, SB-INTROSPECT, " +
   @Test
   public void test_getMakeInstanceArgList()
   {
-    String tmp = sendEvalAndGrab("(defclass person ()\r\n" +
+    String tmp = si.sendEvalAndGrab("(defclass person ()\r\n" +
         "  ((name :accessor person-name\r\n" +
         "         :initform 'bill\r\n" +
         "         :initarg :name)\r\n" +
         "        :initarg :age)))\r\n",
         1000);
     assertEquals("#<STANDARD-CLASS PERSON>",tmp);
-    String res = getMakeInstanceArglist("person", 1000);
+    String res = si.getMakeInstanceArglist("person", 1000);
     assertEquals("(make-instance 'person &key (name 'bill) (age 10) &allow-other-keys &rest\n initargs)",res);
   }
 
   @Test
   public void test_sendEvalAndGrab()
   {
-    String res = sendEvalAndGrab("(+ 2 3)", 1000);
+    String res = si.sendEvalAndGrab("(+ 2 3)", 1000);
     assertEquals("5",res);
   }
 
   {
     // SK: on my system (WinXP, sbcl), I don't have SBCL sources, so
     // res = false. It might be true with SBCL sources.
-    boolean res = haveDefinitions("*query-io*", ":wiz", 2000);
+    boolean res = si.haveDefinitions("*query-io*", ":wiz", 2000);
     assertTrue(!res);
   }
 
   @Test
   public void test_getDocumentation()
   {
-    String res = getDocumentation("defun", 1000);
+    String res = si.getDocumentation("defun", 1000);
     assertEquals("Define a function at top level.",res);
-    res = getDocumentation("main", 1000);
+    res = si.getDocumentation("main", 1000);
     assertEquals("",res);
   }
 
   @Test
   public void test_getArglist()
   {
-    String res = getArglist("defun", 1000);
+    String res = si.getArglist("defun", 1000);
     assertEquals("(defun &ENVIRONMENT ENV NAME ARGS &BODY BODY)", res);
-    res = getArglist("format", 1000);
+    res = si.getArglist("format", 1000);
     assertEquals("(format DESTINATION CONTROL-STRING &REST FORMAT-ARGUMENTS)", res);
   }
 
     {
       synchronized(callBack)
       {
-        sendGetArglist("defun", "nil", callBack);
+        si.sendGetArglist("defun", "nil", callBack);
         callBack.wait(1000);
       } // sync
     }
     {
       synchronized(callBack)
       {
-        sendApropos("defun", callBack);
+        si.sendApropos("defun", callBack);
         callBack.wait(1000);
       } // sync
     }