2020-04-18 11:21:15 +03:00
|
|
|
/- spider
|
2020-04-19 12:11:01 +03:00
|
|
|
/+ strandio
|
2020-04-18 11:21:15 +03:00
|
|
|
=, strand=strand:spider
|
2020-04-19 12:11:01 +03:00
|
|
|
=>
|
|
|
|
|%
|
|
|
|
:: $test: a test with a fully resolved path
|
|
|
|
:: $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
|
|
|
|
::
|
2023-10-17 15:10:04 +03:00
|
|
|
+$ test [=beam func=test-func]
|
2020-04-19 12:11:01 +03:00
|
|
|
+$ test-arm [name=term func=test-func]
|
|
|
|
+$ test-func (trap tang)
|
2024-02-19 22:55:38 +03:00
|
|
|
+$ args quiet=?
|
2020-04-19 12:11:01 +03:00
|
|
|
--
|
|
|
|
=>
|
2023-09-29 18:27:07 +03:00
|
|
|
|_ =args
|
|
|
|
++ build-file
|
|
|
|
|= =beam
|
2023-10-17 15:10:04 +03:00
|
|
|
=/ m (strand ,[(unit vase) tang])
|
2023-09-29 18:27:07 +03:00
|
|
|
^- form:m
|
2024-02-19 22:55:38 +03:00
|
|
|
;< res=(unit vase) bind:m
|
2023-09-29 18:27:07 +03:00
|
|
|
(build-file:strandio beam)
|
2023-10-17 15:10:04 +03:00
|
|
|
%+ pure:m res
|
|
|
|
?. =(res ~)
|
|
|
|
~
|
|
|
|
~[leaf+"FAILED"]
|
|
|
|
:: +run-test: execute an individual test
|
2021-10-27 21:49:55 +03:00
|
|
|
::
|
2020-04-19 12:11:01 +03:00
|
|
|
++ run-test
|
2024-02-19 22:55:38 +03:00
|
|
|
|= [bem=beam test=test-func]
|
|
|
|
^- [ok=? =tang]
|
2020-04-19 12:11:01 +03:00
|
|
|
=+ run=(mule test)
|
|
|
|
?- -.run
|
2024-02-19 22:55:38 +03:00
|
|
|
%| |+p.run
|
2020-04-19 12:11:01 +03:00
|
|
|
%& ?: =(~ p.run)
|
2024-02-19 22:55:38 +03:00
|
|
|
&+~
|
|
|
|
|+(flop `tang`[leaf+"FAILED" p.run])
|
2020-04-19 12:11:01 +03:00
|
|
|
==
|
|
|
|
:: +resolve-test-paths: add test names to file paths to form full identifiers
|
|
|
|
::
|
|
|
|
++ resolve-test-paths
|
2023-10-17 15:10:04 +03:00
|
|
|
|= paths-to-tests=(map beam (list test-arm))
|
2020-04-19 12:11:01 +03:00
|
|
|
^- (list test)
|
2023-10-17 15:10:04 +03:00
|
|
|
%- sort :_ |=([a=test b=test] !(aor s.beam.a s.beam.b))
|
2020-04-19 12:11:01 +03:00
|
|
|
^- (list test)
|
|
|
|
%- zing
|
|
|
|
%+ turn ~(tap by paths-to-tests)
|
2023-10-17 15:10:04 +03:00
|
|
|
|= [=beam test-arms=(list test-arm)]
|
2020-04-19 12:11:01 +03:00
|
|
|
^- (list test)
|
|
|
|
:: for each test, add the test's name to :path
|
|
|
|
::
|
|
|
|
%+ turn test-arms
|
|
|
|
|= =test-arm
|
|
|
|
^- test
|
2023-10-17 15:10:04 +03:00
|
|
|
[beam(s (weld s.beam /[name.test-arm])) func.test-arm]
|
2020-04-19 12:11:01 +03:00
|
|
|
:: +get-test-arms: convert test arms to functions and produce them
|
|
|
|
::
|
|
|
|
++ get-test-arms
|
|
|
|
|= [typ=type cor=*]
|
|
|
|
^- (list test-arm)
|
|
|
|
=/ arms=(list @tas) (sloe typ)
|
|
|
|
%+ turn (skim arms has-test-prefix)
|
|
|
|
|= name=term
|
|
|
|
^- test-arm
|
|
|
|
=/ fire-arm=nock
|
|
|
|
~| [%failed-to-compile-test-arm name]
|
|
|
|
q:(~(mint ut typ) p:!>(*tang) [%limb name])
|
2023-09-29 18:27:07 +03:00
|
|
|
[name |.(;;(tang ?:(quiet.args .*(cor fire-arm) ~>(%bout.[1 name] .*(cor fire-arm)))))]
|
2020-04-19 12:11:01 +03:00
|
|
|
:: +has-test-prefix: does the arm define a test we should run?
|
|
|
|
::
|
|
|
|
++ has-test-prefix
|
|
|
|
|= a=term ^- ?
|
2020-12-02 11:47:29 +03:00
|
|
|
=((end [3 5] a) 'test-')
|
2020-04-20 08:33:29 +03:00
|
|
|
::
|
|
|
|
++ find-test-files
|
2020-06-28 12:06:16 +03:00
|
|
|
=| fiz=(set [=beam test=(unit term)])
|
2020-04-20 08:33:29 +03:00
|
|
|
=/ m (strand ,_fiz)
|
2020-06-28 12:06:16 +03:00
|
|
|
|= bez=(list beam)
|
2020-04-20 08:33:29 +03:00
|
|
|
^- form:m
|
|
|
|
=* loop $
|
2020-06-28 12:06:16 +03:00
|
|
|
?~ bez
|
2020-04-20 08:33:29 +03:00
|
|
|
(pure:m fiz)
|
2020-11-24 04:20:36 +03:00
|
|
|
;< hav=? bind:m (check-for-file:strandio -.i.bez (snoc s.i.bez %hoon))
|
2020-04-20 08:33:29 +03:00
|
|
|
?: hav
|
2020-11-24 04:20:36 +03:00
|
|
|
loop(bez t.bez, fiz (~(put in fiz) [i.bez(s (snoc s.i.bez %hoon)) ~]))
|
2020-06-28 12:06:16 +03:00
|
|
|
;< fez=(list path) bind:m (list-tree:strandio i.bez)
|
2020-04-20 08:33:29 +03:00
|
|
|
?. =(~ fez)
|
2020-11-26 18:31:46 +03:00
|
|
|
=/ foz
|
|
|
|
%+ murn fez
|
|
|
|
|= p=path
|
|
|
|
?. =(%hoon (rear p)) ~
|
|
|
|
(some [[-.i.bez p] ~])
|
2020-06-28 12:06:16 +03:00
|
|
|
loop(bez t.bez, fiz (~(gas in fiz) foz))
|
2021-02-20 04:54:27 +03:00
|
|
|
::
|
|
|
|
:: XX this logic appears to be vestigial
|
|
|
|
::
|
|
|
|
=/ tex=term
|
|
|
|
~| bad-test-beam+i.bez
|
|
|
|
=-(?>(((sane %tas) -) -) (rear s.i.bez))
|
2020-11-24 04:20:36 +03:00
|
|
|
=/ xup=path (snip s.i.bez)
|
|
|
|
;< hov=? bind:m (check-for-file:strandio i.bez(s (snoc xup %hoon)))
|
2020-04-20 08:33:29 +03:00
|
|
|
?. hov
|
2020-06-28 12:06:16 +03:00
|
|
|
~|(no-tests-at-path+i.bez !!)
|
2020-11-24 04:20:36 +03:00
|
|
|
loop(bez t.bez, fiz (~(put in fiz) [[-.i.bez (snoc xup %hoon)] `tex]))
|
2023-10-17 15:10:04 +03:00
|
|
|
++ 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)
|
2020-04-19 12:11:01 +03:00
|
|
|
--
|
2020-04-18 11:21:15 +03:00
|
|
|
^- thread:spider
|
|
|
|
|= arg=vase
|
|
|
|
=/ m (strand ,vase)
|
|
|
|
^- form:m
|
2022-05-28 03:22:32 +03:00
|
|
|
;< =bowl:strand bind:m get-bowl:strandio
|
2024-02-19 22:55:38 +03:00
|
|
|
=/ [quiet=? paz=(list path)]
|
|
|
|
:: if no args, test everything under /=base=/tests
|
2022-05-28 03:22:32 +03:00
|
|
|
::
|
2024-02-19 22:55:38 +03:00
|
|
|
=* default-tests
|
2022-05-28 03:22:32 +03:00
|
|
|
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
|
2024-02-19 22:55:38 +03:00
|
|
|
?+ q.arg !!
|
|
|
|
~ [& default-tests]
|
|
|
|
[~ ?] =+ !<([~ quiet=?] arg) [quiet default-tests]
|
|
|
|
[~ ? ^ *] =+ !<([~ quiet=? paz=(list path)] arg) [quiet paz]
|
|
|
|
[~ ? ^] =+ !<([~ quiet=? pax=path] arg) [quiet pax ~]
|
|
|
|
[~ ^ *] =+ !<([~ paz=(list path)] arg) [& paz]
|
|
|
|
[~ *] =+ !<([~ pax=path] arg) [& pax ~]
|
|
|
|
==
|
|
|
|
=. quiet.args quiet
|
2020-06-28 12:06:16 +03:00
|
|
|
=/ bez=(list beam)
|
2021-02-20 04:54:27 +03:00
|
|
|
(turn paz |=(p=path ~|([%test-not-beam p] (need (de-beam p)))))
|
2020-06-28 12:06:16 +03:00
|
|
|
;< fiz=(set [=beam test=(unit term)]) bind:m (find-test-files bez)
|
|
|
|
=> .(fiz (sort ~(tap in fiz) aor))
|
2023-10-17 15:10:04 +03:00
|
|
|
=| test-arms=(map beam (list test-arm))
|
|
|
|
=| build-failed=(list [beam tang])
|
2020-04-18 11:21:15 +03:00
|
|
|
|- ^- form:m
|
|
|
|
=* gather-tests $
|
2020-04-20 08:33:29 +03:00
|
|
|
?^ fiz
|
2023-10-17 15:10:04 +03:00
|
|
|
;< [cor=(unit vase) =tang] bind:m (build-file beam.i.fiz)
|
2021-02-20 04:54:27 +03:00
|
|
|
?~ cor
|
2024-02-19 22:55:38 +03:00
|
|
|
gather-tests(fiz t.fiz, build-failed [[beam.i.fiz tang] build-failed])
|
2021-02-20 04:54:27 +03:00
|
|
|
=/ arms=(list test-arm) (get-test-arms u.cor)
|
2023-04-11 22:55:13 +03:00
|
|
|
:: if test path specified an arm prefix, filter arms to match
|
2020-04-20 08:33:29 +03:00
|
|
|
=? arms ?=(^ test.i.fiz)
|
2023-04-11 22:55:13 +03:00
|
|
|
%+ skim arms
|
|
|
|
|= test-arm
|
|
|
|
=((end [3 (met 3 u.test.i.fiz)] name) u.test.i.fiz)
|
2023-10-17 15:10:04 +03:00
|
|
|
=. test-arms (~(put by test-arms) beam.i.fiz(s (snip s.beam.i.fiz)) arms)
|
2020-04-20 08:33:29 +03:00
|
|
|
gather-tests(fiz t.fiz)
|
2023-10-17 15:10:04 +03:00
|
|
|
=; res=_build-failed
|
|
|
|
%- (print-failures res)
|
|
|
|
%- pure:m !> ^= failed
|
|
|
|
%+ turn res
|
|
|
|
|= [=beam *]
|
|
|
|
beam
|
2020-04-18 11:21:15 +03:00
|
|
|
%+ roll (resolve-test-paths test-arms)
|
2024-02-19 22:55:38 +03:00
|
|
|
|= [[=beam =test-func] failed=_build-failed]
|
|
|
|
^+ failed
|
|
|
|
=/ res (run-test beam test-func)
|
|
|
|
?: -.res
|
|
|
|
failed
|
|
|
|
:_ failed
|
|
|
|
[beam +.res]
|