Changeset 1169

Show
Ignore:
Timestamp:
05/19/08 03:07:14 (4 months ago)
Author:
fraserofthenight
Message:

- Removed some sync issues with descent.unittest runtime
- Started porting Flectioned to newest Tango (it doesn't work yet)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/descent.unittest/flute/.settings/descent.core.prefs

    r1106 r1169  
    1 #Sun Apr 13 00:24:15 PDT 2008 
     1#Sat May 17 20:27:32 PDT 2008 
    22descent.core.compiler.allowDeprecated=disabled 
    33descent.core.compiler.debugIdentifiers= 
     
    99descent.core.compiler.taskPriorities=NORMAL,HIGH,LOW,HIGH,LOW,NORMAL 
    1010descent.core.compiler.taskTags=TODO,FIXME,PERHAPS,WTF,NEXTVERSION,TANGO 
    11 descent.core.compiler.versionIdentifiers=DigitalMars, Windows, Win32, X86, LittleEndian, D_InlineAsm, D_InlineAsm_X86, all, FluteUnittests 
     11descent.core.compiler.versionIdentifiers=DigitalMars, Windows, Win32, X86, LittleEndian, D_InlineAsm, D_InlineAsm_X86, all, Tango 
    1212descent.core.compiler.versionLevel=0 
    1313descent.core.formatter.alignment_for_array_literals=16 
  • trunk/descent.unittest/flute/src/cn/kuehne/flectioned.d

    r1156 r1169  
    9191 
    9292// import hell (-version=Tango isn't reliable) 
    93 const bool inTango = false; 
    94 const bool inPhobos = true; 
     93version(Tango) 
     94
     95    const bool inTango = true; 
     96    const bool inPhobos = false; 
     97
     98else 
     99
     100    const bool inTango = false; 
     101    const bool inPhobos = true; 
     102
    95103 
    96104static if(inTango){ 
     
    102110    import tango.core.Exception : IllegalArgumentException; 
    103111    import tango.stdc.string : memmove, memcpy, memcmp, strcmp; 
    104     import tango.stdc.stringz : ptr2array = fromUtf8z; 
     112    import tango.stdc.stringz : ptr2array = fromStringz; 
    105113    import tango.stdc.stdio : sscanf, printf; 
    106     import tango.text.convert.Integer : size2array = toUtf8
     114    import tango.text.convert.Integer : size2array = toString
    107115    import tango.core.Array : find, rfind; 
    108116    import tango.text.Util : delimit; 
     
    110118    private alias tango.stdc.errno.errno getErrno; 
    111119    private alias tango.stdc.errno.errno setErrno; 
    112     import tango.core.Exception : TracedExceptionInfo, setTraceHandler; 
    113120 
    114121    private uint toUint(char[] s){ 
     
    121128 
    122129    private char[] getString(Object o){ 
    123         return o.toUtf8(); 
     130        return o.toString(); 
    124131    } 
    125132}else static if(inPhobos){ 
     
    442449    } 
    443450 
    444     static if(inTango){ 
    445         /// toString wrapper for Tango 
    446         override char[] toUtf8() 
    447         out(s){ 
    448             assert(s.length > 0); 
    449         }body{ 
    450             return toString(); 
    451         } 
    452     }else static if(!inPhobos){ 
    453         static assert(0, "neither object.Object.toUtf8 nor object.Object.toString found"); 
    454     } 
    455  
    456     string toString() 
     451    override string toString() 
    457452    out(s){ 
    458453        assert(s.length > 0); 
     
    929924            } 
    930925        } 
    931     } 
    932  
    933     string toUtf8(){ 
    934         return toString(); 
    935926    } 
    936927 
     
    10671058 
    10681059 
    1069 static if(inTango){ 
     1060/+ static if(inTango){ 
    10701061    /** 
    10711062     * Exception containing stack trace information is provided by Tango, 
     
    10731064     * ... thus the opApply-trick 
    10741065     */ 
    1075     class TracedException : tango.core.Exception.TracedException{ 
     1066    class TracedException : Exception{ 
    10761067        /// 
    10771068        Trace[] trace; 
     
    11021093            opApply(dg); 
    11031094        } 
    1104          
    1105         /// 
    1106         static TracedExceptionInfo tangoTraceHandler(void* ptr = null){ 
    1107             return new FlectionedTrace(ptr); 
    1108         } 
    11091095 
    11101096        /// 
     
    11171103        } 
    11181104 
    1119         private static class FlectionedTrace : TracedExceptionInfo
     1105        private static class FlectionedTrace
    11201106            this(void* ptr = null ){ 
    11211107                if(ptr){ 
     
    11661152        } 
    11671153    } 
    1168 }else static if(inPhobos){ 
     1154 }else static if(inPhobos){ +/ 
    11691155    /** 
    11701156     * Exception containing stack trace information. 
     
    13501336    } 
    13511337     
    1352 }else{ 
     1338/+ }else{ 
    13531339    static assert(0, "neither Phobos nor Tango"); 
    1354 } 
     1340} +/ 
    13551341 
    13561342private void print_traced_exception(Exception e) 
  • trunk/descent.unittest/flute/src/org/dsource/descent/flute/flute.d

    r1164 r1169  
    340340 
    341341/// A Flectioned marker indicating a unittest 
    342 private const char[] UNITTEST_MARKER = ".__unittest"; 
     342private char[] UNITTEST_MARKER = ".__unittest"; 
    343343 
    344344/// A marker indicating a named test 
    345 private const char[] NAMED_TEST_MARKER = ".__setTestName!(__testName_"; 
     345private char[] NAMED_TEST_MARKER = ".__setTestName!(__testName_"; 
    346346 
    347347/// A string containing version information, printed at the start of the application 
    348 private const char[] VERSION_STRING = "flute 0.1"; 
     348private char[] VERSION_STRING = "flute 0.1"; 
    349349 
    350350/** 
     
    352352 * "on" or "off" 
    353353 */ 
    354 private const string STACKTRACE_ATTR = "stacktrace"; 
     354private char[] STACKTRACE_ATTR = "stacktrace"; 
    355355 
    356356/* 
     
    484484                char[] toHex(size_t val) 
    485485                { 
    486                     const int percision = (void*).sizeof * 2; 
     486                    int percision = (void*).sizeof * 2; 
    487487                     
    488488                    version(inPhobos) 
     
    856856                assert(false); 
    857857        } 
     858        return null; 
    858859    } 
    859860     
     
    902903                        error++; 
    903904                        break; 
     905                    default: 
     906                        assert(false); 
    904907                } 
    905908            } 
     
    10251028        goto LnextCommand; 
    10261029    } 
     1030     
     1031    assert(false); 
    10271032} 
    10281033 
  • trunk/descent.unittest/flute/src/org/dsource/descent/flute/io.d

    r1164 r1169  
    1212version(Tango) 
    1313{ 
    14      
     14    version = inTango; 
     15     
     16    static if(!is(typeof(string))) 
     17        private alias char[] string; 
    1518} 
    1619else 
     
    158161                        exit(EXIT_FAILURE); 
    159162                    } 
    160                     uint port = atoi(*portStr); 
     163                    ushort port = cast(ushort) atoi(*portStr); 
    161164                     
    162165                    serv = new TcpSocket(AddressFamily.INET); 
  • trunk/descent.unittest/src/descent/internal/unittest/flute/FluteApplicationInstance.java

    r1162 r1169  
    3232    static final String AWAITING_INPUT = "(flute)"; //$NON-NLS-1$ 
    3333    private static final String LOCALHOST  = "127.0.0.1"; //$NON-NLS-1$ 
     34    private static final long TIMEOUT = 10000; 
    3435     
    3536    private SocketConnection fConn; 
    3637     
    37     private long fTimeout = 10000; 
    3838    private final Object fWaitLock = new Object(); 
    3939    private volatile boolean fWaitLockUsed; 
     
    5555        // connection 
    5656        this.fPort = port; 
    57     } 
    58      
    59     /** 
    60      * Sets the timeout for commands. Particularly important when running 
    61      * tests that could take a while. 
    62      *  
    63      * @param timeout the timeout, in milliseconds 
    64      */ 
    65     public void setTimeout(long timeout) 
    66     { 
    67         fTimeout = timeout; 
    6857    } 
    6958     
     
    7766    public boolean init() throws IOException 
    7867    { 
    79         assert(fState instanceof StartingUp); 
    80         assert(null == fConn); 
     68        if(null != fConn || !(fState instanceof StartingUp)) 
     69            throw new IllegalStateException(); 
    8170         
    8271        beforeWaitStateReturn(); 
    8372         
    84        // Make the connection (interpretation will begin automatically) 
     73        // Wait for the connection to be established... with a timeout! 
    8574        fConn = new SocketConnection(fPort); 
    86        waitStateReturn(); 
    87        boolean retVal = ((StartingUp) fState).hasCorrectVersion; 
    88        setState(fWaitingState); 
    89        return retVal; 
     75        waitStateReturn(TIMEOUT); 
     76        boolean retVal = ((StartingUp) fState).hasCorrectVersion; 
     77        setState(fWaitingState); 
     78        return retVal; 
    9079    } 
    9180     
     
    142131     
    143132    private void waitStateReturn() { 
    144         try { 
    145             synchronized (fWaitLock) { 
    146                 if (!fWaitLockUsed) { 
    147                     fWaitLock.wait(fTimeout); 
    148                 } 
    149             } 
    150         } catch (InterruptedException e) { 
    151             e.printStackTrace(); 
    152         } 
     133        waitStateReturn(0); 
     134    } 
     135     
     136    private void waitStateReturn(long timeout) 
     137    { 
     138        try { 
     139            synchronized (fWaitLock) { 
     140                if (!fWaitLockUsed) { 
     141                    fWaitLock.wait(timeout); 
     142                } 
     143            } 
     144        } catch (InterruptedException e) { 
     145            e.printStackTrace(); 
     146        } 
    153147    } 
    154148     
  • trunk/descent.unittest/src/descent/internal/unittest/flute/RunningOneTest.java

    r1115 r1169  
    4444    private StringBuffer message; 
    4545    private List<StackTraceElement> stackTrace; 
     46    private String internalError; 
    4647     
    4748    RunningOneTest(FluteApplicationInstance cli) 
     
    179180        } 
    180181         
    181         // If we get here, it's probably invalid text. Don't throw an 
    182         // exception because it might be a network error of some sort. 
     182        // If we get here, it's probably invalid text. There's been an internal 
     183        // error (this may desynchronize a lot of other stuff, but in that case 
     184        // there's bigger stuff to worry about 
     185        internalError = text; 
     186        cli.notifyStateReturn(); 
    183187    } 
    184188     
    185189    FluteTestResult getResult() 
    186190    { 
     191        if(internalError != null) 
     192        { 
     193            return FluteTestResult.error( 
     194                    String.format(JUnitMessages.RunningOneTest_internal_error_with_message, 
     195                            internalError), 
     196                    "", //$NON-NLS-1$ 
     197                    NO_STACK_TRACE); 
     198        } 
     199         
    187200        if(resultType == null) 
    188         { 
     201        {    
    189202            return FluteTestResult.error( 
    190203                    JUnitMessages.RunningOneTest_internal_error, 
  • trunk/descent.unittest/src/descent/internal/unittest/launcher/UnittestLaunchConfiguration.java

    r1164 r1169  
    4444public class UnittestLaunchConfiguration extends  
    4545    AbstractDescentLaunchConfigurationDelegate  
    46 
    47     /** 
    48      * The file to load as the list of tests to prioritize (maybe I should 
    49      * rethink how this is done -- no need for a whole file if we're using IPC). 
    50      */ 
    51     // RETHINK 
    52     public static final String FAILURES_FILENAME_ATTR= DescentUnittestPlugin.PLUGIN_ID+".FAILURENAMES"; //$NON-NLS-1$ 
    53      
     46{    
    5447    /** 
    5548     * The file to create next to the fluted executable to use to find the port. 
  • trunk/descent.unittest/src/descent/internal/unittest/model/TestRunSession.java

    r1164 r1169  
    206206     */ 
    207207    public boolean isKeptAlive() { 
    208         return fTestRunnerClient.isRunning() && ILaunchManager.DEBUG_MODE.equals(getLaunch().getLaunchMode())
     208        return false
    209209    } 
    210210 
     
    241241                addFailures(failures, children[i]); 
    242242        } 
    243     } 
    244      
    245     /** 
    246      * @param testId  
    247      * @param launchMode  
    248      * @return <code>false</code> iff the rerun could not be started 
    249      * @throws CoreException  
    250      */ 
    251     public boolean rerunTest(String testId, String launchMode)  
    252             throws CoreException 
    253     { 
    254         // TODO reruns, keeeping in mind the testId could refer to a 
    255         // TestSuiteElement instead of just a TestcaseElement 
    256          
    257         /*TestElement testElement = fIdToTest.get(testId); 
    258          
    259         if(null == testElement) 
    260             return false; 
    261          
    262         TestCaseElement testCaseElement = (TestCaseElement) testElement; 
    263         ITestSpecification test = testCaseElement.getTestSpecification(); 
    264          
    265         if (isKeptAlive()) 
    266         { 
    267             Status status= ((TestCaseElement) getTestElement(testId)).getStatus(); 
    268             if (status == Status.ERROR) { 
    269                 fErrorCount--; 
    270             } else if (status == Status.FAILURE) { 
    271                 fFailureCount--; 
    272             } 
    273             fTestRunnerClient.rerunTest(test); 
    274             return true; 
    275              
    276         } 
    277         else if (getLaunch() != null) 
    278         { 
    279             // run the selected test using the previous launch configuration 
    280             ILaunchConfiguration launchConfiguration= getLaunch().getLaunchConfiguration(); 
    281             if (launchConfiguration != null) { 
    282  
    283                 String name= className; 
    284                 if (testName != null)  
    285                     name+= "."+testName; //$NON-NLS-1$ 
    286                 String configName= Messages.format(JUnitMessages.TestRunnerViewPart_configName, name);  
    287                 ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName);  
    288                 // fix for bug: 64838  unittest view run single test does not use correct class [JUnit]  
    289                 tmp.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, className); 
    290                 // reset the container 
    291                 tmp.setAttribute(JUnitBaseLaunchConfiguration.LAUNCH_CONTAINER_ATTR, ""); //$NON-NLS-1$ 
    292                 if (testName != null) { 
    293                     tmp.setAttribute(JUnitBaseLaunchConfiguration.TESTNAME_ATTR, testName); 
    294                     //  String args= "-rerun "+testId; 
    295                     //  tmp.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args); 
    296                 } 
    297                 tmp.launch(launchMode, null);    
    298                 return true; 
    299             } 
    300         } */ 
    301          
    302         return false; 
    303243    } 
    304244     
  • trunk/descent.unittest/src/descent/internal/unittest/ui/JUnitMessages.java

    r1164 r1169  
    3737    public static String OpenEditorAction_error_dialog_title; 
    3838    public static String OpenEditorAction_message_cannotopen; 
    39     public static String RerunAction_label_debug; 
    40     public static String RerunAction_label_run; 
    4139    public static String RunningOneTest_internal_error; 
     40    public static String RunningOneTest_internal_error_with_message; 
    4241    public static String ScrollLockAction_action_label; 
    4342    public static String ScrollLockAction_action_tooltip; 
     
    4746    public static String ShowPreviousFailureAction_tooltip; 
    4847    public static String TestRunnerViewPart_activate_on_failure_only; 
    49     public static String TestRunnerViewPart_cannotrerun_title; 
    50     public static String TestRunnerViewPart_cannotrerurn_message; 
    5148    public static String TestRunnerViewPart_clear_history_label; 
    52     public static String TestRunnerViewPart_configName; 
    53     public static String TestRunnerViewPart_error_cannotrerun; 
    5449    public static String TestRunnerViewPart_hierarchical_layout; 
    5550    public static String TestRunnerViewPart_history; 
     
    6560    public static String TestRunnerViewPart_rerunaction_label; 
    6661    public static String TestRunnerViewPart_rerunaction_tooltip; 
    67     public static String TestRunnerViewPart_rerunFailedFirstLaunchConfigName; 
    68     public static String TestRunnerViewPart_rerunfailuresaction_label; 
    69     public static String TestRunnerViewPart_rerunfailuresaction_tooltip; 
    7062    public static String TestRunnerViewPart_select_test_run; 
    7163    public static String TestRunnerViewPart_show_failures_only; 
  • trunk/descent.unittest/src/descent/internal/unittest/ui/JUnitMessages.properties

    r1164 r1169  
    3939TestRunnerViewPart_rerunaction_tooltip=Rerun Test 
    4040TestRunnerViewPart_hierarchical_layout=Show Tests in &Hierarchy  
    41 TestRunnerViewPart_rerunfailuresaction_label=Rerun Test - Failures First 
    42 TestRunnerViewPart_rerunfailuresaction_tooltip=Rerun Test - Failures First 
    43 TestRunnerViewPart_rerunFailedFirstLaunchConfigName={0} (Failed Tests first) 
    44 TestRunnerViewPart_error_cannotrerun=Could not rerun test 
    4541TestRunnerViewPart_message_terminated=Terminated 
    46 TestRunnerViewPart_cannotrerun_title=Rerun Test 
    47 TestRunnerViewPart_cannotrerurn_message=To rerun tests they must be launched under the debugger\nand \'Keep JUnit running\' must be set in the launch configuration. 
    4842TestRunnerViewPart_clear_history_label=&Clear Terminated 
    4943TestRunnerViewPart_label_failure=Failure Trace 
     
    5246TestRunnerViewPart_message_stopped= Stopped 
    5347TestRunnerViewPart_message_stopping=Stopping... 
    54 TestRunnerViewPart_configName=Rerun {0} 
    5548TestRunnerViewPart_layout_menu=Layout 
    5649TestRunnerViewPart_Launching=Launching {0}... 
     
    10295ExpandAllAction_text=Expand All 
    10396ExpandAllAction_tooltip=Expand All Nodes 
    104 RerunAction_label_run=&Run 
    105 RerunAction_label_debug=&Debug 
    10697RunningOneTest_internal_error=Internal error running test 
     98RunningOneTest_internal_error_with_message=Internal error: %s 
    10799DUnittestFinder_task_name=Finding unit tests 
  • trunk/descent.unittest/src/descent/internal/unittest/ui/TestRunnerViewPart.java

    r1115 r1169  
    1414package descent.internal.unittest.ui; 
    1515 
    16 import java.io.BufferedWriter; 
    17 import java.io.File; 
    18 import java.io.FileWriter; 
    19 import java.io.IOException; 
    2016import java.text.DateFormat; 
    21 import java.text.MessageFormat; 
    2217import java.text.NumberFormat; 
    2318import java.util.ArrayList; 
     
    2621import java.util.List; 
    2722 
    28 import org.eclipse.core.runtime.CoreException; 
    2923import org.eclipse.core.runtime.IProgressMonitor; 
    3024import org.eclipse.core.runtime.IStatus; 
     
    5953import org.eclipse.jface.action.MenuManager; 
    6054import org.eclipse.jface.action.Separator; 
    61 import org.eclipse.jface.dialogs.ErrorDialog; 
    6255import org.eclipse.jface.dialogs.MessageDialog; 
    6356import org.eclipse.jface.preference.IPreferenceStore; 
     
    8578import org.eclipse.debug.core.ILaunch; 
    8679import org.eclipse.debug.core.ILaunchConfiguration; 
    87 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 
    8880 
    8981import org.eclipse.debug.ui.DebugUITools; 
     
    10092import descent.internal.unittest.DescentUnittestPlugin; 
    10193import descent.internal.unittest.Messages; 
    102 import descent.internal.unittest.launcher.UnittestLaunchConfiguration; 
    10394import descent.internal.unittest.model.ITestRunSessionListener; 
    10495import descent.internal.unittest.model.ITestSessionListener; 
    10596import descent.internal.unittest.model.TestCaseElement; 
    10697import descent.internal.unittest.model.TestElement; 
    107 import descent.internal.unittest.model.TestRoot; 
    10898import descent.internal.unittest.model.TestRunSession; 
    109 import descent.internal.unittest.model.TestSuiteElement; 
    11099import descent.unittest.ITestResult; 
    111100import descent.unittest.ITestResult.ResultType; 
     
    168157     
    169158    private Action fRerunLastTestAction; 
    170     private Action fRerunLastFailedFirstAction; 
    171159     
    172160    private Action fFailuresOnlyFilterAction; 
     
    417405                        return;  
    418406                    fStopAction.setEnabled(lastLaunchIsKeptAlive()); 
    419                     updateRerunFailedFirstAction(); 
    420407                    processChangesInUI(); 
    421408                    if (hasErrorsOrFailures()) { 
     
    587574        public void run(){ 
    588575            rerunTestRun(); 
    589         } 
    590     } 
    591      
    592     private class RerunLastFailedFirstAction extends Action { 
    593         public RerunLastFailedFirstAction() { 
    594             setText(JUnitMessages.TestRunnerViewPart_rerunfailuresaction_label);   
    595             setToolTipText(JUnitMessages.TestRunnerViewPart_rerunfailuresaction_tooltip);   
    596             DescentUnittestPlugin.setLocalImageDescriptors(this, "relaunchf.gif"); //$NON-NLS-1$ 
    597             setEnabled(false); 
    598         } 
    599          
    600         public void run(){ 
    601             rerunTestFailedFirst(); 
    602576        } 
    603577    } 
     
    862836        } 
    863837        if (fTestRunSession != null && fTestRunSession.getLaunch().getLaunchConfiguration() != null) { 
    864             ILaunchConfiguration configuration= prepareLaunchConfigForRelaunch(fTestRunSession.getLaunch().getLaunchConfiguration()); 
     838            ILaunchConfiguration configuration= fTestRunSession.getLaunch().getLaunchConfiguration(); 
    865839            DebugUITools.launch(configuration, fTestRunSession.getLaunch().getLaunchMode()); 
    866         } 
    867     } 
    868  
    869     private ILaunchConfiguration prepareLaunchConfigForRelaunch(ILaunchConfiguration configuration) { 
    870         try { 
    871             String attribute= configuration.getAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, ""); //$NON-NLS-1$ 
    872             if (attribute.length() != 0) { 
    873                 String configName= Messages.format(JUnitMessages.TestRunnerViewPart_configName, configuration.getName());  
    874                 ILaunchConfigurationWorkingCopy tmp= configuration.copy(configName);  
    875                 tmp.setAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, ""); //$NON-NLS-1$ 
    876                 return tmp; 
    877             } 
    878         } catch (CoreException e) { 
    879             // fall through 
    880         } 
    881         return configuration; 
    882     } 
    883  
    884     public void rerunTestFailedFirst() { 
    885         if (lastLaunchIsKeptAlive()) { 
    886             // prompt for terminating the existing run 
    887             if (MessageDialog.openQuestion(getSite().getShell(), JUnitMessages.TestRunnerViewPart_terminate_title, JUnitMessages.TestRunnerViewPart_terminate_message)) {   
    888                 if (fTestRunSession != null) 
    889                     fTestRunSession.stopTestRun(); 
    890             } 
    891         } 
    892         if (fTestRunSession.getLaunch() != null && fTestRunSession.getLaunch().getLaunchConfiguration() != null) { 
    893                 ILaunchConfiguration launchConfiguration= fTestRunSession.getLaunch().getLaunchConfiguration(); 
    894                 if (launchConfiguration != null) { 
    895                     try { 
    896                         String oldName= launchConfiguration.getName();  
    897                         String oldFailuresFilename= launchConfiguration.getAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, (String) null); 
    898                         String configName; 
    899                         if (oldFailuresFilename != null) { 
    900                             configName= oldName; 
    901                         } else { 
    902                             configName= Messages.format(JUnitMessages.TestRunnerViewPart_rerunFailedFirstLaunchConfigName, oldName);  
    903                         } 
    904                         ILaunchConfigurationWorkingCopy tmp= launchConfiguration.copy(configName);  
    905                         tmp.setAttribute(UnittestLaunchConfiguration.FAILURES_FILENAME_ATTR, createFailureNamesFile()); 
    906                         tmp.launch(fTestRunSession.getLaunch().getLaunchMode(), null);   
    907                         return;  
    908                     } catch (CoreException e) { 
    909                         ErrorDialog.openError(getSite().getShell(),  
    910                             JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus()  
    911                         ); 
    912                     } 
    913                 } 
    914                 MessageDialog.openInformation(getSite().getShell(),  
    915                     JUnitMessages.TestRunnerViewPart_cannotrerun_title,   
    916                     JUnitMessages.TestRunnerViewPart_cannotrerurn_message 
    917                 );  
    918         } 
    919     }    
    920  
    921     private String createFailureNamesFile() throws CoreException { 
    922         try { 
    923             File file= File.createTempFile("testFailures", ".txt"); //$NON-NLS-1$ //$NON-NLS-2$ 
    924             file.deleteOnExit(); 
    925             TestElement[] failures= fTestRunSession.getAllFailedTestElements(); 
    926             BufferedWriter bw= null; 
    927             try { 
    928                 bw= new BufferedWriter(new FileWriter(file)); 
    929                 for (int i= 0; i < failures.length; i++) { 
    930                     TestElement testElement= failures[i]; 
    931                     bw.write(testElement.getName()); 
    932                     bw.newLine(); 
    933                 } 
    934             } finally { 
    935                 if (bw != null) { 
    936                     bw.close(); 
    937                 } 
    938             } 
    939             return file.getAbsolutePath(); 
    940         } catch (IOException e) { 
    941             throw new CoreException(new Status(IStatus.ERROR, DescentUnittestPlugin.PLUGIN_ID, IStatus.ERROR, "", e)); //$NON-NLS-1$ 
    942840        } 
    943841    } 
     
    985883                resetViewIcon(); 
    986884                fStopAction.setEnabled(false); 
    987                 updateRerunFailedFirstAction(); 
    988885            } 
    989886        });  
     
    1070967             
    1071968            fStopAction.setEnabled(false); 
    1072             fRerunLastFailedFirstAction.setEnabled(false); 
    1073969            fRerunLastTestAction.setEnabled(false); 
    1074970             
     
    1084980            registerInfoMessage(fTestRunSession.getTestRunName()); 
    1085981             
    1086             updateRerunFailedFirstAction(); 
    1087982            fRerunLastTestAction.setEnabled(true); 
    1088983             
     
    1098993            } 
    1099994        } 
    1100     } 
    1101  
    1102     private void updateRerunFailedFirstAction() { 
    1103         fRerunLastFailedFirstAction.setEnabled(hasErrorsOrFailures()); 
    1104995    } 
    1105996     
     
    13621253         
    13631254        fRerunLastTestAction= new RerunLastAction(); 
    1364         fRerunLastFailedFirstAction= new RerunLastFailedFirstAction(); 
    13651255         
    13661256        fFailuresOnlyFilterAction= new FailuresOnlyFilterAction(); 
     
    13831273        toolBar.add(new Separator()); 
    13841274        toolBar.add(fRerunLastTestAction); 
    1385         toolBar.add(fRerunLastFailedFirstAction); 
    13861275        toolBar.add(fStopAction); 
    13871276        toolBar.add(fViewHistory.createHistoryDropDownAction()); 
     
    15211410    public boolean isCreated() { 
    15221411        return fCounterPanel != null; 
    1523     } 
    1524  
    1525     public void rerunTest(String testId, String launchMode) { 
    1526         DebugUITools.saveAndBuildBeforeLaunch(); 
    1527         try { 
    1528             boolean couldLaunch= fTestRunSession.rerunTest(testId, launchMode); 
    1529             if (! couldLaunch) { 
    1530                 MessageDialog.openInformation(getSite().getShell(), 
    1531                         JUnitMessages.TestRunnerViewPart_cannotrerun_title, 
    1532                         JUnitMessages.TestRunnerViewPart_cannotrerurn_message); 
    1533             } else if (fTestRunSession.isKeptAlive()) { 
    1534                 TestCaseElement testCaseElement= (TestCaseElement) fTestRunSession.getTestElement(testId); 
    1535                 testCaseElement.setStatus(TestElement.Status.RUNNING); 
    1536                 fTestViewer.registerViewerUpdate(testCaseElement); 
    1537                 postSyncProcessChanges(); 
    1538             } 
    1539  
    1540         } catch (CoreException e) { 
    1541             ErrorDialog.openError(getSite().getShell(),  
    1542                 JUnitMessages.TestRunnerViewPart_error_cannotrerun, e.getMessage(), e.getStatus()  
    1543             ); 
    1544         } 
    15451412    } 
    15461413 
  • trunk/descent.unittest/src/descent/internal/unittest/ui/TestViewer.java

    r1052 r1169  
    215215                manager.add(new OpenModuleAction(fTestRunnerPart, testElement.getId())); 
    216216                manager.add(new Separator()); 
    217                 if (!fTestRunnerPart.lastLaunchIsKeptAlive()) { 
    218                     manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.RUN_MODE)); 
    219                     manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.DEBUG_MODE)); 
    220                 } 
    221217            } else { 
    222218                TestCaseElement testCaseElement= (TestCaseElement) testElement; 
     
    224220                        testCaseElement.getTestSpecification().getDeclaration())); 
    225221                manager.add(new Separator()); 
    226                 if (fTestRunnerPart.lastLaunchIsKeptAlive()) { 
    227                     manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.RUN_MODE)); 
    228                      
    229                 } else { 
    230                     manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.RUN_MODE)); 
    231                     manager.add(new RerunAction(fTestRunnerPart, testElement.getId(), ILaunchManager.DEBUG_MODE)); 
    232                 }  
    233222            } 
    234223            if (fLayoutMode == TestRunnerViewPart.LAYOUT_HIERARCHICAL) { 
  • trunk/descent.unittest/testdata/src/compile.bat

    r1162 r1169  
    1 dmd -g -unittest -of..\bin\test sample\module1.d sample\foo\module3.d sample\foo\bar\module2.d ..\..\flute\src\cn\kuehne\flectioned.d ..\..\flute\src\org\dsource\descent\flute\flute.d ..\..\flute\src\org\dsource\descent\flute\io.d -IC:\dmd\src\phobos C:\d\dmd\lib\WS2_32.lib 
     1dmd -g -w -unittest -of..\bin\test sample\module1.d sample\foo\module3.d sample\foo\bar\module2.d ..\..\flute\src\cn\kuehne\flectioned.d ..\..\flute\src\org\dsource\descent\flute\flute.d ..\..\flute\src\org\dsource\descent\flute\io.d -IC:\dmd\src\phobos C:\d\dmd\lib\WS2_32.lib 
  • trunk/descent.unittest/testdata/src/sample/module1.d

    r1162 r1169  
    11module sample.module1; 
    2  
    3 import std.socket : SocketException; 
    4 import std.thread : Thread; 
    52 
    63class ArgumentException : Exception 
     
    3128         
    3229        // To test stack tracing 
    33         throw new SocketException("YA RLY!", 69); 
     30        throw new Exception("YA RLY!"); 
    3431    } 
    3532     
     
    7572     
    7673     
    77     throw new ArgumentException("NO WAI!"); 
     74    throw new Exception("NO WAI!"); 
    7875} 
    7976