[racket] How to run tests for a package install

From: Greg Hendershott (greghendershott at gmail.com)
Date: Fri Nov 8 10:23:47 EST 2013

Here's a snippet from a .travis.yml for my markdown package (for
example; my question is about packages generally). It runs every time
a commit it pushed to GitHub:

# A version of Racket was just installed and a git clone of our
project was just done.
/usr/racket/bin/raco pkg install --deps search-auto rackjure parsack
cd markdown
/usr/racket/bin/raco make main.rkt
/usr/racket/bin/raco test -x .

Needs to make sure three things:
1. Its deps install.
2. It builds.
3. Its tests (in `test` submodules sprinkled among files) pass.

A flaw with this is that the deps are duplicated here and in the
info.rkt. A way to address this is simply to install the package. For
example change the entire script to just this:

/usr/racket/bin/raco pkg install markdown

One problem is that this installs using the PNR, which certainly isn't
updated yet. That's easy to fix. Just install directly from GitHub:

/usr/racket/bin/raco pkg install github://github.com/greghendershott/markdown

But the other problem is that, although the `raco make` is done as
part of the pkg install, the `raco test -x .` isn't done.  And I have
tests in `test` submodules, using `(module+ test)`, sprinkled among
the files.

I'm not sure the best way to do this.

1. Do `raco test -x <path>` where <path> is determined {some
Racket-version-independent sane method, which is what?}?

2. Add a "run-tests.rkt" that does the equivalent of `raco test -x .`,
including an exit code to make Travis CI report a failure.

3. Some simple/obvious other way I'm being too dense to think of right
now?  (I hoped the process of writing this post would make me realize
the answer, but no luck this time.)

p.s. I usually set up .travis.yml to test against a few Racket
versions. So, even if Racket 6 added a "pkg install --and-run-tests"
flag, which would be cool, it wouldn't help me with say 5.3.5 or
whatever.

Posted on the users mailing list.