Updoc patches for review

Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
Newsgroups gmane.comp.lang.e.general
Organization IT Innovation
Message-ID <[email protected]>
My "next" branch has four patches that I find helpful for testing:


commit 23fefa2354eaf617b4f3ba170cd43d551cb83253
Author: Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
Date:   Tue Jul 27 15:57:55 2010 +0100
http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/23fefa2354eaf617b4f3ba170cd43d551cb83253

    Split out most of updoc code from updoc.e
    
    Allows updoc to be called from other programs. Also, allow envExtras to be
    passed in to extend the script's environment.

This is useful for programs that configure various modules before
running the tests. Also, it allows us to insert mock objects for
SturdyRef, etc.


commit 27a245fe6d72ee3184df142431e3e44090cb2ab3
Author: Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
Date:   Mon Aug 2 15:52:18 2010 +0100
http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/27a245fe6d72ee3184df142431e3e44090cb2ab3

    Added "updoc.trace" property
    
    If true, this prints each expression before evaluating it.
    If false, we print a dot after each expression is done (before, we only printed
    progress dots when comparing the results at the end).

This is useful to see where a test is hanging if e.g. a promise never
resolves, or for seeing which bits are slow.


commit 6c732fecfb2a92bfc5353c290dc3833bba3507f3
Author: Thomas Leonard <[email protected]>
Date:   Wed Mar 31 19:05:33 2010 +0100
http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/6c732fecfb2a92bfc5353c290dc3833bba3507f3

    Load updoc.e from e.jar

This makes e.jar more self-contained. The jar already contained a copy
of updoc.e, but it was trying to load it from EHOME/scripts instead.


commit 09a5f67649f335653be274863b7bfde6976260e9
Author: Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
Date:   Thu Aug 5 15:38:21 2010 +0100
http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/09a5f67649f335653be274863b7bfde6976260e9

    Provide a rune script that works out of the box
    
    Instead of having to edit rune-template.txt, the user can start rune
    immediately by running "./rune" from the unpacked archive.
    
    Also, include a 0install/e-core.xml file in the distribution so people can
    register it with 0install if desired.


This last one is useful for testing your program against multiple
versions of E, including the latest dev snapshot.

For example, say you have a simple application consisting of two files
in one directory:

$ cat myprog.e 
#!/usr/bin/env rune
def compiled := e`41+1`.compile(safeScope)
println(compiled())

$ cat myprog.xml
<?xml version="1.0" ?>
<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
  <name>myprog</name>
  <summary>test program</summary>
  <description>A test program.</description>
  <implementation id="." main="myprog.e" version="0.1">
    <requires interface="http://repo.roscidus.com/e/e-core">
      <environment insert="." mode="prepend" name="PATH"/>
    </requires>
  </implementation>
</interface>

If you want to see which versions of E this program works with, first
get 0test (http://0install.net/0test.html):

$ 0alias 0test http://0install.net/2008/interfaces/0test.xml

Then register your svn build as an extra source of versions:

$ 0launch --feed rune-dev/0install/e-core.xml
Add as feed for 'http://repo.roscidus.com/e/e-core'

Then, to test against the last two stable releases and the dev version:

$ 0test -t '$1' myprog.xml \
  http://repo.roscidus.com/e/e-core 0.9.2-post2 0.9.2-post3 0.9.2-post3-post

[ ... snip verbose progress output ...]

Passed  : myprog v0.1 e-core v0.9.2-post3 openjdk-6-jre v6, myprog v0.1 e-core v0.9.2-post3-post openjdk-6-jre v6
Skipped : 
Failed  : myprog v0.1 e-core v0.9.2-post2 openjdk-6-jre v6

This shows that myprog doesn't work with E 0.9.2-post2
(<NoSuchMethodException: <a CallExpr>.compile/1>), and you could then
add that as a restriction in myprog.xml, e.g.

    <requires interface="http://repo.roscidus.com/e/e-core"> 
      <environment insert="." mode="prepend" name="PATH"/> 
      <version not-before='0.9.2-post3'/> 
    </requires>

[ note: I wanted to use an updoc script for the example, but since older
versions of E return 0 (success) even if the tests fail, that doesn't
work ]


-- 
Dr Thomas Leonard
IT Innovation Centre
2 Venture Road
Southampton
Hampshire SO16 7NP

Tel: +44 0 23 8076 0834
Fax: +44 0 23 8076 0833
mailto:tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]
http://www.it-innovation.soton.ac.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.