Hi Maxime,
Can you run package-and-check ? This will tell you that there are tab
characters that make test fail.
Also can you close the related PR ?
We usually add in commit comments this to automatically close PR:

   - This closes PR #ID_OF_PR

Regards

Philippe

On Thu, Feb 16, 2017 at 10:23 PM, <mchassagn...@apache.org> wrote:

> Author: mchassagneux
> Date: Thu Feb 16 21:23:03 2017
> New Revision: 1783297
>
> URL: http://svn.apache.org/viewvc?rev=1783297&view=rev
> Log:
> Checks for listener output file existence
> Bugzilla Id: 58164
>
> Modified:
>     jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
>     jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java
>     jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java
>     jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java
>     jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
>     jmeter/trunk/src/core/org/apache/jmeter/resources/
> messages_fr.properties
>     jmeter/trunk/xdocs/changes.xml
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
> apache/jmeter/JMeter.java?rev=1783297&r1=1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Thu Feb 16
> 21:23:03 2017
> @@ -35,6 +35,7 @@ import java.text.SimpleDateFormat;
>  import java.util.Collection;
>  import java.util.Date;
>  import java.util.Enumeration;
> +import java.util.Iterator;
>  import java.util.LinkedList;
>  import java.util.List;
>  import java.util.Locale;
> @@ -151,6 +152,7 @@ public class JMeter implements JMeterPlu
>      private static final int REPORT_GENERATING_OPT  = 'g';// $NON-NLS-1$
>      private static final int REPORT_AT_END_OPT      = 'e';// $NON-NLS-1$
>      private static final int REPORT_OUTPUT_FOLDER_OPT      = 'o';//
> $NON-NLS-1$
> +    private static final int FORCE_DELETE_RESULT_FILE      = 'f';//
> $NON-NLS-1$
>
>      private static final int SYSTEM_PROPERTY    = 'D';// $NON-NLS-1$
>      private static final int JMETER_GLOBAL_PROP = 'G';// $NON-NLS-1$
> @@ -271,7 +273,11 @@ public class JMeter implements JMeterPlu
>      private static final CLOptionDescriptor D_REPORT_OUTPUT_FOLDER_OPT =
>              new CLOptionDescriptor("reportoutputfolder",
>                      CLOptionDescriptor.ARGUMENT_REQUIRED,
> REPORT_OUTPUT_FOLDER_OPT,
> -                    "output folder for report dashboard");
> +                       "output folder for report dashboard");
> +     private static final CLOptionDescriptor D_FORCE_DELETE_RESULT_FILE =
> +            new CLOptionDescriptor("forceDeleteResultFile",
> +                    CLOptionDescriptor.ARGUMENT_DISALLOWED,
> FORCE_DELETE_RESULT_FILE,
> +                    "force delete existing results files before start the
> test");
>
>      private static final String[][] DEFAULT_ICONS = {
>              { "org.apache.jmeter.control.gui.TestPlanGui",
>  "org/apache/jmeter/images/beaker.gif" },     //$NON-NLS-1$ $NON-NLS-2$
> @@ -308,6 +314,7 @@ public class JMeter implements JMeterPlu
>              D_JMETER_GLOBAL_PROP,
>              D_SYSTEM_PROPERTY,
>              D_SYSTEM_PROPFILE,
> +            D_FORCE_DELETE_RESULT_FILE,
>              D_LOGLEVEL,
>              D_REMOTE_OPT,
>              D_REMOTE_OPT_PARAM,
> @@ -324,6 +331,9 @@ public class JMeter implements JMeterPlu
>      /** should remote engines be stopped at end of non-GUI test? */
>      private boolean remoteStop;
>
> +    /** should delete result file before start ? */
> +    private boolean deleteResultFile = false;
> +
>      public JMeter() {
>          super();
>      }
> @@ -843,6 +853,9 @@ public class JMeter implements JMeterPlu
>              case REMOTE_STOP:
>                  remoteStop = true;
>                  break;
> +            case FORCE_DELETE_RESULT_FILE:
> +               deleteResultFile = true;
> +               break;
>              default:
>                  // ignored
>                  break;
> @@ -878,6 +891,8 @@ public class JMeter implements JMeterPlu
>          JMeter driver = new JMeter();// TODO - why does it create a new
> instance?
>          driver.remoteProps = this.remoteProps;
>          driver.remoteStop = this.remoteStop;
> +        driver.deleteResultFile = this.deleteResultFile;
> +
>          PluginManager.install(this, false);
>
>          String remoteHostsString = null;
> @@ -924,6 +939,19 @@ public class JMeter implements JMeterPlu
>              // Remove the disabled items
>              // For GUI runs this is done in Start.java
>              convertSubTree(tree);
> +
> +            if (deleteResultFile) {
> +               SearchByClass<ResultCollector> resultListeners = new
> SearchByClass<>(ResultCollector.class);
> +               tree.traverse(resultListeners);
> +               Iterator<ResultCollector> irc = resultListeners.
> getSearchResults().iterator();
> +               while (irc.hasNext()) {
> +                       ResultCollector rc = irc.next();
> +                       File resultFile = new File(rc.getFilename());
> +                       if (resultFile.exists()) {
> +                               resultFile.delete();
> +                       }
> +               }
> +            }
>
>              Summariser summer = null;
>              String summariserName = JMeterUtils.getPropDefault("su
> mmariser.name", "");//$NON-NLS-1$
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/
> AbstractAction.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
> apache/jmeter/gui/action/AbstractAction.java?rev=
> 1783297&r1=1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java
> (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/AbstractAction.java
> Thu Feb 16 21:23:03 2017
> @@ -19,13 +19,19 @@
>  package org.apache.jmeter.gui.action;
>
>  import java.awt.event.ActionEvent;
> +import java.io.File;
> +import java.text.MessageFormat;
> +import java.util.Iterator;
>  import java.util.Set;
>
>  import javax.swing.JOptionPane;
>
>  import org.apache.jmeter.exceptions.IllegalUserActionException;
>  import org.apache.jmeter.gui.GuiPackage;
> +import org.apache.jmeter.reporters.ResultCollector;
>  import org.apache.jmeter.util.JMeterUtils;
> +import org.apache.jorphan.collections.HashTree;
> +import org.apache.jorphan.collections.SearchByClass;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
>
> @@ -60,4 +66,43 @@ public abstract class AbstractAction imp
>              }
>          }
>      }
> +
> +    /**
> +     * @param tree where check if listener has existing file
> +     */
> +    protected boolean popupCheckExistingFileListener(HashTree tree) {
> +
> +        SearchByClass<ResultCollector> resultListeners = new
> SearchByClass<>(ResultCollector.class);
> +        tree.traverse(resultListeners);
> +        Iterator<ResultCollector> irc = resultListeners.
> getSearchResults().iterator();
> +        while (irc.hasNext()) {
> +            ResultCollector rc = irc.next();
> +            File f = new File(rc.getFilename());
> +            if (f.exists()) {
> +                String[] option = new String[] {
> JMeterUtils.getResString("concat_result"),
> +                        JMeterUtils.getResString("dont_start"),
> JMeterUtils.getResString("replace_file") };
> +                String question = MessageFormat.format(
> JMeterUtils.getResString("ask_existing_file") // $NON-NLS-1$
> +                        , rc.getFilename());
> +                int response = JOptionPane.YES_OPTION;
> +
> +                // Interactive question
> +                response = JOptionPane.showOptionDialog(null, question,
> JMeterUtils.getResString("warning"),
> +                        JOptionPane.YES_NO_CANCEL_OPTION,
> JOptionPane.WARNING_MESSAGE, null, option, option[0]);
> +
> +                switch (response) {
> +                case JOptionPane.NO_OPTION:
> +                    // Exit without start the test
> +                    return false;
> +                case JOptionPane.CANCEL_OPTION:
> +                    // replace_file so delete the existing one
> +                    f.delete();
> +                    break;
> +                case JOptionPane.YES_OPTION:
> +                    // append is the default behaviour, so nothing to do
> +                    break;
> +                }
> +            }
> +        }
> +        return true;
> +    }
>  }
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/
> RemoteStart.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
> apache/jmeter/gui/action/RemoteStart.java?rev=1783297&
> r1=1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java
> (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/RemoteStart.java
> Thu Feb 16 21:23:03 2017
> @@ -74,12 +74,18 @@ public class RemoteStart extends Abstrac
>              distributedRunner.shutdown(Arrays.asList(name));
>          } else if (action.equals(ActionNames.REMOTE_START)) {
>              popupShouldSave(e);
> -            distributedRunner.init(Arrays.asList(name), getTestTree());
> -            distributedRunner.start(Arrays.asList(name));
> +            HashTree testTree = getTestTree();
> +            if ( popupCheckExistingFileListener(testTree) ) {
> +               distributedRunner.init(Arrays.asList(name), testTree);
> +               distributedRunner.start(Arrays.asList(name));
> +            }
>          } else if (action.equals(ActionNames.REMOTE_START_ALL)) {
>              popupShouldSave(e);
> -            distributedRunner.init(getRemoteHosts(), getTestTree());
> -            distributedRunner.start();
> +            HashTree testTree = getTestTree();
> +            if ( popupCheckExistingFileListener(testTree) ) {
> +               distributedRunner.init(getRemoteHosts(), testTree);
> +               distributedRunner.start();
> +            }
>          } else if (action.equals(ActionNames.REMOTE_STOP_ALL)) {
>              distributedRunner.stop(getRemoteHosts());
>          } else if (action.equals(ActionNames.REMOTE_SHUT_ALL)) {
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
> apache/jmeter/gui/action/Start.java?rev=1783297&r1=
> 1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java
> (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Start.java Thu Feb
> 16 21:23:03 2017
> @@ -205,17 +205,19 @@ public class Start extends AbstractActio
>              TreeCloner cloner = cloneTree(testTree, ignoreTimer);
>              clonedTree = cloner.getClonedTree();
>          }
> -        engine = new StandardJMeterEngine();
> -        engine.configure(clonedTree);
> -        try {
> -            engine.runTest();
> -        } catch (JMeterEngineException e) {
> -            JOptionPane.showMessageDialog(gui.getMainFrame(),
> e.getMessage(),
> -                    JMeterUtils.getResString("error_occurred"),
> JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
> -        }
> -        if (log.isDebugEnabled()) {
> -            log.debug("test plan after cloning and running test is
> running version: {}",
> -                    ((TestPlan) testTree.getArray()[0]).
> isRunningVersion());
> +        if ( popupCheckExistingFileListener(testTree) ) {
> +               engine = new StandardJMeterEngine();
> +               engine.configure(clonedTree);
> +               try {
> +                   engine.runTest();
> +               } catch (JMeterEngineException e) {
> +                   JOptionPane.showMessageDialog(gui.getMainFrame(),
> e.getMessage(),
> +                           JMeterUtils.getResString("error_occurred"),
> JOptionPane.ERROR_MESSAGE); //$NON-NLS-1$
> +               }
> +               if (log.isDebugEnabled()) {
> +                   log.debug("test plan after cloning and running test is
> running version: {}",
> +                           ((TestPlan) testTree.getArray()[0]).
> isRunningVersion());
> +               }
>          }
>      }
>
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/
> messages.properties
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
> apache/jmeter/resources/messages.properties?rev=
> 1783297&r1=1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
> (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
> Thu Feb 16 21:23:03 2017
> @@ -104,6 +104,7 @@ appearance=Look and Feel
>  apply_naming=Apply Naming Policy
>  argument_must_not_be_negative=The Argument must not be negative\!
>  arguments_panel_title=Command parameters
> +ask_existing_file=The file {0} already exist, what you want to do?
>  assertion_assume_success=Ignore Status
>  assertion_body_resp=Response Body
>  assertion_code_resp=Response Code
> @@ -197,6 +198,7 @@ comparison_regex_substitution=Substituti
>  comparison_response_time=Response Time:
>  comparison_unit=\ ms
>  comparison_visualizer_title=Comparison Assertion Visualizer
> +concat_result=Append result to the existing files
>  config_element=Config Element
>  config_save_settings=Configure
>  confirm=Confirm
> @@ -266,6 +268,7 @@ dns_hosts=Static Hosttable
>  dns_servers=DNS Servers
>  domain=Domain
>  done=Done
> +dont_start=Don't start
>  down=Down
>  duplicate=Duplicate
>  duration=Duration (seconds)
> @@ -819,6 +822,7 @@ remove=Remove
>  remove_confirm_msg=Are you sure you want remove the selected element(s)?
>  remove_confirm_title=Confirm remove?
>  rename=Rename entry
> +replace_file=Replace existing file
>  report=Report
>  report_bar_chart=Bar Chart
>  report_bar_graph_url=URL
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/
> messages_fr.properties
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/
> apache/jmeter/resources/messages_fr.properties?rev=
> 1783297&r1=1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
> (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
> Thu Feb 16 21:23:03 2017
> @@ -99,6 +99,7 @@ appearance=Apparence
>  apply_naming=Appliquer Convention Nommage
>  argument_must_not_be_negative=L'argument ne peut pas \u00EAtre
> n\u00E9gatif \!
>  arguments_panel_title=Param\u00E8tres de commande
> +ask_existing_file=Le fichier {0} existe d\u00E9j\u00e0, que voulez-vous
> faire?
>  assertion_assume_success=Ignorer le statut
>  assertion_body_resp=Corps de r\u00E9ponse
>  assertion_code_resp=Code de r\u00E9ponse
> @@ -192,6 +193,7 @@ comparison_regex_substitution=Substituti
>  comparison_response_time=Temps de r\u00E9ponse \:
>  comparison_unit=ms
>  comparison_visualizer_title=R\u00E9cepteur d'assertions de comparaison
> +concat_result=Ajouter les r\u00E9sultats au fichier existant
>  config_element=El\u00E9ment de configuration
>  config_save_settings=Configurer
>  confirm=Confirmer
> @@ -261,6 +263,7 @@ dns_hosts=Table d''h\u00F4te statique
>  dns_servers=Serveurs DNS
>  domain=Domaine \:
>  done=Fait
> +dont_start=Ne pas ex\u00E9cuter le test
>  down=Descendre
>  duplicate=Dupliquer
>  duration=Dur\u00E9e (secondes) \:
> @@ -809,6 +812,7 @@ remove=Supprimer
>  remove_confirm_msg=Etes-vous s\u00FBr de vouloir supprimer ce(s)
> \u00E9l\u00E9ment(s) ?
>  remove_confirm_title=Confirmer la suppression ?
>  rename=Renommer une entr\u00E9e
> +replace_file=Remplacer le fichier existant
>  report=Rapport
>  report_bar_chart=Graphique \u221A\u2020 barres
>  report_bar_graph_url=URL
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.
> xml?rev=1783297&r1=1783296&r2=1783297&view=diff
> ============================================================
> ==================
> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Feb 16 21:23:03 2017
> @@ -188,6 +188,7 @@ JMeter now requires Java 8. Ensure you u
>
>  <h3>General</h3>
>  <ul>
> +       <li><bug>58164</bug>Check if output file exist on all listener
> before start the loadtest</li>
>      <li><bug>54525</bug>Search Feature : Enhance it with ability to
> replace</li>
>      <li><bug>60530</bug>Add API to create JMeter threads while test is
> running. Based on a contribution by Logan Mauzaize (logan.mauzaize at
> gmail.com) and Maxime Chassagneux (maxime.chassagneux at gmail.com).</li>
>      <li><bug>60514</bug>Ability to apply a naming convention on Children
> of a Transaction Controller. Contributed by Ubik Load Pack (support at
> ubikloadpack.com)</li>
>
>
>


-- 
Cordialement.
Philippe Mouawad.

Reply via email to