[racket] How to run tests for a package install

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Nov 8 11:21:23 EST 2013

Do you want

raco test -x -p markdown

?

On Fri, Nov 8, 2013 at 8:23 AM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> 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.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.