shrub/pkg/arvo/app/test.hoon

155 lines
3.8 KiB
Plaintext
Raw Normal View History

2019-11-14 05:05:39 +03:00
/+ default-agent
2020-05-05 06:20:41 +03:00
!:
2019-11-14 05:05:39 +03:00
|%
2019-11-19 07:36:21 +03:00
+$ card card:agent:gall
2020-05-20 03:28:46 +03:00
+$ test ?(%agents %marks %generators)
2020-05-05 06:20:41 +03:00
+$ state
$: app=(set path)
app-ok=?
mar=(set path)
mar-ok=?
2020-05-20 03:28:46 +03:00
gen=(set path)
gen-ok=?
2019-11-14 05:05:39 +03:00
==
--
=, format
2019-11-19 07:36:21 +03:00
^- agent:gall
2020-05-05 06:20:41 +03:00
=| =state
2019-11-19 07:36:21 +03:00
|_ =bowl:gall
2019-11-14 05:05:39 +03:00
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init on-init:def
++ on-save on-save:def
++ on-load on-load:def
++ on-poke
|= [=mark =vase]
2020-05-05 06:20:41 +03:00
^- [(list card) _this]
2019-11-14 05:05:39 +03:00
|^
2020-05-05 06:20:41 +03:00
=+ !<(=test vase)
?- test
%marks test-marks
%agents test-agents
2020-05-20 03:28:46 +03:00
%generators test-generators
2019-11-14 05:05:39 +03:00
==
::
2020-05-05 06:20:41 +03:00
++ test-marks
=| fex=(list card)
^+ [fex this]
?> =(~ mar.state)
=. mar-ok.state %.y
=+ .^(paz=(list path) ct+(en-beam now-beak /mar))
|- ^+ [fex this]
?~ paz [(flop fex) this]
2020-05-05 06:20:41 +03:00
=/ xap=path (flop i.paz)
?. ?=([%hoon *] xap)
$(paz t.paz)
=/ mak=^mark
%- crip
%+ turn (tail (spud (tail (flop (tail xap)))))
|=(c=@tD `@tD`?:(=('/' c) '-' c))
=/ sing=card
:+ %pass /build/mar/[mak]
2021-11-10 12:04:17 +03:00
[%arvo %c %warp our.bowl q.byk.bowl ~ %sing %b da+now.bowl /[mak]]
2020-05-05 06:20:41 +03:00
%_ $
paz t.paz
fex [sing fex]
mar.state (~(put in mar.state) /mar/[mak])
==
2019-11-14 05:05:39 +03:00
::
2020-05-05 06:20:41 +03:00
++ test-agents
=| fex=(list card)
^+ [fex this]
?> =(~ app.state)
=. app-ok.state %.y
=+ .^(app-arch=arch cy+(en-beam now-beak /app))
=/ daz (sort ~(tap in ~(key by dir.app-arch)) |=((pair) !(aor p q)))
2020-05-05 06:20:41 +03:00
|- ^+ [fex this]
?~ daz [fex this]
=/ dap-pax=path /app/[i.daz]/hoon
=/ dap-arch .^(arch cy+(en-beam now-beak dap-pax))
2020-05-05 06:20:41 +03:00
?~ fil.dap-arch
$(daz t.daz)
=/ sing=card
:+ %pass /build/app/[i.daz]
2021-11-10 12:04:17 +03:00
[%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl dap-pax]
2020-05-05 06:20:41 +03:00
%_ $
daz t.daz
fex [sing fex]
app.state (~(put in app.state) /app/[i.daz])
2019-11-14 05:05:39 +03:00
==
2020-05-05 06:20:41 +03:00
::
2020-05-20 03:28:46 +03:00
++ test-generators
=| fex=(list card)
^+ [fex this]
?> =(~ gen.state)
=. gen-ok.state %.y
=+ .^(paz=(list path) ct+(en-beam now-beak /gen))
|- ^+ [fex this]
?~ paz [(flop fex) this]
2020-05-20 03:28:46 +03:00
=/ xap=path (flop i.paz)
?. ?=([%hoon *] xap)
$(paz t.paz)
=/ sing=card
:+ %pass build+i.paz
2021-11-10 12:04:17 +03:00
[%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl i.paz]
2020-05-20 03:28:46 +03:00
%_ $
paz t.paz
fex [sing fex]
gen.state (~(put in gen.state) i.paz)
==
::
2020-05-05 06:20:41 +03:00
++ now-beak %_(byk.bowl r [%da now.bowl])
2019-11-14 05:05:39 +03:00
--
++ on-watch on-watch:def
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent on-agent:def
++ on-arvo
2021-02-20 04:52:56 +03:00
=> |%
++ report
|* [=path ok=?]
=/ =tank leaf+"{?:(ok "built " "FAILED")} {(spud path)}"
~>(%slog.[0 tank] same)
--
::
2019-11-14 05:05:39 +03:00
|= [=wire =sign-arvo]
2020-05-05 06:20:41 +03:00
^- [(list card) _this]
2021-02-20 04:52:56 +03:00
?. ?& ?=([%build *] wire)
?=([%clay %writ *] sign-arvo)
==
2019-11-14 05:05:39 +03:00
(on-arvo:def wire sign-arvo)
2020-05-05 06:20:41 +03:00
=/ =path t.wire
?+ path ~|(path+path !!)
[%app *]
2020-05-20 03:28:46 +03:00
=/ ok
?~ p.sign-arvo |
(~(nest ut -:!>(*agent:gall)) | -:!<(vase q.r.u.p.sign-arvo))
2021-02-20 04:52:56 +03:00
%- (report path ok)
2020-05-05 06:20:41 +03:00
=? app-ok.state !ok %.n
=. app.state (~(del in app.state) path)
~? =(~ app.state)
2021-02-20 04:52:56 +03:00
?:(app-ok.state %all-agents-built %some-agents-failed)
2020-05-05 06:20:41 +03:00
[~ this]
2019-11-14 05:05:39 +03:00
::
2020-05-05 06:20:41 +03:00
[%mar *]
=/ ok ?=(^ p.sign-arvo)
2021-02-20 04:52:56 +03:00
%- (report path ok)
2020-05-05 06:20:41 +03:00
=? mar-ok.state !ok %.n
=. mar.state (~(del in mar.state) path)
~? =(~ mar.state)
2021-02-20 04:52:56 +03:00
?:(mar-ok.state %all-marks-built %some-marks-failed)
2020-05-05 06:20:41 +03:00
[~ this]
2020-05-20 03:28:46 +03:00
::
[%gen *]
=/ ok ?=(^ p.sign-arvo)
2021-02-20 04:52:56 +03:00
%- (report path ok)
2020-05-20 03:28:46 +03:00
=? gen-ok.state !ok %.n
=. gen.state (~(del in gen.state) path)
~? =(~ gen.state)
2021-02-20 04:52:56 +03:00
?:(gen-ok.state %all-generators-built %some-generators-failed)
2020-05-20 03:28:46 +03:00
[~ this]
2020-05-05 06:20:41 +03:00
==
2019-11-14 05:05:39 +03:00
++ on-fail on-fail:def
--