Liking cljdoc? Tell your friends :D

volley.shell.fs

File system and environment edge: globbing source files, reading them, resolving #include, and remembering namespace timings, run times and parsed namespace infos between runs. Everything here hands plain data to the pure core.

File system and environment edge: globbing source files, reading them,
resolving `#include`, and remembering namespace timings, run times and
parsed namespace infos between runs. Everything here
hands plain data to the pure core.
raw docstring

volley.shell.hooks

Kaocha hooks and :volley/worker-setup inside a worker: resolves the hooks named in the parent's {:op :configure} message and calls them at the points volley.hooks/semantics describes. The worker threads the value init returns through its loop; every function here takes it and returns the next one, so there is no state of its own.

Portable Clojure, like volley.shell.worker: it runs on babashka and on the JVM.

A hook is a qualified symbol, resolved with requiring-resolve in the worker, or a list form, evaluated there (Kaocha's load-hook). The calling conventions are Kaocha's: pre-load gets the config, post-load and pre-run the test plan, post-run the result, pre-load-test and post-load-test a testable and the config, pre-test and post-test a testable and the test plan, wrap-run the run function, pre-report the report event. Each hook's return value is passed to the next hook of the same key, as Kaocha does; what the last one returns is ignored except for pre-report (the event that gets counted), pre-test (a testable with :kaocha.testable/skip skips a var) and wrap-run (the wrapped run function). :volley/worker-setup fns take no arguments.

Kaocha hooks and `:volley/worker-setup` inside a worker: resolves the
hooks named in the parent's `{:op :configure}` message and calls them at
the points `volley.hooks/semantics` describes. The worker threads the
value `init` returns through its loop; every function here takes it and
returns the next one, so there is no state of its own.

Portable Clojure, like `volley.shell.worker`: it runs on babashka and on
the JVM.

A hook is a qualified symbol, resolved with `requiring-resolve` in the
worker, or a list form, evaluated there (Kaocha's `load-hook`). The
calling conventions are Kaocha's: `pre-load` gets the config, `post-load`
and `pre-run` the test plan, `post-run` the result, `pre-load-test` and
`post-load-test` a testable and the config, `pre-test` and `post-test` a
testable and the test plan, `wrap-run` the run function, `pre-report` the
report event. Each hook's return value is passed to the next hook of the
same key, as Kaocha does; what the last one returns is ignored except
for `pre-report` (the event that gets counted), `pre-test` (a testable
with `:kaocha.testable/skip` skips a var) and `wrap-run` (the wrapped
run function). `:volley/worker-setup` fns take no arguments.
raw docstring

volley.shell.in-process

A worker on a thread of the parent JVM instead of a process of its own, for runs that volley.runtime/worker-plan judges too short to pay for a second JVM. It runs the worker's own loop (volley.shell.worker/serve!) over in-memory streams: command lines come from the handle's :in writer, and protocol lines and stray output become events on the parent's queue exactly as volley.shell.pool makes them from a worker process's stdout and stderr.

While it runs, System/out and System/err point at its stray output and System/in at an empty stream, as a worker process sets them up. The parent prints through the root *out* and *err*, which hold the original streams, so its output is unaffected. The worker's thread binds *out*, *err* and t/*test-out* to its stray output instead, so println on a thread without those bindings goes to the terminal, as does whatever the thread writes to System/out after kill! (see In process in doc/design.md).

JVM only: volley.main loads it with requiring-resolve when a run is in process.

A worker on a thread of the parent JVM instead of a process of its own,
for runs that `volley.runtime/worker-plan` judges too short to pay for a
second JVM. It runs the worker's own loop (`volley.shell.worker/serve!`)
over in-memory streams: command lines come from the handle's `:in`
writer, and protocol lines and stray output become events on the
parent's queue exactly as `volley.shell.pool` makes them from a worker
process's stdout and stderr.

While it runs, `System/out` and `System/err` point at its stray output and
`System/in` at an empty stream, as a worker process sets them up. The
parent prints through the root `*out*` and `*err*`, which hold the
original streams, so its output is unaffected. The worker's thread
binds `*out*`, `*err*` and `t/*test-out*` to its stray output instead,
so `println` on a thread without those bindings goes to the terminal,
as does whatever the thread writes to `System/out` after `kill!` (see
In process in doc/design.md).

JVM only: `volley.main` loads it with `requiring-resolve` when a run is
in process.
raw docstring

volley.shell.jvm

JVM-only interop. Babashka ships neither java.lang.management nor Clojure's class loaders, so this namespace is loaded (through requiring-resolve) only when the parent runs on the JVM.

JVM-only interop. Babashka ships neither `java.lang.management` nor
Clojure's class loaders, so this namespace is loaded (through
`requiring-resolve`) only when the parent runs on the JVM.
raw docstring

volley.shell.pool

Worker processes. Starts them, feeds them assignments, and pumps what they print into ONE LinkedBlockingQueue the caller owns.

Everything put on the queue is a flat event map (see volley.protocol/->event): worker events with :worker and :at added, stray output as {:event :output :text ... :stream :stdout|:stderr}, and a final {:event :worker/exit :worker id :code n} once the process has exited and both streams hit EOF, or 500ms after the exit when something else (a process the test left running) still holds them open. The scheduler decides when to start and stop workers; this namespace has no policy of its own.

Worker processes. Starts them, feeds them assignments, and pumps what they
print into ONE `LinkedBlockingQueue` the caller owns.

Everything put on the queue is a flat event map (see `volley.protocol/->event`):
worker events with `:worker` and `:at` added, stray output as
`{:event :output :text ... :stream :stdout|:stderr}`, and a final
`{:event :worker/exit :worker id :code n}` once the process has exited
and both streams hit EOF, or 500ms after the exit when something else
(a process the test left running) still holds them open.
The scheduler decides when to start and stop workers; this namespace has
no policy of its own.
raw docstring

volley.shell.runtime

Worker launch: finds out what the parent runs on, builds the command line for bb or JVM workers, and computes (and caches) the classpath for --runtime jvm from a babashka parent. Shell only; the decisions are in volley.runtime.

Portable: it loads on babashka and on the JVM.

Worker launch: finds out what the parent runs on, builds the command
line for bb or JVM workers, and computes (and caches) the classpath for
`--runtime jvm` from a babashka parent. Shell only; the decisions are in
`volley.runtime`.

Portable: it loads on babashka and on the JVM.
raw docstring

volley.shell.terminal

The terminal edge: TTY detection, size, cursor control, in-place redraw and raw keyboard input. Decisions live in pure helpers here (frame-string, parse-stty-size, pick-width); the functions ending in ! only print or run stty.

The terminal edge: TTY detection, size, cursor control, in-place redraw
and raw keyboard input. Decisions live in pure helpers here (`frame-string`,
`parse-stty-size`, `pick-width`); the functions ending in `!` only print or
run `stty`.
raw docstring

volley.shell.watch

The watch-mode loop. Shell only: it polls modification times and the keyboard, feeds what it finds to the pure volley.watch state machine, and carries out the effects: build a plan, drive volley.engine for one run in fresh workers, cancel a run, print, show the prompt.

Both inputs sit beside the one event queue instead of in a second one: the queue holds only worker events, and the loop that reads it with a timeout also checks the keyboard and, every volley.watch/poll-ms, the files. The queue is the one mutable object; everything else is threaded through the loop as a value: the worker handles and the live frame height (:world, as volley.main threads them for a one-shot run) and the next worker id: ids keep counting up across runs, so a late event from a cancelled run's worker belongs to no worker of the next run, and the engine drops it.

env (from volley.main):

  • :ctx {:queue :command}
  • :run-effects! (fn [ctx world effects]) carries out engine effects, returns [world exit-code-or-nil]
  • :step! (fn [ctx world state input]) feeds the engine one input and carries out its effects, [world state code]
  • :print! (fn [{:lines :stream}])
  • :reload-config (fn []) returning {:config c} or {:error msg}
  • :worker-command (fn [config refresh?]) returning {:command argv} or {:error msg}, for a reloaded config; with refresh? the classpath is computed again
  • :add-hook-paths! (fn [config]) puts a reloaded config's test paths on the parent's classpath when its hooks run there
  • :ctx's :command is only the first run's worker command; the session keeps the current one
  • :config, :config-file, :cli-suites
  • :engine-opts options for volley.engine/init, without clock or timings
  • :keys? read the keyboard (stdin is a terminal)
  • :live? the live reporter is in use
The watch-mode loop. Shell only: it polls modification times and the
keyboard, feeds what it finds to the pure `volley.watch` state machine, and
carries out the effects: build a plan, drive `volley.engine` for one run in
fresh workers, cancel a run, print, show the prompt.

Both inputs sit beside the one event queue instead of in a second one: the
queue holds only worker events, and the loop that reads it with a timeout
also checks the keyboard and, every `volley.watch/poll-ms`, the files. The
queue is the one mutable object; everything else is threaded through the
loop as a value: the worker handles and the live frame height (`:world`,
as `volley.main` threads them for a one-shot run) and the next worker id:
ids keep counting up
across runs, so a late event from a cancelled run's worker belongs to no
worker of the next run, and the engine drops it.

`env` (from `volley.main`):
* `:ctx`            `{:queue :command}`
* `:run-effects!`   `(fn [ctx world effects])` carries out engine effects,
                    returns `[world exit-code-or-nil]`
* `:step!`          `(fn [ctx world state input])` feeds the engine one
                    input and carries out its effects, `[world state code]`
* `:print!`         `(fn [{:lines :stream}])`
* `:reload-config`  `(fn [])` returning `{:config c}` or `{:error msg}`
* `:worker-command` `(fn [config refresh?])` returning `{:command argv}`
                    or `{:error msg}`, for a reloaded config; with
                    `refresh?` the classpath is computed again
* `:add-hook-paths!` `(fn [config])` puts a reloaded config's test paths
                    on the parent's classpath when its hooks run there
* `:ctx`'s `:command` is only the first run's worker command; the session
  keeps the current one
* `:config`, `:config-file`, `:cli-suites`
* `:engine-opts`    options for `volley.engine/init`, without clock or timings
* `:keys?`          read the keyboard (stdin is a terminal)
* `:live?`          the live reporter is in use
raw docstring

volley.shell.worker

Worker process: reads assignments on stdin, runs test namespaces with clojure.test, writes protocol events on the original stdout.

Portable Clojure. It runs on babashka and on the JVM, so it uses no babashka.* namespaces.

The protocol channel is the process's original stdout. At startup -main points System/out and the root *out* at stderr, so anything a test prints, even through (.println System/out ...), arrives as stray output and can never interleave with a protocol line.

Worker process: reads assignments on stdin, runs test namespaces with
clojure.test, writes protocol events on the original stdout.

Portable Clojure. It runs on babashka and on the JVM, so it uses no
babashka.* namespaces.

The protocol channel is the process's original stdout. At startup `-main`
points `System/out` and the root `*out*` at stderr, so anything a test
prints, even through `(.println System/out ...)`, arrives as stray output
and can never interleave with a protocol line.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close