forked from DGNum/liminix
ifwait: don't run on load if in test harness
This commit is contained in:
parent
38ed91f641
commit
0787807a7f
2 changed files with 17 additions and 10 deletions
|
@ -33,6 +33,7 @@
|
||||||
(when (. got params.expecting)
|
(when (. got params.expecting)
|
||||||
(os.exit 0))))
|
(os.exit 0))))
|
||||||
|
|
||||||
|
(fn run []
|
||||||
(let [parameters
|
(let [parameters
|
||||||
(assert (parse-args arg)
|
(assert (parse-args arg)
|
||||||
(.. "Usage: " (. arg 0) " [-v] ifname [present|up|running]"))]
|
(.. "Usage: " (. arg 0) " [-v] ifname [present|up|running]"))]
|
||||||
|
@ -41,4 +42,8 @@
|
||||||
parameters.link " to be " parameters.expecting)))
|
parameters.link " to be " parameters.expecting)))
|
||||||
|
|
||||||
(each [event (nl.events {:link true})]
|
(each [event (nl.events {:link true})]
|
||||||
(run-event parameters event)))
|
(run-event parameters event))))
|
||||||
|
|
||||||
|
(when (not (= (. arg 0) "test")) (run))
|
||||||
|
|
||||||
|
{ : run }
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
(tset package.loaded :anoia.nl { :events events })
|
(tset package.loaded :anoia.nl { :events events })
|
||||||
|
|
||||||
(set _G.arg (doto ["-v" "dummy0" "up"] (tset 0 "ifwait")))
|
(set _G.arg (doto ["-v" "dummy0" "up"] (tset 0 "test")))
|
||||||
|
|
||||||
(fennel.dofile "ifwait.fnl" { :correlate true })
|
(local ifwait (require :ifwait))
|
||||||
|
|
||||||
|
(ifwait.run)
|
||||||
|
|
Loading…
Reference in a new issue