mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 21:12:56 +03:00
Merge branch 'next/kelvin/411' into pkova/mirger
This commit is contained in:
commit
0d9a0cdb6c
@ -3,7 +3,7 @@
|
|||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
tools = {
|
tools = {
|
||||||
flake = false;
|
flake = false;
|
||||||
url = "github:urbit/tools";
|
url = "github:urbit/tools/d454e2482c3d4820d37db6d5625a6d40db975864";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,17 +28,6 @@ let
|
|||||||
--
|
--
|
||||||
|
|
||||||
'';
|
'';
|
||||||
testThread = dojoCommand:
|
|
||||||
pkgs.writeTextFile {
|
|
||||||
name = "${dojoCommand}.hoon";
|
|
||||||
text = ''
|
|
||||||
${poke}
|
|
||||||
=/ m (strand ,vase)
|
|
||||||
;< [=ship =desk =case] bind:m get-beak
|
|
||||||
;< ok=? bind:m (poke [ship %dojo] %lens-command !>([%$ [%dojo '${dojoCommand}'] [%stdout ~]]))
|
|
||||||
(pure:m !>(ok))
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
appThread = generator: app:
|
appThread = generator: app:
|
||||||
pkgs.writeTextFile {
|
pkgs.writeTextFile {
|
||||||
name = ":${app}|${generator}.hoon";
|
name = ":${app}|${generator}.hoon";
|
||||||
@ -87,7 +76,7 @@ in pkgs.stdenvNoCC.mkDerivation {
|
|||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
${click} -k -p -i ${testThread "-test %/tests ~"} ./pier
|
${click} -c ./pier "[0 %fyrd [%base %test %noun %noun 0]]"
|
||||||
|
|
||||||
${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier
|
${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier
|
||||||
${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier
|
${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier
|
||||||
|
@ -7,52 +7,42 @@
|
|||||||
:: $test-arm: test with name (derived from its arm name in a test core)
|
:: $test-arm: test with name (derived from its arm name in a test core)
|
||||||
:: $test-func: single test, as gate; sample is entropy, produces failures
|
:: $test-func: single test, as gate; sample is entropy, produces failures
|
||||||
::
|
::
|
||||||
+$ test [=beam func=test-func]
|
+$ test [=path func=test-func]
|
||||||
+$ test-arm [name=term func=test-func]
|
+$ test-arm [name=term func=test-func]
|
||||||
+$ test-func (trap tang)
|
+$ test-func (trap tang)
|
||||||
+$ args quiet=?
|
|
||||||
--
|
--
|
||||||
=>
|
=>
|
||||||
|_ =args
|
|%
|
||||||
++ build-file
|
:: +run-test: execute an individual test
|
||||||
|= =beam
|
|
||||||
=/ m (strand ,[(unit vase) tang])
|
|
||||||
^- form:m
|
|
||||||
;< res=(unit vase) bind:m
|
|
||||||
(build-file:strandio beam)
|
|
||||||
%+ pure:m res
|
|
||||||
?. =(res ~)
|
|
||||||
~
|
|
||||||
~[leaf+"FAILED"]
|
|
||||||
:: +run-test: execute an individual test
|
|
||||||
::
|
::
|
||||||
++ run-test
|
++ run-test
|
||||||
|= [bem=beam test=test-func]
|
|= [pax=path test=test-func]
|
||||||
^- [ok=? =tang]
|
^- [ok=? =tang]
|
||||||
|
=+ name=(spud pax)
|
||||||
=+ run=(mule test)
|
=+ run=(mule test)
|
||||||
?- -.run
|
?- -.run
|
||||||
%| |+p.run
|
%| |+(welp p.run leaf+"CRASHED {name}" ~)
|
||||||
%& ?: =(~ p.run)
|
%& ?: =(~ p.run)
|
||||||
&+~
|
&+[leaf+"OK {name}"]~
|
||||||
|+(flop `tang`[leaf+"FAILED" p.run])
|
|+(flop `tang`[leaf+"FAILED {name}" p.run])
|
||||||
==
|
==
|
||||||
:: +resolve-test-paths: add test names to file paths to form full identifiers
|
:: +resolve-test-paths: add test names to file paths to form full identifiers
|
||||||
::
|
::
|
||||||
++ resolve-test-paths
|
++ resolve-test-paths
|
||||||
|= paths-to-tests=(map beam (list test-arm))
|
|= paths-to-tests=(map path (list test-arm))
|
||||||
^- (list test)
|
^- (list test)
|
||||||
%- sort :_ |=([a=test b=test] !(aor s.beam.a s.beam.b))
|
%- sort :_ |=([a=test b=test] !(aor path.a path.b))
|
||||||
^- (list test)
|
^- (list test)
|
||||||
%- zing
|
%- zing
|
||||||
%+ turn ~(tap by paths-to-tests)
|
%+ turn ~(tap by paths-to-tests)
|
||||||
|= [=beam test-arms=(list test-arm)]
|
|= [=path test-arms=(list test-arm)]
|
||||||
^- (list test)
|
^- (list test)
|
||||||
:: for each test, add the test's name to :path
|
:: for each test, add the test's name to :path
|
||||||
::
|
::
|
||||||
%+ turn test-arms
|
%+ turn test-arms
|
||||||
|= =test-arm
|
|= =test-arm
|
||||||
^- test
|
^- test
|
||||||
[beam(s (weld s.beam /[name.test-arm])) func.test-arm]
|
[(weld path /[name.test-arm]) func.test-arm]
|
||||||
:: +get-test-arms: convert test arms to functions and produce them
|
:: +get-test-arms: convert test arms to functions and produce them
|
||||||
::
|
::
|
||||||
++ get-test-arms
|
++ get-test-arms
|
||||||
@ -65,7 +55,7 @@
|
|||||||
=/ fire-arm=nock
|
=/ fire-arm=nock
|
||||||
~| [%failed-to-compile-test-arm name]
|
~| [%failed-to-compile-test-arm name]
|
||||||
q:(~(mint ut typ) p:!>(*tang) [%limb name])
|
q:(~(mint ut typ) p:!>(*tang) [%limb name])
|
||||||
[name |.(;;(tang ?:(quiet.args .*(cor fire-arm) ~>(%bout.[1 name] .*(cor fire-arm)))))]
|
[name |.(;;(tang ~>(%bout.[1 name] .*(cor fire-arm))))]
|
||||||
:: +has-test-prefix: does the arm define a test we should run?
|
:: +has-test-prefix: does the arm define a test we should run?
|
||||||
::
|
::
|
||||||
++ has-test-prefix
|
++ has-test-prefix
|
||||||
@ -102,66 +92,50 @@
|
|||||||
?. hov
|
?. hov
|
||||||
~|(no-tests-at-path+i.bez !!)
|
~|(no-tests-at-path+i.bez !!)
|
||||||
loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez (snoc xup %hoon)] `tex]))
|
loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez (snoc xup %hoon)] `tex]))
|
||||||
++ print-failures
|
|
||||||
|= ls=(list [=beam =tang])
|
|
||||||
^+ same
|
|
||||||
?~ ls
|
|
||||||
same
|
|
||||||
=/ =tank
|
|
||||||
[%rose ["\0a" "/={(trip q.beam.i.ls)}={(spud s.beam.i.ls)}:\0a" ""] tang.i.ls]
|
|
||||||
~> %slog.[3 tank]
|
|
||||||
$(ls t.ls)
|
|
||||||
--
|
--
|
||||||
^- thread:spider
|
^- thread:spider
|
||||||
|= arg=vase
|
|= arg=vase
|
||||||
=/ m (strand ,vase)
|
=/ m (strand ,vase)
|
||||||
^- form:m
|
^- form:m
|
||||||
;< =bowl:strand bind:m get-bowl:strandio
|
;< =bowl:strand bind:m get-bowl:strandio
|
||||||
=/ [quiet=? paz=(list path)]
|
=/ paz=(list path)
|
||||||
:: if no args, test everything under /=base=/tests
|
:: if no args, test everything under /=base=/tests
|
||||||
::
|
::
|
||||||
=* default-tests
|
?~ q.arg
|
||||||
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
|
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
|
||||||
?+ q.arg !!
|
?~ +.q.arg
|
||||||
~ [& default-tests]
|
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
|
||||||
[~ ?] =+ !<([~ quiet=?] arg) [quiet default-tests]
|
:: else cast path to ~[path] if needed
|
||||||
[~ ? ^ *] =+ !<([~ quiet=? paz=(list path)] arg) [quiet paz]
|
::
|
||||||
[~ ? ^] =+ !<([~ quiet=? pax=path] arg) [quiet pax ~]
|
?@ +<.q.arg
|
||||||
[~ ^ *] =+ !<([~ paz=(list path)] arg) [& paz]
|
[(tail !<([~ path] arg)) ~]
|
||||||
[~ *] =+ !<([~ pax=path] arg) [& pax ~]
|
(tail !<([~ (list path)] arg))
|
||||||
==
|
|
||||||
=. quiet.args quiet
|
|
||||||
=/ bez=(list beam)
|
=/ bez=(list beam)
|
||||||
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))
|
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))
|
||||||
;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez)
|
;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez)
|
||||||
=> .(fiz (sort ~(tap in fiz) aor))
|
=> .(fiz (sort ~(tap in fiz) aor))
|
||||||
=| test-arms=(map beam (list test-arm))
|
=| test-arms=(map path (list test-arm))
|
||||||
=| build-failed=(list [beam tang])
|
=| build-ok=?
|
||||||
|- ^- form:m
|
|- ^- form:m
|
||||||
=* gather-tests $
|
=* gather-tests $
|
||||||
?^ fiz
|
?^ fiz
|
||||||
;< [cor=(unit vase) =tang] bind:m (build-file beam.i.fiz)
|
;< cor=(unit vase) bind:m (build-file:strandio beam.i.fiz)
|
||||||
?~ cor
|
?~ cor
|
||||||
gather-tests(fiz t.fiz, build-failed [[beam.i.fiz tang] build-failed])
|
~> %slog.0^leaf+"FAILED {(spud s.beam.i.fiz)} (build)"
|
||||||
|
gather-tests(fiz t.fiz, build-ok |)
|
||||||
|
~> %slog.0^leaf+"built {(spud s.beam.i.fiz)}"
|
||||||
=/ arms=(list test-arm) (get-test-arms u.cor)
|
=/ arms=(list test-arm) (get-test-arms u.cor)
|
||||||
:: if test path specified an arm prefix, filter arms to match
|
:: if test path specified an arm prefix, filter arms to match
|
||||||
=? arms ?=(^ test.i.fiz)
|
=? arms ?=(^ test.i.fiz)
|
||||||
%+ skim arms
|
%+ skim arms
|
||||||
|= test-arm
|
|= test-arm
|
||||||
=((end [3 (met 3 u.test.i.fiz)] name) u.test.i.fiz)
|
=((end [3 (met 3 u.test.i.fiz)] name) u.test.i.fiz)
|
||||||
=. test-arms (~(put by test-arms) beam.i.fiz(s (snip s.beam.i.fiz)) arms)
|
=. test-arms (~(put by test-arms) (snip s.beam.i.fiz) arms)
|
||||||
gather-tests(fiz t.fiz)
|
gather-tests(fiz t.fiz)
|
||||||
=; res=_build-failed
|
%- pure:m !> ^= ok
|
||||||
%- (print-failures res)
|
|
||||||
%- pure:m !> ^= failed
|
|
||||||
%+ turn res
|
|
||||||
|= [=beam *]
|
|
||||||
beam
|
|
||||||
%+ roll (resolve-test-paths test-arms)
|
%+ roll (resolve-test-paths test-arms)
|
||||||
|= [[=beam =test-func] failed=_build-failed]
|
|= [[=path =test-func] ok=_build-ok]
|
||||||
^+ failed
|
^+ ok
|
||||||
=/ res (run-test beam test-func)
|
=/ res (run-test path test-func)
|
||||||
?: -.res
|
%- (slog (flop tang.res))
|
||||||
failed
|
&(ok ok.res)
|
||||||
:_ failed
|
|
||||||
[beam +.res]
|
|
||||||
|
Loading…
Reference in New Issue
Block a user