Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add simulate-until-command to support simultaneity tests #12

Open
karalekas opened this issue Jul 13, 2020 · 1 comment
Open

Add simulate-until-command to support simultaneity tests #12

karalekas opened this issue Jul 13, 2020 · 1 comment

Comments

@karalekas
Copy link
Member

For example, it would be great to test fully-rewinding multireweighting, but there's no way that case will be reached just by setting up a simple supervisor test. This is because a zero-weight edge will be seen earlier in the multireweighting process, causing it to abort. We would need to simulate until reaching MULTIREWEIGHT-BROADCAST-REWEIGHT, then reach in and modify the weight of a nearby node so that there is then a weightless edge between it and the HOLD cluster, and then simulate until dead. I think this feature will also allow us to write tests for SCANing -- we could inject the START-SCAN command and simulate until IDLE.

(defun simulate-until-command (simulation process command &key (start-time 0) timeout)
  "Runs `SIMULATION' until `PROCESS' reaches `COMMAND'."
  (loop :with stopping-time := start-time
        :with delta := (/ (anatevka::process-clock-rate process))
        :while (and (process-command-stack process)
                    (not (= command (anatevka::peek (process-command-stack process)))))
        :when
          (not (process-command-stack process))
          :do (error "SIMULATE-UNTIL-COMMAND supervisor died.")
        :when (and timeout (< timeout (- stopping-time start-time)))
          :do (error "SIMULATE-UNTIL-COMMAND hit a timeout.")
        :do (incf stopping-time delta)
            (simulation-run simulation :until stopping-time)
        :finally (return (values simulation stopping-time))))
@ecpeterson
Copy link
Contributor

Canaries now make this pretty easy. (What isn't trivial is writing the test!)

@ecpeterson ecpeterson transferred this issue from another repository Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants