 I think a quick fix would be to add another button to context menu called CleanRunExecute! that does exactly what the test control panel button does and leave ReRun alone; if you dont trust one, or want more speed; choose your own fortune :)

Observations follow:


when i select test->rerun from right click menu in run tab of dashboard, the test doesnt seem to get cleaned before rerun
i
just noticed that in my crf build.. rerunning didnt clear steps... just ran them again... which looks weird since steps were out of order in test control panel with some #unspecified states

  (iup:menu-item
    (conc "Rerun " item-test-path)
    #:action
    (lambda (obj)
      (common:run-a-command
       (conc "megatest -set-state-status NOT_STARTED,n/a -run -target " target
             " -runname " runname
             " -testpatt " item-test-path
             " -preclean -clean-cache"))))
No Title
 (iup:menu-item
    "Run"
    (iup:menu
     (iup:menu-item
      (conc "Rerun " testpatt)
      #:action
      (lambda (obj)
        ;; (print  " run-id: " run-id " test-id: " test-id " target: " target " runname: " runname " test-name: " test-name " testpatt: " testpatt "item-path : " item-path)
        (common:run-a-command
         (conc "megatest -run -target " target
               " -runname " runname
               " -testpatt " testpatt
               " -preclean -clean-cache")
         )))
     (iup:menu-item
      "Rerun Complete Run"
      #:action
      (lambda (obj)
        (common:run-a-command
         (conc "megatest -set-state-status NOT_STARTED,n/a -run -target " target
               " -runname " runname
               " -testpatt % "
               " -preclean -clean-cache"))))
all have -preclean

when I do clean-run-execute, it is explicitly cleared before retstarting... that is what guided my expectation

it definitely doesn't kill them... watching the dasboard, I see a running item go from running->launched immediately... with c-r-e, I see it blanking out first

    (clean-run-execute  (lambda (x)
                                     (let ((cmd (conc "megatest -remove-runs -target " keystring " -runname " runname
                                                      " -testpatt " (conc testname "/" (if (equal? item-path "")
                                                                                           "%"
                                                                                           item-path))
                                                      ";megatest -target " keystring " -runname " runname
                                                      " -run -preclean -testpatt " (conc testname "/" (if (equal? item-path "")
                                                                                           "%"
                                                                                           item-path))
                                                      " -clean-cache"
                                                      )))

cre does a remove-runs first... that is the difference i guess

 I think there might be some hazard. It ishard to prove... but I can get a test that passes consistently to fail if i rerun while running
.
 In this case, the running test is in the process of a fossil open
the respawned one dies with current directory is not within an open checkout


I