Monday, 3 October 2011

How to compile and execute/run Dart programming language

Please follow the instructions in the PreparingYourMachine page.

Building everything

Follow the steps in GettingTheSource to retrieve everything (use all.deps). You will end up with a tree that looks like this:
   dart/
     client/
     compiler/
     corelib/
     language/
     runtime/
     tools/
     ...
then, from the dart directory use the build.py script under tools/:
$ cd dart
$ ./tools/build.py --arch=ia32
We recommend that you use a local file system at least for the output of the builds. If your code is in some nfs partition, you can link the out directory to a local directory:
$ cd dart/
$ mkdir -p /usr/local/dart-out/
$ ln -s -f /usr/local/dart-out/ out

Testing

All tests are executed using the test.py script under tools/. You can run all tests as follows:
$ ./tools/test.py --arch=ia32,dartc,chromium
You can run a specific test by specifying it's full name or a prefix. For instance, the following runs only tests from the core libraries:
$ ./tools/test.py --arch=ia32,dartc,chromium corelib
the following runs a single test:
$ ./tools/test.py --arch=ia32,dartc,chromium corelib/ListTest

Troubleshooting and tips for browser tests

  1. If a test fails, run it again individually, passing also -v --keep_temporary_files
  2. To probe the test failure with a debugger, grab the URL printed by the test, load it in Chrome, and go at it with Dev Tools.
    • Note: the generated html test is deleted unless you specify --keep_temporary_files when running test.py.
    • Tip: in the Scripts tab's lower left is a "stop sign" icon you can use to break on any exceptions in your test.
Some common problems you might get when running tests for the first time:
  • some fonts are missing. chromium tests use DumpRenderTree, which needs some sets of fonts. See LayoutTestsLinux for instructions in how to fix it.
  • no display is set (e.g. running tests from an ssh terminal). DumpRenderTree is a nearly headless browser. Even thought it doesn't open any GUI, it still requires to have an X session available. There are several ways to work around this:
    • use xvfb:
    • xvfb-run ./tools/test.py --arch=chromium ...
    • other options include, using ssh X tunneling (ssh -Y), NX, vnc, setting up xhost and export the DISPLAY environment variable, or simply run tests locally

Building the standalone VM

Follow the steps in GettingTheSource to retrieve the standalone VM (use standalone.deps). You will end up with a tree that looks like this:
   dart/
     corelib/
     language/
     runtime/
     standalone.deps/
     tests/
     third_party/
     tools/
then, from the runtime directory use the build.py script under tools/:
$ cd dart/runtime
$ ../tools/build.py --arch=ia32
We recommend that you use a local file system at least for the output of the builds.

Testing

All tests are executed using the test.py script under tools/. You can run all tests as follows from the runtime directory:
$ ../tools/test.py --arch=ia32
By default the build and test scripts will select the debug binaries. You can build and test the release version of the VM by specifying --mode=release or both debug and release by specifying --mode=all on the respective build.py and test.py command lines.

No comments:

Post a Comment