mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 11:08:45 +03:00
Add test for when a live and a once build refer to the same schematic.
This commit is contained in:
parent
f32a78f6e6
commit
b6f546da84
@ -20,6 +20,7 @@
|
||||
test-scry-clay-live
|
||||
test-pinned-in-live
|
||||
test-live-build-that-blocks
|
||||
test-live-and-once
|
||||
==
|
||||
++ test-is-schematic-live
|
||||
~& %test-is-schematic-live
|
||||
@ -453,6 +454,80 @@
|
||||
(my [~nul *ford-state:ford-turbo]~)
|
||||
==
|
||||
::
|
||||
++ test-live-and-once
|
||||
~& %test-live-and-once
|
||||
::
|
||||
=/ scry-blocked (scry-block ~1234.5.6)
|
||||
=/ scry-42 (scry-succeed ~1234.5.6 [%noun !>(42)])
|
||||
::
|
||||
::
|
||||
=/ ford (ford-turbo now=~1234.5.6 eny=0xdead.beef scry=scry-blocked)
|
||||
::
|
||||
=^ moves ford
|
||||
%- call:ford
|
||||
:* duct=~[/live] type=~ %make ~nul
|
||||
[%scry %c care=%x rail=[[~nul %desk] /bar/foo]]
|
||||
==
|
||||
;: welp
|
||||
%- expect-eq !>
|
||||
:- moves
|
||||
:~ :* duct=~ %pass
|
||||
wire=/~nul/dependency/c/x/~nul/desk/0/foo/bar
|
||||
%c %warp [~nul ~nul] %desk
|
||||
~ %sing %x [%da ~1234.5.6] /bar/foo
|
||||
==
|
||||
::
|
||||
:* duct=~ %pass wire=/~nul/clay-sub/~nul/desk
|
||||
%c %warp [~nul ~nul] %desk
|
||||
`[%mult [%da ~1234.5.6] (sy [%x /foo/bar]~)]
|
||||
== ==
|
||||
::
|
||||
=. ford (ford now=~1234.5.7 eny=0xbeef.dead scry=scry-blocked)
|
||||
=^ moves ford
|
||||
%- call:ford
|
||||
:* duct=~[/once] type=~ %make ~nul
|
||||
[%pin ~1234.5.6 [%scry %c ren=%x rail=[[~nul %desk] /bar/foo]]]
|
||||
==
|
||||
%+ welp
|
||||
%- expect-eq !>
|
||||
[moves ~]
|
||||
::
|
||||
=. ford (ford now=~1234.5.8 eny=0xbeef.dead scry=scry-is-forbidden)
|
||||
=^ moves2 ford
|
||||
%- take:ford
|
||||
:* wire=/~nul/dependency/c/x/~nul/desk/0/foo/bar duct=~
|
||||
^= wrapped-sign ^- (hypo sign:ford) :- *type :: ^- sign:ford
|
||||
[%c %writ ~ [%x [%da ~1234.5.6] %desk] /bar/foo %noun !>(42)]
|
||||
==
|
||||
::
|
||||
%+ welp
|
||||
%- expect-eq !>
|
||||
:- moves2
|
||||
:~ :* duct=~[/live] %give %made ~1234.5.6 %complete
|
||||
[%result [%scry %noun !>(42)]]
|
||||
==
|
||||
:* duct=~[/once] %give %made ~1234.5.6 %complete
|
||||
[%result [%pin ~1234.5.6 %result [%scry %noun !>(42)]]]
|
||||
== ==
|
||||
::
|
||||
=. ford (ford now=~1234.5.9 eny=0xbeef.dead scry=scry-is-forbidden)
|
||||
=^ moves4 ford
|
||||
(call:ford [duct=~[/live] type=~ %kill ~nul])
|
||||
::
|
||||
%+ welp
|
||||
%- expect-eq !>
|
||||
:- moves4
|
||||
:~ :* duct=~ %pass wire=/~nul/clay-sub/~nul/desk
|
||||
%c %warp [~nul ~nul] %desk ~
|
||||
== ==
|
||||
::
|
||||
%- expect-eq !>
|
||||
:- state-by-ship.+>+<.ford
|
||||
(my [~nul *ford-state:ford-turbo]~)
|
||||
::
|
||||
~
|
||||
==
|
||||
::
|
||||
:: |utilities: helper arms
|
||||
::
|
||||
::+| utilities
|
||||
|
@ -1292,8 +1292,6 @@
|
||||
=? date.build ?=(%pin -.schematic.build) date.schematic.build
|
||||
:: if the build is complete and not a %tombstone, we're done
|
||||
::
|
||||
:: TODO send %mades on future builds when this build completes.
|
||||
::
|
||||
=^ maybe-cache-line results.state (access-cache build)
|
||||
:: copy all the ducts from :from to this one
|
||||
::
|
||||
@ -1399,7 +1397,14 @@
|
||||
::
|
||||
|- ^+ this
|
||||
?~ clients this
|
||||
$(clients t.clients, ..execute (execute i.clients from=`build))
|
||||
:: don't copy listeners upward
|
||||
::
|
||||
:: We need to copy listeners downward so that sub-builds inherit
|
||||
:: listeners from the root. We don't want to copy listeners upward
|
||||
:: because then all roots would get listeners copied to each
|
||||
:: other.
|
||||
::
|
||||
$(clients t.clients, ..execute (execute i.clients from=~))
|
||||
::
|
||||
|- ^+ this
|
||||
=/ next (~(find-next by-schematic builds-by-schematic.state) build)
|
||||
@ -1715,9 +1720,15 @@
|
||||
:: which build to rerun in a later event when we +unblock
|
||||
:: on that +dependency.
|
||||
::
|
||||
=/ already-blocked=? (~(has by blocks.state) dependency)
|
||||
:: store :dependency in persistent state
|
||||
::
|
||||
=. blocks.state (~(put ju blocks.state) dependency build)
|
||||
::
|
||||
?: already-blocked
|
||||
:: this dependency was already blocked
|
||||
::
|
||||
[[%blocks ~] this]
|
||||
:: construct new :move to request blocked resource
|
||||
::
|
||||
=/ wire=wire (welp /(scot %p our)/dependency (to-wire dependency))
|
||||
|
Loading…
Reference in New Issue
Block a user