]> gitweb.factorcode.org Git - factor.git/commitdiff
zealot.help-lint: Add a help-lint for travisci that ignores a lot of flaky resource...
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 5 Oct 2019 17:04:14 +0000 (12:04 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 5 Oct 2019 17:04:14 +0000 (12:04 -0500)
Some work needs to be done with ensuring that resources are cleaned up before reporting resource leaks and exiting. In the meantime, we want TravisCI to be useful enough to catch help-lint errors, so ignore a bunch of errors that it might find. These leaks are still tested for in the more thorough mason CI.

.travis.yml
extra/zealot/help-lint/authors.txt [new file with mode: 0644]
extra/zealot/help-lint/help-lint.factor [new file with mode: 0644]

index 72c09be6c8b0c11110f8bcab8e6ddd937639f490..791416095ee3541a8a5c5d26430a7490f7f3d70b 100644 (file)
@@ -72,5 +72,5 @@ script:
   - "./factor -e='USING: memory vocabs.hierarchy ; \"zealot\" load save'"
   - './factor -run=zealot.cli-changed-vocabs'
   - './factor -run=tools.test `./factor -run=zealot.cli-changed-vocabs | paste -s -d " " -`'
-  - './factor -run=help.lint `./factor -run=zealot.cli-changed-vocabs | paste -s -d " " -`'
+  - './factor -run=zealot.help-lint `./factor -run=zealot.cli-changed-vocabs | paste -s -d " " -`'
   - "./factor -e='USING: modern.paths tools.test sequences system kernel math random ; core-vocabs os macosx? [ dup length 3 /i sample ] when [ test ] each'"
diff --git a/extra/zealot/help-lint/authors.txt b/extra/zealot/help-lint/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/zealot/help-lint/help-lint.factor b/extra/zealot/help-lint/help-lint.factor
new file mode 100644 (file)
index 0000000..76b6f5a
--- /dev/null
@@ -0,0 +1,30 @@
+! Copyright (C) 2019 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs cache command-line help.lint io io.monitors kernel
+namespaces prettyprint sequences system vocabs.hierarchy ;
+IN: zealot.help-lint
+
+! FIXME: help-lint sometimes lists monitors and event-streams as leaked.
+! event-stream is macosx-only so hack it into a string
+CONSTANT: ignored-resources {
+    "linux-monitor" "macosx-monitor" "malloc-ptr"
+    "epoll-mx" "server-port" "openssl-context"
+    "cache-assoc" "input-port" "fd" "output-port" "stdin"
+    "event-stream"
+}
+
+: filter-flaky-resources ( seq -- seq' )
+    [ drop unparse ignored-resources member? ] assoc-reject ;
+
+! Allow testing without calling exit
+: zealot-help-lint ( exit? -- )
+    command-line get [ load ] each
+    help-lint-all
+    lint-failures get filter-flaky-resources
+    [ nip assoc-empty? [ "==== FAILING LINT" print :lint-failures flush ] unless ]
+    [ swap [ 0 1 ? (exit) ] [ drop ] if ] 2bi ;
+
+: zealot-help-lint-main ( -- )
+    t zealot-help-lint ;
+
+MAIN: zealot-help-lint-main
\ No newline at end of file